Hi all,
Recently I’m working on some parallel computing project on Jetson TX1, and sometimes cudaDeviceSynchronize() hang.
The problem description is listed below:
- In the kernel, I'm using curand to generate uniformly distributed doubles to implement Monte Carlo.
- Then some calculation is done to see if the choice can pass the check.
- After kernel launch, I call cudaDeviceSynchroinze(), then a cudaMemcpy(). - I know that cudaDeviceSynchronize() is unnecessary here because cudaMemcpy() will do synchronizing first.
- If I remove cudaDeviceSynchronize() before cudaMemcpy(), then sometimes I got "unspecified launch failure"
Some of the configuration:
- The kernel timeout is disabled, and now I can run program on GPU for very long time: more than 200 seconds. (Actually sometimes the problem happens in 0.5 seconds)
- The numbers of threads are set to 5000 or 2300.
Sometimes the program works properly, but sometimes not – it hangs. When hang, I found that the GPU usage dropped from 99% to 0%:
RAM 823/3854MB (lfb 658x4MB) SWAP 0/0MB (cached 0MB) cpu [65%,12%,11%,6%]@1734 EMC 13%@1600 AVP 0%@408 VDE 0 GR3D 99%@998 EDP limit 1734
RAM 825/3854MB (lfb 657x4MB) SWAP 0/0MB (cached 0MB) cpu [53%,8%,5%,100%]@1734 EMC 7%@1600 AVP 0%@408 VDE 0 GR3D 99%@998 EDP limit 1734
RAM 830/3854MB (lfb 656x4MB) SWAP 0/0MB (cached 0MB) cpu [48%,10%,5%,100%]@1734 EMC 2%@1600 AVP 0%@408 VDE 0 GR3D 99%@998 EDP limit 1734
RAM 830/3854MB (lfb 656x4MB) SWAP 0/0MB (cached 0MB) cpu [44%,38%,33%,52%]@1734 EMC 1%@1600 AVP 0%@80 VDE 0 GR3D 0%@998 EDP limit 1734
RAM 830/3854MB (lfb 656x4MB) SWAP 0/0MB (cached 0MB) cpu [32%,28%,99%,6%]@1734 EMC 0%@1600 AVP 0%@80 VDE 0 GR3D 0%@998 EDP limit 1734
RAM 830/3854MB (lfb 656x4MB) SWAP 0/0MB (cached 0MB) cpu [58%,4%,100%,7%]@1734 EMC 0%@1600 AVP 0%@80 VDE 0 GR3D 0%@998 EDP limit 1734
RAM 830/3854MB (lfb 656x4MB) SWAP 0/0MB (cached 0MB) cpu [57%,5%,100%,7%]@1734 EMC 0%@1600 AVP 0%@80 VDE 0 GR3D 0%@998 EDP limit 1734
Then I attached to the process and get the backtrace below:
(gdb) bt
#0 0xf415d0e0 in nanosleep () at …/sysdeps/unix/syscall-template.S:81
#1 0xf417a738 in usleep (useconds=20) at …/sysdeps/unix/sysv/linux/usleep.c:32
#2 0xf3735e84 in ?? () from /usr/lib/arm-linux-gnueabihf/tegra/libcuda.so.1
#3 0xf3672e84 in ?? () from /usr/lib/arm-linux-gnueabihf/tegra/libcuda.so.1
#4 0xf367303c in ?? () from /usr/lib/arm-linux-gnueabihf/tegra/libcuda.so.1
#5 0xf3661288 in ?? () from /usr/lib/arm-linux-gnueabihf/tegra/libcuda.so.1
#6 0xf36317fc in cuCtxSynchronize () from /usr/lib/arm-linux-gnueabihf/tegra/libcuda.so.1
#7 0xf7271844 in ?? () from /usr/local/cuda-7.0/lib/libcudart.so.7.0
#8 0xf7293b44 in cudaDeviceSynchronize () from /usr/local/cuda-7.0/lib/libcudart.so.7.