Reputation: 30735
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?
Upvotes: 2
Views: 3371
Reputation: 212929
You need to check whether size_t
is the same size as int
on your system. If size_t
is 8 bytes and int
is only 4 bytes then the call will fail - you can't just copy an 8 byte variable to a 4 byte CUDA device constant.
Upvotes: 3