2016-08-17 2 views
1

Ich bin neu bei TensorFlow und habe CUDA-7.5 und cudnn-v4 gemäß den Anweisungen auf der TensorFlow-Website installiert. die TensorFlow Konfigurationsdatei Nach dem Einstellen und versuchen Sie das folgende Beispiel von der Website zu starten:TensorFlow Wählen Sie eine GPU für mehrere GPUs

python -m tensorflow.models.image.mnist.convolutional 

Ich bin mir ziemlich sicher, dass TensorFlow eine der GPUs verwendet anstelle der anderen, aber ich würde es gerne verwenden der schnellere. Ich habe mich gefragt, ob dieser Beispielcode standardmäßig die erste GPU verwendet, die er findet. Wenn ja, wie kann ich wählen, welche GPU in meinem TensorFlow-Code in Python verwendet werden soll?

Die Nachrichten, die ich erhalten, wenn Sie den Beispielcode ausgeführt wird, sind:

ldt-tesla:~$ python -m tensorflow.models.image.mnist.convolutional 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally 
Extracting data/train-images-idx3-ubyte.gz 
Extracting data/train-labels-idx1-ubyte.gz 
Extracting data/t10k-images-idx3-ubyte.gz 
Extracting data/t10k-labels-idx1-ubyte.gz 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties: 
name: Tesla K20c 
major: 3 minor: 5 memoryClockRate (GHz) 0.7055 
pciBusID 0000:03:00.0 
Total memory: 4.63GiB 
Free memory: 4.57GiB 
W tensorflow/stream_executor/cuda/cuda_driver.cc:572] creating context when one is currently active; existing: 0x2f27390 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 1 with properties: 
name: Quadro K2200 
major: 5 minor: 0 memoryClockRate (GHz) 1.124 
pciBusID 0000:02:00.0 
Total memory: 3.95GiB 
Free memory: 3.62GiB 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:59] cannot enable peer access from device ordinal 0 to device ordinal 1 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:59] cannot enable peer access from device ordinal 1 to device ordinal 0 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0 1 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0: Y N 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 1: N Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:806] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K20c, pci bus id: 0000:03:00.0) 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:793] Ignoring gpu device (device: 1, name: Quadro K2200, pci bus id: 0000:02:00.0) with Cuda multiprocessor count: 5. The minimum required count is 8. You can adjust this requirement with the env var TF_MIN_GPU_MULTIPROCESSOR_COUNT. 
Initialized! 

Antwort

6

Sie die CUDA_VISIBLE_DEVICES Umgebungsvariable können nur diejenigen entlarven, die Sie wollen, unter Angabe dieses Beispiel auf masking gpus:

CUDA_VISIBLE_DEVICES=1 Only device 1 will be seen 
CUDA_VISIBLE_DEVICES=0,1 Devices 0 and 1 will be visible 
CUDA_VISIBLE_DEVICES=”0,1” Same as above, quotation marks are optional 
CUDA_VISIBLE_DEVICES=0,2,3 Devices 0, 2, 3 will be visible; device 1 is masked 
+0

Vielen Dank! Das scheint den Job zu erledigen und diesen Fehler zu beseitigen :). Ich bekomme auch eine Nachricht, die sagt "Ignorieren GPU-Gerät mit Cuda Multiprozessor Anzahl 5. Die erforderliche Mindestanzahl ist 8. Sie können diese Anforderung mit dem ... anpassen". Wenn Sie dasselbe tun, was Sie vorschlagen, kann ich die Umgebungsvariable verwenden, um die Anzahl zu ändern, aber ich bin mir nicht sicher, was das bedeutet. Was bedeutet die Anzahl/Mindestanzahl? Vielen Dank! –

+0

andere Optionen - https://stackoverflow.com/questions/40069883/how-to-set-specific-gpu-in-tensorflow/44848050#44848050 – Nandeesh

Verwandte Themen