cudaMemcpy max size?

Hello community!

First time scratching with CUDA…

Does anybody know if there’s a limit on count bytes that can be transfered from host to device? I get an ‘unknown error’ (program exits, kernel won’t execute, I only receive a message: “CUDA: Unknown error on line 219”) on line 2 of the following code:

CUDA_SAFE_CALL(cudaMalloc((void**)&d_ret, byte_rsize)); 

CUDA_SAFE_CALL(cudaMemcpy(d_ret, ret, byte_rsize, cudaMemcpyHostToDevice));

I’m running CUDA 1.1 on EmuDebug. byte_rsize is 8.000.000. Allocation seems to work fine. If I reduce byte_rsize to 7.000.000, program works fine. Is there a limit or something?

thanks in advance!

In EmuDebug Unknown error will be displayed when input pointer to

cudaMemcpy is invalid. May be that is the problem in your case.

Just check whether memory is allocated correctly for ret variable.

Device memory copy wil be restricted to what amount of memory your GPU has. (Also you can’t use the entire device memory. E.g: if you have 320 MB in the card, the whole 320 MB will not be available since some part of the memory will be used for display)

Thanks for your answer mate!

I figured out the problem today.
The problem was with the value of byte_rsize. I was calculating it by myself. The structure was quite complicated, so I just used the sizeof() function.

Quite novice mistake!