I'm trying to launch a kernel using the CUDA driver API. Specifically I'm calling
CUresult CUDAAPI cuLaunchKernel(
CUfunction f,
unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ,
unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ,
unsigned int sharedMemBytes,
CUstream hStream,
void **kernelParams,
void **extra);
I'm only using kernelParams
, and passing nullptr
for extra
. Now, for one of my kernels, I get CUDA_ERROR_INVALID_VALUE
.
The documentation says:
The error
CUDA_ERROR_INVALID_VALUE
will be returned if kernel parameters are specified with bothkernelParams
andextra
(i.e. bothkernelParams
andextra
are non-NULL
).
well, I'm not doing that, and am still getting CUDA_ERROR_INVALID_VALUE
. To be extra-safe, I synch'ed the stream right before launching the kernel - but to no avail.
What are the other reasons for getting CUDA_ERROR_INVALID_VALUE
when trying to launch?
Apparently, you can get a CUDA_ERROR_INVALID_VALUE
error in multiple cases involving issues with your kernelParams
and/or extras
arguments:
kernelParams
and extras
are null, but the kernel takes parameters.kernelParams
and extras
are non-null (this is what's officially documented)kernelParams
before the terminating nullptr
value doesn't match the number of kernel parameters.and this is not an exhaustive list. Probably misusing extras
can cause this too.