CUDA kernel for volume editing. More...
Functions | |
void | set_voxel_values (cudaArray *dst_brick, const int dst_brick_size[3], const cudaIpcMemHandle_t &src_brick_ipc_handle, unsigned char *d_src_brick, const int src_brick_size[3], size_t src_mem_offset, int device_id) |
Copy a brick already allocated in device memory (by the application) to the internal IndeX cudaArray representation by using CUDA IPC. More... | |
void | alloc_IPC_brick (cudaIpcMemHandle_t &ipc_handle, unsigned char **d_voxels, const unsigned char *h_voxels, int nb_voxels, int device_id) |
Upload(allocate) a host brick on device memory and return its CUDA IPC handle. More... | |
void | get_IPC_brick (unsigned char *h_voxels, int nb_voxels, cudaIpcMemHandle_t &ipc_handle, int device_id) |
Download a pre allocated brick to host array by using its CUDA IPC handle. More... | |
void | free_IPC_brick (cudaIpcMemHandle_t &ipc_handle, int device_id) |
Free device memory associated to the brick. More... | |
void | update_brick (unsigned char *d_voxels, int brick_size[3], int device_id) |
Sample brick update function. More... | |
cudaError_t | copy_device_to_device (cudaArray *pdst, const void *psrc, size_t fmt_size, uint3 &src_extent, uint3 &src_offset, uint3 &dst_offset, uint3 ©_extend, const cudaStream_t cuda_stream) |
Utility functions. More... | |
void | enum_cuda_devices (char *buff, int buff_len) |
Build a string with all device information for the current host. More... | |
int | get_nb_gpus () |
Get the number of GPU available for the current host. More... | |
CUDA kernel for volume editing.
void cuda::alloc_IPC_brick | ( | cudaIpcMemHandle_t & | ipc_handle, |
unsigned char ** | d_voxels, | ||
const unsigned char * | h_voxels, | ||
int | nb_voxels, | ||
int | device_id | ||
) |
Upload(allocate) a host brick on device memory and return its CUDA IPC handle.
[out] | ipc_handle | The CUDA IPC handle of the destination brick |
[out] | d_voxels | Device pointer of the destination brick |
[in] | h_voxels | Host pointer of the source brick. |
[in] | nb_voxels | The total number of voxels for the brick. |
[in] | device_id | The device id of the GPU that owns the brick |
cudaError_t cuda::copy_device_to_device | ( | cudaArray * | pdst, |
const void * | psrc, | ||
size_t | fmt_size, | ||
uint3 & | src_extent, | ||
uint3 & | src_offset, | ||
uint3 & | dst_offset, | ||
uint3 & | copy_extend, | ||
const cudaStream_t | cuda_stream | ||
) |
Utility functions.
Device to device memory copy from some source to a CudaArray
void cuda::enum_cuda_devices | ( | char * | buff, |
int | buff_len | ||
) |
Build a string with all device information for the current host.
void cuda::free_IPC_brick | ( | cudaIpcMemHandle_t & | ipc_handle, |
int | device_id | ||
) |
Free device memory associated to the brick.
[in] | ipc_handle | The CUDA IPC handle of the source brick |
[in] | device_id | The device id of the GPU that owns the brick |
void cuda::get_IPC_brick | ( | unsigned char * | h_voxels, |
int | nb_voxels, | ||
cudaIpcMemHandle_t & | ipc_handle, | ||
int | device_id | ||
) |
Download a pre allocated brick to host array by using its CUDA IPC handle.
[out] | h_voxels | Host pointer of the destination brick. |
[in] | nb_voxels | The total number of voxels for the brick. |
[in] | ipc_handle | The CUDA IPC handle of the source brick |
[in] | device_id | The device id of the GPU that owns the brick |
int cuda::get_nb_gpus | ( | ) |
Get the number of GPU available for the current host.
void cuda::set_voxel_values | ( | cudaArray * | dst_brick, |
const int | dst_brick_size[3], | ||
const cudaIpcMemHandle_t & | src_brick_ipc_handle, | ||
unsigned char * | d_src_brick, | ||
const int | src_brick_size[3], | ||
size_t | src_mem_offset, | ||
int | device_id | ||
) |
Copy a brick already allocated in device memory (by the application) to the internal IndeX cudaArray representation by using CUDA IPC.
[out] | dst_brick | The destination IndeX's volume brick pointer |
[in] | dst_brick_size | The size (sx,sy,sz) of the destination brick |
[in] | src_brick_ipc_handle | The CUDA IPC handle of the source brick |
[in] | d_src_brick | The device memory pointer of the source brick Used when CUDA IPC handle is not available |
[in] | src_brick_size | The size (sx,sy,sz) of the source brick |
[in] | src_mem_offset | Memory offset for the source brick pointer |
[in] | device_id | The device id of the GPU that owns the brick |
void cuda::update_brick | ( | unsigned char * | d_voxels, |
int | brick_size[3], | ||
int | device_id | ||
) |
Sample brick update function.
It changes the content of a given brick For this example the functions increases all voxels values in 1.
[in] | d_voxels | Device pointer of the source brick |
[in] | brick_size | The brick size (sx, sy, sz) |
[in] | device_id | The device id of the GPU that owns the brick |