NVIDIA Index example code nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cuda Namespace Reference

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 &copy_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...
 

Detailed Description

CUDA kernel for volume editing.

Function Documentation

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.

Parameters
[out]ipc_handleThe CUDA IPC handle of the destination brick
[out]d_voxelsDevice pointer of the destination brick
[in]h_voxelsHost pointer of the source brick.
[in]nb_voxelsThe total number of voxels for the brick.
[in]device_idThe 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.

Parameters
[in]ipc_handleThe CUDA IPC handle of the source brick
[in]device_idThe 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.

Parameters
[out]h_voxelsHost pointer of the destination brick.
[in]nb_voxelsThe total number of voxels for the brick.
[in]ipc_handleThe CUDA IPC handle of the source brick
[in]device_idThe 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.

Parameters
[out]dst_brickThe destination IndeX's volume brick pointer
[in]dst_brick_sizeThe size (sx,sy,sz) of the destination brick
[in]src_brick_ipc_handleThe CUDA IPC handle of the source brick
[in]d_src_brickThe device memory pointer of the source brick Used when CUDA IPC handle is not available
[in]src_brick_sizeThe size (sx,sy,sz) of the source brick
[in]src_mem_offsetMemory offset for the source brick pointer
[in]device_idThe 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.

Parameters
[in]d_voxelsDevice pointer of the source brick
[in]brick_sizeThe brick size (sx, sy, sz)
[in]device_idThe device id of the GPU that owns the brick