Debugging with cuda-gdb and segmentation fault on cudaMalloc

Hi all,

I’m trying to a debug my code using cuda-gdb. When I compile the cuda file using:

nvcc -gencode=arch=compute_20,code=\"sm_20,compute_20\" test.cu      

OR     

nvcc -arch=sm_20 test.cu

I can execute the program with no segmentation fault. However, when I compile using the following command for debugging:

nvcc -g -G -gencode=arch=compute_20,code=\"sm_20,compute_20\" test.cu      

OR 

nvcc -g -G -arch=sm_20 test.cu

I get a segmentation fault at line 2 in the following example while debugging:

1 myType* dev_myTypes;

2 cudaMalloc((void**) &dev_myTypes, SIZE * sizeof(myType));

3 cudaMemcpy ( dev_myTypes, myTypes, SIZE * sizeof(myType),

4                                cudaMemcpyHostToDevice);

I’m using CUDA 3.2 on a 480 card on Linux.

Am I missing something? Any thoughts on this?

Thanks much.