cudaMemcpy doesn't work with a large pointers (Jetson Xavier NX)

Hi,

I met a problem when I copy CUDA memory to physical memory using ‘cudaMemcpy()’.
For instance,
There is float* result;
And the size of it is about 20000.
So if float size is 4bytes, then copied memory size will be 80,000 bytes, right? I don’t think it is big.
However, after I copied memory, the copied values are 0 or some big strange value. But no error message.

If the size of the pointer is about 1000, then there is no problem occurs.

So, I would like to set if the size of copying memory is out of possible memory on the system, errors are shown.
Besides, I would like to know current free memory space at both CUDA and physical memory.

Hi @jsm890803.3
is your question related to CUDA-GDB? Note that this forum branch is dedicated to CUDA-GDB support. For general CUDA programming questions please try other branches, e.g.: CUDA Programming and Performance - NVIDIA Developer Forums

Ok I changed. Thank you.

yes

then you should debug your code. I would start with using proper CUDA error checking (just google that, take first hit, apply to your code), and use compute-sanitizer.

cudaMemGetInfo can tell you the cuda situation, programmatically. There are many linux tools that can tell you free space for host code usage.

@Robert_Crovella I just searched ‘CUDA error handling’ as you said and found some solutions.
I appreciate.