![]() |
GHOST
1.1.2
General, Hybrid, and Optimized Sparse Toolkit
|
#include "ghost/config.h"#include "ghost/types.h"#include "ghost/core.h"#include "ghost/util.h"#include "ghost/sparsemat.h"#include "ghost/locality.h"#include "ghost/log.h"#include "ghost/rand.h"#include <string.h>#include <stdlib.h>#include <libgen.h>#include <unistd.h>
Macros | |
| #define | ghost_cu_MAX_DEVICE_NAME_LEN 500 |
Functions | |
| ghost_error | ghost_cu_init (int dev) |
| Initalize CUDA on a given device. More... | |
| ghost_error | ghost_cu_malloc_managed (void **mem, size_t bytesize) |
| Allocate managed CUDA device memory. More... | |
| ghost_error | ghost_cu_malloc (void **mem, size_t bytesize) |
| Allocate CUDA device memory. More... | |
| ghost_error | ghost_cu_memcpy (void *dest, void *src, size_t bytesize) |
| Memcpy GPU memory. More... | |
| 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. More... | |
| ghost_error | ghost_cu_memset (void *s, int c, size_t n) |
| Memset GPU memory. More... | |
| ghost_error | ghost_cu_upload (void *devmem, void *hostmem, size_t bytesize) |
| Upload memory from the the host to the GPU. More... | |
| 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. More... | |
| 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. More... | |
| ghost_error | ghost_cu_download (void *hostmem, void *devmem, size_t bytesize) |
| Download memory from a GPU to the host. More... | |
| ghost_error | ghost_cu_free (void *mem) |
| Free GPU memory. More... | |
| ghost_error | ghost_cu_barrier () |
| Wait for any outstanding CUDA kernel. More... | |
| static int | stringcmp (const void *x, const void *y) |
| ghost_error | ghost_cu_ndevice (int *devcount) |
| Get the number of available GPUs. More... | |
| ghost_error | ghost_cu_gpu_info_create (ghost_gpu_info **devInfo) |
| Get information about available GPUs. More... | |
| ghost_error | ghost_cu_malloc_mapped (void **mem, const size_t size) |
| Allocate mapped host memory. More... | |
| ghost_error | ghost_cu_malloc_pinned (void **mem, const size_t size) |
| Allocate pinned host memory. More... | |
| ghost_error | ghost_cu_device (int *device) |
| Get the active GPU. More... | |
| ghost_error | ghost_cu_cublas_handle (ghost_cublas_handle_t *handle) |
| Get the cuBLAS handle. More... | |
| ghost_error | ghost_cu_cusparse_handle (ghost_cusparse_handle_t *handle) |
| Get the CuSparse handle. More... | |
| ghost_error | ghost_cu_version (int *ver) |
| Get the CUDA version. More... | |
| 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(). More... | |
| ghost_error | ghost_cu_deviceprop_get (ghost_cu_deviceprop *prop) |
| Get the CUDA device properties. More... | |
| ghost_error | ghost_cu_rand_generator_get (ghost_cu_rand_generator *gen) |
| ghost_error | ghost_cu_finalize () |
| ghost_error | ghost_cu_memtranspose (int m, int n, void *to, int ldto, const void *from, int ldfrom, ghost_datatype dt) |
| #define ghost_cu_MAX_DEVICE_NAME_LEN 500 |
| ghost_error ghost_cu_barrier | ( | ) |
Wait for any outstanding CUDA kernel.

