Weisen Sie CUDA einer bestimmten GPU zu

Weisen Sie CUDA einer bestimmten GPU zu

Zwei NVIDIA 780Ti-Karten installiert. Verwendung von cuda 7.5 unter Ubuntu 14.04. Die Checkliste nach der Installation zeigt, dass cuda ordnungsgemäß installiert ist und ordnungsgemäß funktioniert. Meine Monitore sind an Gerät 0 angeschlossen. Ich habe die cuda-Beispiele kompiliert und nvidia-smi ausgeführt. Die Ausgabe zeigt wie erwartet zwei NVIDIA-Karten:

Fri Apr  1 01:04:31 2016       
+------------------------------------------------------+                       
| NVIDIA-SMI 352.79     Driver Version: 352.79         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 780 Ti  Off  | 0000:01:00.0     N/A |                  N/A |
| 38%   50C    P2    N/A /  N/A |   1084MiB /  3071MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 780 Ti  Off  | 0000:03:00.0     N/A |                  N/A |
| 29%   34C    P8    N/A /  N/A |     11MiB /  3071MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0                  Not Supported                                         |
|    1                  Not Supported                                         |
+-----------------------------------------------------------------------------+

Allerdings zeigt deviceQuery nur 1 Karte an:

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 780 Ti"
  CUDA Driver Version / Runtime Version          7.5 / 7.5
  CUDA Capability Major/Minor version number:    3.5
  Total amount of global memory:                 3072 MBytes (3221028864 bytes)
  (15) Multiprocessors, (192) CUDA Cores/MP:     2880 CUDA Cores
  GPU Max Clock rate:                            1084 MHz (1.08 GHz)
  Memory Clock rate:                             3500 Mhz
  Memory Bus Width:                              384-bit
  L2 Cache Size:                                 1572864 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
  Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
  Run time limit on kernels:                     No
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 3 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 7.5, CUDA Runtime Version = 7.5, NumDevs = 1, Device0 = GeForce GTX 780 Ti
Result = PASS

Ich habe versucht, cuda mithilfe der Umgebungsvariable auf die andere Grafikkarte umzuleiten

CUDA_VISIBLE_DEVICES=1

Ich habe die Zeile hinzugefügt

 export CUDA_VISIBLE_DEVICES=1 

in .bashrc und öffnete ein neues Terminalfenster. Printenv zeigte mir unter anderem CUDA_VISIBLE_DEVICES=1.

Ich habe bandwidthTest ausgeführt. Die Ausgabe lautet:

[CUDA Bandwidth Test] - Starting...
Running on...

 Device 0: GeForce GTX 780 Ti
 Quick Mode

 Host to Device Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)    Bandwidth(MB/s)
   33554432         11618.3

 Device to Host Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)    Bandwidth(MB/s)
   33554432         12909.9

 Device to Device Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)    Bandwidth(MB/s)
   33554432         265048.1

Result = PASS

Ich habe neugestartet und bandwidthTest erneut ausgeführt, aber die Ausgabe beginnt immer noch mit:

[CUDA Bandwidth Test] - Starting...
    Running on...

     Device 0: GeForce GTX 780 Ti
     Quick Mode 

Der Bandbreitentest verwendet IMMER NOCH Gerät 0. Ich möchte, dass Gerät 1 verwendet wird. Warum hat die Geräteabfrage nur eine Karte erkannt? Was übersehe ich?

Antwort1

es scheint, dass dies ein Problem mit deviceQuery ist.

Wenn ich anfange

nvidia-smi -l 1 --query --display=PERFORMANCE >> gpu_utillization.log

und starten Sie dann eine von CUDA kompilierte Beispiel-App, Partikel

Das Protokoll zeigt etwas Interessantes. Im Ruhezustand, also vor dem Start von Particles, befindet sich GPU0 im Leistungszustand 2 und GPU1 im Leistungszustand 8. Nach dem Start von Particles sind beide Leistungszustände 0.

Nach dem Beenden von Particles kehren die Leistungszustände zum Ausgangszustand zurück. GPU0 optimiert meine Displays, daher nehme ich an, dass es deshalb nie in Zustand 8 geht.

Daserklärt Leistungszustände.

P0/P1 - Maximum 3D performance
P2/P3 - Balanced 3D performance-power
P8 - Basic HD video playback
P10 - DVD playback
P12 - Minimum idle power consumption

verwandte Informationen