cuda-gdb crashes with thrust (CUDA release 5.5) -
i have following trivial thrust::gather program (taken directly thrust::gather documentation)
#include <thrust/gather.h> #include <thrust/device_vector.h> int main(void) { // mark indices 1; odd indices 0 int values[10] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0}; thrust::device_vector<int> d_values(values, values + 10); // gather indices first half of range // , odd indices last half of range int map[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}; thrust::device_vector<int> d_map(map, map + 10); thrust::device_vector<int> d_output(10); thrust::gather(d_map.begin(), d_map.end(), d_values.begin(), d_output.begin()); // d_output {1, 1, 1, 1, 1, 0, 0, 0, 0, 0} return 0; }
i compile
/usr/local/cuda/bin/nvcc -ccbin g++ -i../../common/inc -m64 -g -g -gencode arch=compute_30,code=sm_30 -o thrustgather.o -c thrustgather.cu /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -g -g -o thrustgather thrustgather.o
next try running simple program after first attaching cuda-gdb:
>cuda-gdb ./thrustgather nvidia (r) cuda debugger 5.5 release portions copyright (c) 2007-2013 nvidia corporation gnu gdb (gdb) 7.2 copyright (c) 2010 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law. type "show copying" , "show warranty" details. gdb configured "x86_64-unknown-linux-gnu". bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... reading symbols /usr/local/cuda-5.5/samples/0_simple/thrustgatherrjm/thrustgather...done. (cuda-gdb) run starting program: /usr/local/cuda-5.5/samples/0_simple/thrustgatherrjm/thrustgather [thread debugging using libthread_db enabled] [new thread 0x7ffff7272700 (lwp 50318)] [context create of context 0x78d790 on device 0] [launch of cuda kernel 0 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [launch of cuda kernel 1 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [launch of cuda kernel 2 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [launch of cuda kernel 3 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [launch of cuda kernel 4 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [launch of cuda kernel 5 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [launch of cuda kernel 6 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [launch of cuda kernel 7 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] error: received unexpected signal: segmentation fault backtrace (41 frames): cuda-gdb[0x4394e1] /lib64/libc.so.6[0x3d96635a90] cuda-gdb[0x5b038b] cuda-gdb[0x55aae8] cuda-gdb[0x55ed65] cuda-gdb[0x55fc51] cuda-gdb[0x55ec22] cuda-gdb[0x5609fe] cuda-gdb[0x5607bd] cuda-gdb[0x560c36] cuda-gdb[0x4f7e44] cuda-gdb[0x4f8038] cuda-gdb[0x4fde3c] cuda-gdb[0x5c9f66] cuda-gdb[0x429c3c] cuda-gdb[0x5ca4e5] cuda-gdb[0x5cab5e] cuda-gdb[0x4296e6] cuda-gdb[0x479366] cuda-gdb[0x53addd] cuda-gdb[0x5129c0] cuda-gdb[0x5134fd] cuda-gdb[0x51369d] cuda-gdb[0x5091e7] cuda-gdb[0x40f65d] cuda-gdb[0x522f54] cuda-gdb[0x523a20] cuda-gdb[0x5ff9aa] cuda-gdb[0x522fb9] cuda-gdb[0x521b81] cuda-gdb[0x522b1e] cuda-gdb[0x51d0cb] cuda-gdb[0x4ae816] cuda-gdb[0x406429] cuda-gdb[0x51d0cb] cuda-gdb[0x406b76] cuda-gdb[0x51d0cb] cuda-gdb[0x406204] cuda-gdb[0x4061d6] /lib64/libc.so.6(__libc_start_main+0xf5)[0x3d96621b75] cuda-gdb[0x4060e9] [termination of cuda kernel 7 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [termination of cuda kernel 6 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [termination of cuda kernel 5 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [termination of cuda kernel 4 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [termination of cuda kernel 3 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [termination of cuda kernel 2 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [termination of cuda kernel 1 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0] [termination of cuda kernel 0 (memset32_aligned1d<<<(1,1,1),(128,1,1)>>>) on device 0]
note cuda-gdb, itself, segfaults. ran correpsonding expamples for
- thrust::gather_if
- thrust::scatter
- thrust::count
- thrust::inclusive_scan
- thrust::sort_by_key
- thrust::reduce_by_key
and of these, last 3 (inclusive_scan, sort_by_key, reduce_by_key), work (i.e., not crash cuda-gdb).
this must issue latest release (5.5) of thrust and/or cuda-gdb, because have run same tests release 5.0 no issues whatsoever.
here info setup:
> cat /proc/driver/nvidia/version nvrm version: nvidia unix x86_64 kernel module 319.21 sat may 11 23:51:00 pdt 2013 gcc version: gcc version 4.8.1 20130603 (red hat 4.8.1-1) (gcc) > cat /proc/version linux version 3.9.9-302.fc19.x86_64 (mockbuild@bkernel01.phx2.fedoraproject.org) (gcc version 4.8.1 20130603 (red hat 4.8.1-1) (gcc) ) #1 smp sat jul 6 13:41:07 utc 2013 > gcc --version gcc (gcc) 4.8.1 20130603 (red hat 4.8.1-1) copyright (c) 2013 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose. > lspci | grep nvidia 05:00.0 3d controller: nvidia corporation gk104 [geforce gtx 690] (rev a1) 05:00.1 audio device: nvidia corporation gk104 hdmi audio controller (rev a1) 06:00.0 vga compatible controller: nvidia corporation gk104 [geforce gtx 690] (rev a1) 06:00.1 audio device: nvidia corporation gk104 hdmi audio controller (rev a1)
as talonmies indicated, problem thrust libraries not run correctly when built debugging. in application have rather complicated .cu file containing several of own cuda kernels, along multiple thrust calls. if compile file -g -g debug flags , run inside cuda-gdb, crash -- making impossible me debug kernels.
since not care debugging thrust calls (only kernels), solution involved putting thrust calls in file thrustwrappers.cu , compiling file without debugging. in main .cu file replace calls thrust associated wrapper functions (defined in thrustwrappers). example,
thrust::reduce(...)
became
thrust::reduce_wrapper(...)
then link 2 resulting object files together.
Comments
Post a Comment