7 #ifndef GHOST_CU_UTIL_H
8 #define GHOST_CU_UTIL_H
13 #ifdef GHOST_HAVE_CUDA
14 #include <cublas_v2.h>
16 #include <cusparse_v2.h>
19 #ifdef GHOST_HAVE_CUDA
char ** names
The names of each distince device type.
Definition: cu_util.h:46
int ghost_cu_deviceprop
Definition: cu_util.h:27
ghost_error ghost_cu_reduce(void *out, void *data, ghost_datatype dt, ghost_lidx n)
Header file for type definitions.
ghost_error ghost_cu_cublas_handle(ghost_cublas_handle_t *handle)
Get the cuBLAS handle.
Definition: cu_util.c:452
ghost_error ghost_cu_malloc_mapped(void **mem, const size_t size)
Allocate mapped host memory.
Definition: cu_util.c:397
ghost_error ghost_cu_finalize()
Definition: cu_util.c:548
ghost_error ghost_cu_memcpy(void *dest, void *src, size_t bytesize)
Memcpy GPU memory.
Definition: cu_util.c:108
Information about avaiable GPUs.
Definition: cu_util.h:34
ghost_error ghost_cu_ndevice(int *devcount)
Get the number of available GPUs.
Definition: cu_util.c:264
ghost_error ghost_cu_upload(void *devmem, void *hostmem, size_t bytesize)
Upload memory from the the host to the GPU.
Definition: cu_util.c:160
ghost_error ghost_cu_deviceprop_get(ghost_cu_deviceprop *prop)
Get the CUDA device properties.
Definition: cu_util.c:517
int * ndevice
The number of GPUs of each distinct device type.
Definition: cu_util.h:42
ghost_error ghost_cu_init(int dev)
Initalize CUDA on a given device.
Definition: cu_util.c:33
ghost_error ghost_cu_memset(void *s, int c, size_t n)
Memset GPU memory.
Definition: cu_util.c:145
int32_t ghost_lidx
Definition: types.h:503
ghost_error ghost_cu_device(int *device)
Get the active GPU.
Definition: cu_util.c:435
ghost_error ghost_cu_memtranspose(int torows, int tocols, void *to, int ldto, const void *from, int ldfrom, ghost_datatype dt)
Definition: cu_util.c:566
ghost_error ghost_cu_malloc(void **mem, size_t bytesize)
Allocate CUDA device memory.
Definition: cu_util.c:88
ghost_error ghost_cu_gpu_info_create(ghost_gpu_info **gpu_info)
Get information about available GPUs.
Definition: cu_util.c:280
Types, functions and macros for error handling.
ghost_error
Error return type.
Definition: error.h:23
ghost_error ghost_cu_memcpy2d(void *dest, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height)
Memcpy strided GPU memory. Copy height rows of width bytes each.
Definition: cu_util.c:126
int ghost_cu_rand_generator
Definition: cu_util.h:28
ghost_error ghost_cu_rand_generator_get(ghost_cu_rand_generator *gen)
Definition: cu_util.c:530
ghost_error ghost_cu_free(void *mem)
Free GPU memory.
Definition: cu_util.c:232
ghost_error ghost_cu_download2d(void *dest, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height)
Download strided memory from a GPU to the host. Copy height rows of width bytes each.
Definition: cu_util.c:196
ghost_error ghost_cu_barrier()
Wait for any outstanding CUDA kernel.
Definition: cu_util.c:246
ghost_datatype
Available primitive data types.
Definition: types.h:248
ghost_error ghost_cu_cusparse_handle(ghost_cusparse_handle_t *handle)
Get the CuSparse handle.
Definition: cu_util.c:469
ghost_error ghost_cu_download(void *hostmem, void *devmem, size_t bytesize)
Download memory from a GPU to the host.
Definition: cu_util.c:215
int ghost_cublas_handle_t
Definition: cu_util.h:25
ghost_error ghost_cu_reduce_multiple(void *out, void *data, ghost_datatype dt, ghost_lidx n, ghost_lidx ncols)
ghost_error ghost_cu_version(int *ver)
Get the CUDA version.
Definition: cu_util.c:486
ghost_error ghost_cu_malloc_managed(void **mem, size_t bytesize)
Allocate managed CUDA device memory.
Definition: cu_util.c:68
ghost_error ghost_cu_upload2d(void *dest, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height)
Upload strided memory from the host to the GPU. Copy height rows of width bytes each.
Definition: cu_util.c:177
int ghost_cusparse_handle_t
Definition: cu_util.h:26
ghost_error ghost_cu_malloc_pinned(void **mem, const size_t size)
Allocate pinned host memory.
Definition: cu_util.c:416
int ndistinctdevice
The number of distinct CUDA device types.
Definition: cu_util.h:38
ghost_error ghost_cu_free_host(void *mem)
Free host memory which has been allocated with ghost_cu_malloc_pinned() or ghost_cu_malloc_mapped().
Definition: cu_util.c:505