This is a follow up Q from cudaMemcpyToSymbol vs cudaMemcpy
I'm under the impression the -G flag is for making cudaGDB builds. I'm seeing it clear errors as well. (The error in the code below is intentional. The Q is about why the return error didn't show it.)
__constant__ float flt[480]; // 1920 bytes
__constant__ int ints[160]; // 640 bytes
Main() {
float* pFlts;
cudaMalloc((void**)&pFlts, 1920+640);
cudaError_t eerr=cudaMemcpyToSymbol(ints,pFlts,sizeof(ints),sizeof(ints),cudaMemcpyDeviceToDevice);
printf("ErrVal= %d\n",(int)eerr);
}
When I build w/: nvcc junk.cu -o junk, and run it w/: ./junk, my result is: ErrVal= 11, which is "invalid argument".
When I build w/: nvcc junk.cu -G -o junk, and run it w/: ./junk, my result is: ErrVal= 0, which is cudaSuccess.
I don't have a lot of experience w/ the -G flag, but this seems like odd behavior. Why does -G erase return errors?