특정 GPU에 cuda 할당

특정 GPU에 cuda 할당

NVIDIA 780Ti 카드 2개가 설치되었습니다. Ubuntu 14.04에서 cuda 7.5를 사용합니다. 설치 후 체크리스트에는 cuda가 올바르게 설치되었고 제대로 작동하는지 표시됩니다. 내 모니터는 장치 0에 연결되어 있습니다. cuda 샘플을 컴파일하고 nvidia-smi를 실행했습니다. IT 출력에는 예상대로 두 개의 NVIDIA 카드가 표시됩니다.

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                                         |
+-----------------------------------------------------------------------------+

그러나 deviceQuery에는 카드 1개만 표시됩니다.

./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

환경 변수를 사용하여 cuda를 다른 비디오 카드로 연결하려고 했습니다.

CUDA_VISIBLE_DEVICES=1

라인을 추가했어요

 export CUDA_VISIBLE_DEVICES=1 

.bashrc로 이동하여 새 터미널 창을 열었습니다. Printenv는 나에게 CUDA_VISIBLE_DEVICES=1을 보여주었습니다.

대역폭 테스트를 실행했습니다. 출력은 다음과 같습니다.

[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

재부팅하고 BandwidthTest를 다시 실행했지만 여전히 다음과 같은 출력이 시작됩니다.

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

     Device 0: GeForce GTX 780 Ti
     Quick Mode 

BandwidthTest는 여전히 장치 0을 사용하고 있습니다. 장치 1을 사용하고 싶습니다. 왜 deviceQuery에 하나의 카드만 표시됩니까? 내가 무엇을 놓치고 있나요?

답변1

이것은 deviceQuery에 문제가 있는 것 같습니다.

내가 시작할 때

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

그런 다음 cuda 컴파일된 샘플 앱인 파티클을 시작합니다.

로그에는 흥미로운 내용이 나와 있습니다. 입자가 시작되기 전 '휴지'에서 GPU0은 성능 상태 2이고 GPU1은 성능 상태 8입니다. 입자가 시작된 후에는 두 성능 상태가 모두 0입니다.

입자를 종료한 후 성능 상태는 기준선으로 돌아갑니다. GPU0이 내 디스플레이를 조정하고 있으므로 이것이 결코 상태 8로 전환되지 않는 이유라고 생각합니다.

이것성능 상태를 설명합니다.

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

관련 정보