When calling the function cudaMemcpyToSymbol, I get Invalid value error (cudaErrorInvalidValue). The code where the error occurs is something like this.
__constant__ int c_queryLength; //Length of query sequence in chunks of 4
...............
if((cuda_err = cudaMemcpyToSymbol(c_queryLength,&queryLengthInChunks,
sizeof(queryLengthInChunks),0, cudaMemcpyHostToDevice))!=cudaSuccess)
{
// Check which error occured;
...............
}
Here the value of queryLengthInChunks, which is of type size_t, is 36. Why am I getting this error. Any possible reasons for that?
You need to check whether
size_tis the same size asinton your system. Ifsize_tis 8 bytes andintis only 4 bytes then the call will fail – you can’t just copy an 8 byte variable to a 4 byte CUDA device constant.