54 return (
int) cuda_error;
64 enum cudaMemcpyKind kind;
67 struct kind_mapping
mapping[] = {
73 for (i = 0; i <
sizeof(
mapping)/
sizeof(
struct kind_mapping); ++i) {
74 if (our_kind ==
mapping[i].our_kind) {
108 size_t count,
int kind)
133 cudaSetDevice(index));
139 int device_count = 0;
140 if (cudaGetDeviceCount(&device_count) !=
cudaSuccess) {
144 if (device_count == 0) {
145 fprintf(stderr,
"There is no device supporting CUDA.\n");
147 printf(
"There %s %d devices supporting CUDA:\n", device_count == 1 ?
"is" :
"are", device_count);
150 for (
int device_id = 0; device_id < device_count; device_id++ ) {
151 struct cudaDeviceProp device_properties;
152 if (cudaGetDeviceProperties(&device_properties, device_id) !=
cudaSuccess) {
157 printf(
"\nDevice #%d: \"%s\"\n", device_id, device_properties.name);
158 printf(
" Compute capability: %d.%d\n", device_properties.major, device_properties.minor);
159 printf(
" Total amount of global memory: %zu kB\n", device_properties.totalGlobalMem / 1024);
160 printf(
" Total amount of constant memory: %zu kB\n", device_properties.totalGlobalMem / 1024);
161 printf(
" Total amount of shared memory per block: %zu kB\n", device_properties.sharedMemPerBlock / 1024);
162 printf(
" Total number of registers available per block: %d\n", device_properties.regsPerBlock);
163 printf(
" Multiprocessors: %d\n", device_properties.multiProcessorCount);
172 fprintf(stderr,
"cudaDeviceReset failed!\n");
const char unsigned int flags
static const struct codec_param mapping[AC_COUNT]
#define cudaMemcpyHostToDevice
#define cudaGetErrorString
const char * cuda_wrapper_get_error_string(int error)
int cuda_wrapper_set_device(int index)
int cuda_wrapper_malloc_host(void **buffer, size_t data_len)
int cuda_wrapper_free_host(void *buffer)
int cuda_wrapper_host_alloc(void **pHost, size_t size, unsigned int flags)
void * cuda_wrapper_stream_t
int cuda_wrapper_free(void *buffer)
static const char * map_error_string(int error)
const char * cuda_wrapper_last_error_string(void)
int cuda_wrapper_memcpy(void *dst, const void *src, size_t count, int kind)
void cuda_wrapper_print_devices_info(void)
adapted from gpujpeg_print_devices_info()
int cuda_wrapper_get_last_error(void)
static enum cudaMemcpyKind map_cuda_memcpy_kind(int our_kind)
static int map_cuda_error(cudaError_t cuda_error)
void cuda_wrapper_device_reset(void)
int cuda_wrapper_malloc(void **buffer, size_t data_len)
This file contais wrapper around CUDA functions.
#define CUDA_WRAPPER_MEMCPY_HOST_TO_DEVICE
#define CUDA_WRAPPER_MEMCPY_DEVICE_TO_HOST