| ghost_error ghost_cu_cublas_handle | ( | ghost_cublas_handle_t * | handle | ) |
Get the cuBLAS handle.
| handle | Where to store the handle. |
| ghost_error ghost_cu_cusparse_handle | ( | ghost_cusparse_handle_t * | handle | ) |
Get the CuSparse handle.
| handle | Where to store the handle. |
| ghost_error ghost_cu_device | ( | int * | device | ) |
Get the active GPU.
| device | Where to store the device number. |
| ghost_error ghost_cu_deviceprop_get | ( | ghost_cu_deviceprop * | prop | ) |
Get the CUDA device properties.
| prop | Where to store the properties. |
| ghost_error ghost_cu_download | ( | void * | hostmem, |
| void * | devmem, | ||
| size_t | bytesize | ||
| ) |
Download memory from a GPU to the host.
| hostmem | The host side memory location. |
| devmem | The device side memory location. |
| bytesize | Number of bytes. |
| 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.
| dest | The host memory. |
| dpitch | The pitch in the host memory. |
| src | The device memory. |
| spitch | The pitch in the device memory. |
| width | The number of bytes per row. |
| height | The number of rows. |
| ghost_error ghost_cu_finalize | ( | ) |
| ghost_error ghost_cu_free | ( | void * | mem | ) |
Free GPU memory.
| mem | The memory location. |
| 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().
| mem | The memory location. |
| ghost_error ghost_cu_gpu_info_create | ( | ghost_gpu_info ** | gpu_info | ) |
Get information about available GPUs.
| gpu_info | Where to store the GPU info. |

| ghost_error ghost_cu_init | ( | int | dev | ) |
Initalize CUDA on a given device.
| dev | The device number. |
| ghost_error ghost_cu_malloc | ( | void ** | mem, |
| size_t | bytesize | ||
| ) |
Allocate CUDA device memory.
| mem | Where to store the memory. |
| bytesize | The number of bytes to allocate. |
| ghost_error ghost_cu_malloc_managed | ( | void ** | mem, |
| size_t | bytesize | ||
| ) |
Allocate managed CUDA device memory.
| mem | Where to store the memory. |
| bytesize | The number of bytes to allocate. |
| ghost_error ghost_cu_malloc_mapped | ( | void ** | mem, |
| const size_t | size | ||
| ) |
Allocate mapped host memory.
| mem | Where to store the memory. |
| size | The number of bytes to allocate. |
| ghost_error ghost_cu_malloc_pinned | ( | void ** | mem, |
| const size_t | size | ||
| ) |
Allocate pinned host memory.
| mem | Where to store the memory. |
| size | The number of bytes to allocate. |
| ghost_error ghost_cu_memcpy | ( | void * | dest, |
| void * | src, | ||
| size_t | bytesize | ||
| ) |
Memcpy GPU memory.
| dest | The destination memory location. |
| src | The source memory location. |
| bytesize | The number of bytes. |
| 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.
| dest | The device memory. |
| dpitch | The pitch in the device memory. |
| src | The host memory. |
| spitch | The pitch in the host memory. |
| width | The number of bytes per row. |
| height | The number of rows. |
| ghost_error ghost_cu_memset | ( | void * | s, |
| int | c, | ||
| size_t | n | ||
| ) |
Memset GPU memory.
| s | The memory location. |
| c | What to write to the memory. |
| n | The number of bytes. |
| ghost_error ghost_cu_memtranspose | ( | int | m, |
| int | n, | ||
| void * | to, | ||
| int | ldto, | ||
| const void * | from, | ||
| int | ldfrom, | ||
| ghost_datatype | dt | ||
| ) |
| ghost_error ghost_cu_ndevice | ( | int * | devcount | ) |
Get the number of available GPUs.
| devcount | Where to store the number. |
| ghost_error ghost_cu_rand_generator_get | ( | ghost_cu_rand_generator * | gen | ) |

| ghost_error ghost_cu_upload | ( | void * | devmem, |
| void * | hostmem, | ||
| size_t | bytesize | ||
| ) |
Upload memory from the the host to the GPU.
| devmem | The device side memory location. |
| hostmem | The host side memory location. |
| bytesize | Number of bytes. |
| 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.
| dest | The device memory. |
| dpitch | The pitch in the device memory. |
| src | The host memory. |
| spitch | The pitch in the host memory. |
| width | The number of bytes per row. |
| height | The number of rows. |
| ghost_error ghost_cu_version | ( | int * | ver | ) |
Get the CUDA version.
| ver | Where to store the version. |

|
static |
1.8.6