12 #ifndef _CUDA_UTILITIES_CUDA_INTERFACE_H_
13 #define _CUDA_UTILITIES_CUDA_INTERFACE_H_
20 #include <cuda_runtime_api.h>
22 #include "../_definitions/types.h"
35 template<
typename ArrayType>
45 ArrayType*& device_array,
51 const size_t num_bytes);
55 const ArrayType* host_array,
57 ArrayType* device_array);
60 static void del(
void* device_array);
An interface to CUDA linrary to facilitate working with CUDA, such as memory allocation,...
static int get_device()
Gets the current device in multi-gpu applications.
static void del(void *device_array)
Deletes memory on gpu device if its pointer is not NULL, then sets the pointer to NULL.
static void alloc_bytes(void *&device_array, const size_t num_bytes)
Allocates memory on gpu device. This function uses an existing given pointer.
static ArrayType * alloc(const LongIndexType array_size)
Allocates memory on gpu device. This function creates a pointer and returns it.
static void copy_to_device(const ArrayType *host_array, const LongIndexType array_size, ArrayType *device_array)
Copies memory on host to device memory.
static void set_device(int device_id)
Sets the current device in multi-gpu applications.