Skip to content

OrangeOwlSolutions/CUDA-Utilities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUDA Utilities

Utilities for CUDA programming

Wrap all the CUDA API calls within gpuErrchk. For example:

gpuErrchk(cudaMemcpy(d_x, x, N * sizeof(float), cudaMemcpyHostToDevice));

Use gpuErrchk to check for errors in your kernels. For example:

#ifdef DEBUG
		gpuErrchk(cudaPeekAtLastError());
		gpuErrchk(cudaDeviceSynchronize());
#endif

If DEBUG is defined, then the CUDA error check of the kernels will be executed.

Use iDivUp to find the number of blocks to be launched by a CUDA kernel. For example:

BLOCKSIZE = 256;
N = 10000;       // Number of elements to be processed
kernel<<<iDivUp(N, BLOCKSIZE), BLOCKSIZE>>>(...);

About

Utilities for CUDA programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published