簡體   English   中英

所有CUDA設備均用於顯示:無法在桌面環境中調試我的CUDA代碼

[英]All CUDA devices are used for display: Can not debug my CUDA-code from within desktop environment

從上周開始,我的CUDA開發設置出現了一個大問題。 我有一個集成的GPU(我也將其連接到顯示器上)和一個額外的NVIDIA卡(用於在CUDA內核上運行)。 但是,我不能再調試我的代碼,因為它說:

fatal:  All CUDA devices are used for display and cannot be used while debugging. (error code = CUDBG_ERROR_ALL_DEVICES_WATCHDOGGED(0x18)

似乎我的X服務器正在阻塞我的NVIDIA GPU,因為如果我切換到另一個虛擬控制台(CTRL + ALT + F1),則可以使用cuda-gdb運行我的代碼。 未將顯示器電纜插入NVIDIA卡...

“ lsof / dev / nvidia *”不提供任何輸出。 我正在使用Xubuntu 14.04。

有誰知道如何解決這個問題?

在具有至少SM35的計算能力的設備中,顯然可以通過設置環境變量來解決此問題。

CUDA_DEBUGGER_SOFTWARE_PREEMPTION=1

我們可以在cuda-gdb文檔頁面上看到它: http : //docs.nvidia.com/cuda/cuda-gdb/#axzz4BrMP​​oaoW

這是測試。 我在Maxwell Quadro GPU上運行:

nvidia-smi
Fri Jun 17 10:59:47 2016       
+------------------------------------------------------+                       
| NVIDIA-SMI 352.63     Driver Version: 352.63         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro M4000M       Off  | 0000:01:00.0      On |                  N/A |
| N/A   37C    P8     9W / 100W |    158MiB /  4087MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0      2981    G   /usr/bin/X                                      57MiB |
|    0      9186    G   ...ves-passed-by-fd --v8-snapshot-passed-by-    85MiB |
+-----------------------------------------------------------------------------+

生成並運行應用程序

 nvcc -g -G foo.cu
 cuda-gdb ./a.out 

...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
fatal:  All CUDA devices are used for display and cannot be used while debugging. (error code = CUDBG_ERROR_ALL_DEVICES_WATCHDOGGED(0x18)

現在設置環境變量。

export CUDA_DEBUGGER_SOFTWARE_PREEMPTION=1
cuda-gdb ./a.out
(cuda-gdb) r
...
warning: Cuda API error detected: cudaMemcpy returned (0xb)

warning: Cuda API error detected: cudaFree returned (0x11)

[Thread 0x7fffed3ff700 (LWP 10302) exited]
[Thread 0x7ffff7fc6780 (LWP 10293) exited]

對我來說,它有助於改變區塊

Section "ServerLayout"
  Identifier "layout"
  Screen 0 "intel"
EndSection

從“ nvidia”到“ intel”的標識符。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM