1 #ifndef __CS_BASE_CUDA_H__ 2 #define __CS_BASE_CUDA_H__ 48 #define CS_CUDA_CHECK(a) { \ 49 cudaError_t ret_code = a; \ 50 if (cudaSuccess != ret_code) { \ 51 bft_error(__FILE__, __LINE__, 0, "[CUDA error] %d: %s\n running: %s", \ 52 ret_code, ::cudaGetErrorString(ret_code), #a); \ 56 #define CS_CUDA_CHECK_CALL(a, file_name, line_num) { \ 57 cudaError_t ret_code = a; \ 58 if (cudaSuccess != ret_code) { \ 59 bft_error(file_name, line_num, 0, "[CUDA error] %d: %s\n running: %s", \ 60 ret_code, ::cudaGetErrorString(ret_code), #a); \ 68 #define CS_CUDA_WARP_SIZE 32 99 #if defined(HAVE_CUDA) 122 cs_cuda_mem_malloc_device(
size_t n,
123 const char *var_name,
124 const char *file_name,
148 cs_cuda_mem_malloc_host(
size_t n,
149 const char *var_name,
150 const char *file_name,
174 cs_cuda_mem_malloc_managed(
size_t n,
175 const char *var_name,
176 const char *file_name,
200 cs_cuda_mem_free(
void *
p,
201 const char *var_name,
202 const char *file_name,
226 cs_cuda_mem_free_host(
void *
p,
227 const char *var_name,
228 const char *file_name,
246 cs_cuda_copy_h2d(
void *dst,
268 cs_cuda_copy_h2d_async(
void *dst,
289 cs_cuda_copy_d2h(
void *dst,
310 cs_cuda_copy_d2h_async(
void *dst,
331 cs_cuda_prefetch_h2d(
void *dst,
351 cs_cuda_prefetch_d2h(
void *dst,
369 cs_cuda_copy_d2d(
void *dst,
394 static inline unsigned int 396 unsigned int block_size)
398 return (n % block_size) ? n/block_size : n/block_size + 1;
405 #if defined(HAVE_CUDA) 416 cs_base_cuda_device_info(
cs_log_t log_id);
427 cs_base_cuda_version_info(
cs_log_t log_id);
438 cs_base_cuda_compiler_info(
cs_log_t log_id);
452 cs_base_cuda_select_default_device(
void);
463 cs_base_cuda_get_device(
void);
int cs_glob_cuda_device_id
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
int cs_glob_cuda_max_blocks
Definition: cs_field_pointer.h:67
int cs_glob_cuda_max_threads_per_block
cs_log_t
Definition: cs_log.h:48
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
static unsigned int cs_cuda_grid_size(cs_lnum_t n, unsigned int block_size)
Compute grid size for given array and block sizes.
Definition: cs_base_cuda.h:395
int cs_glob_cuda_max_block_size
#define END_C_DECLS
Definition: cs_defs.h:511