SEG FAULT with cuda-gdb on a running well program Program goes well without cuda-gdb but crashes wit

Hi all,

I was having trouble figuring out why the result of my program went wrong so I decided to use cuda-gdb to make that clear. By doing so I have to admitt I was a bit surprised since I received a seg fault. This one seemed to appear when I first try to create a stream with cudaStreamCreate (which appears to be on the very beginning of the program):


int loop;
int m_NbStreams = 1;
//Allocation pour la structure de stream
m_ptrDescStreams = new T_GMAR_GPUStream[m_NbStreams];
if ( m_ptrDescStreams == NULL )
    return C_MAR_ALLOC_MEMORY_KO;

//Creation des streams CUDA
for (loop = 0; loop < m_NbStreams; loop++){
    m_ptrDescStreams[loop].streamState = C_GMAR_STREAM_FREE;
    CodeRetourCUDA = cudaStreamCreate(&(m_ptrDescStreams[loop].stream));
}


[gpubti@GPGPU GPU_TEST_PERF_EXECUTION_CONV_SEPARABLE]$ cuda-gdb MARIO.exe
NVIDIA ® CUDA Debugger
3.1 beta release
Portions Copyright © 2008,2009,2010 NVIDIA Corporation
GNU gdb 6.6
Copyright © 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “x86_64-unknown-linux-gnu”…
Using host libthread_db library “/lib64/libthread_db.so.1”.
(cuda-gdb) break GPUC__SuperMario::CreateStreams
Breakpoint 1 at 0x5dcf65: file GPUC__SuperMario.cpp, line 1015.
(cuda-gdb) run debug /input/E_CM_CONV22.cmd

Breakpoint 1, GPUC__SuperMario::CreateStreams (this=0x21798c0) at GPUC__SuperMario.cpp:1015
1015 cerr << endl << “Entree dans la fonction GPUC__SuperMario::CreateStreams” << endl;
(cuda-gdb) n

Entree dans la fonction GPUC__SuperMario::CreateStreams
1029 m_ptrDescStreams = new T_GMAR_GPUStream[m_NbStreams];
(cuda-gdb) n
1030 if ( m_ptrDescStreams == NULL )
(cuda-gdb) n
1035 for (loop = 0; loop < m_NbStreams; loop++){
(cuda-gdb) n
1036 m_ptrDescStreams[loop].streamState = C_GMAR_STREAM_FREE;
(cuda-gdb) n
1037 CodeRetourCUDA = cudaStreamCreate(&(m_ptrDescStreams[loop].stream));
(cuda-gdb) n
Segmentation fault
[gpubti@GPGPU GPU_TEST_PERF_EXECUTION_CONV_SEPARABLE]$

I’ve tried to printf() just after the cudaStreamCreate call and then cuda-gdb was stuck there :
1037 CodeRetourCUDA = cudaStreamCreate(&(m_ptrDescStreams[loop].stream));
(cuda-gdb) n

So far I really don’t get why a Seg fault is caused by this pretty simple instruction. If you have any idea or clue that could help me make the cuda-gdb run correctly please don’t hesitate 'cause I am kind of lost by now…

Thanks,

( Config :
cuda 3.1
fermi
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48) )

You are using very old version of 3.1 beta toolkit. Can you please upgrade to 3.2 production release from http://developer.nvidia.com/object/cuda_3_2_downloads.html#Linux and see if you have issues.

Thanks for your answer,

For now I can’t upgrade to 3.2 since it is a commercial release and the least I can say is that I don’t have all cards on my hand, but as soon as I can I’ll let you know if it fixes the problem. Anyway, I manage to find out the bug on my program so I don’t need cuda-gdb anymore, but no doubt that when I’ll need it I’ll firstly update my version.

Thanks again,