2017-03-06 118 views
0

tensorflow看不到我的GPU。我正在使用一個優化設置。tensorflow不使用GPU,但CUDA做

NVIDIA-SMI顯示我的卡

[[email protected] bal]$ optirun nvidia-smi 
Mon Mar 6 13:24:05 2017  
+-----------------------------------------------------------------------------+ 
| NVIDIA-SMI 378.13     Driver Version: 378.13     | 
|-------------------------------+----------------------+----------------------+ 
| 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 K1100M  Off | 0000:01:00.0  Off |     N/A | 
| N/A 40C P0 N/A/N/A |  7MiB/1999MiB |  2%  Default | 
+-------------------------------+----------------------+----------------------+ 

+-----------------------------------------------------------------------------+ 
| Processes:              GPU Memory | 
| GPU  PID Type Process name        Usage  | 
|=============================================================================| 
| 0  1847 G /usr/lib/xorg-server/Xorg      7MiB | 
+-----------------------------------------------------------------------------+ 

CUDA看到了GPU。這裏是DEVICEQUERY輸出

[[email protected] release]$ optirun ./deviceQuery 
./deviceQuery Starting... 

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

Detected 1 CUDA Capable device(s) 

Device 0: "Quadro K1100M" 
    CUDA Driver Version/Runtime Version   8.0/8.0 
    CUDA Capability Major/Minor version number: 3.0 
    Total amount of global memory:     1999 MBytes (2096300032 bytes) 
    (2) Multiprocessors, (192) CUDA Cores/MP:  384 CUDA Cores 
    GPU Max Clock rate:       706 MHz (0.71 GHz) 
    Memory Clock rate:        1400 Mhz 
    Memory Bus Width:        128-bit 
    L2 Cache Size:         262144 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:      Yes 
    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/1/0 
    Compute Mode: 
    < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > 

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = Quadro K1100M 
Result = PASS 

但tensorflow不使用GPU

import tensorflow as tf 

# Creates a graph. 
#with tf.device('/gpu:0'): 
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') 
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2],  name='b') 
c = tf.matmul(a, b) 
# Creates a session with log_device_placement set to True. 
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) 
# Runs the op. 
print(sess.run(c)) 

輸出似乎表明,只有CPU使用

[[email protected] bal]$ optirun python ex.py 
Device mapping: 
/job:localhost/replica:0/task:0/device:XLA_GPU:0 -> device: XLA_GPU device 
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device 
MatMul: (MatMul): /job:localhost/replica:0/task:0/cpu:0 
b: (Const): /job:localhost/replica:0/task:0/cpu:0 
a: (Const): /job:localhost/replica:0/task:0/cpu:0 
[[ 22. 28.] 
[ 49. 64.]] 

所以,我能做些什麼,tensorflow看到我的GPU?我正在使用archlinux,我認爲我已經從最新版本的所有東西中獲得了。有沒有事情,我可以檢查?

+0

它總是一樣的。 [user @ system bal] $ TF_CPP_MIN_LOG_LEVEL = 0 python ex.py ... I tensorflow/core/common_runtime/gpu/gpu_device.cc:948]忽略可見的gpu設備(設備:0,名稱:Quadro K1100M,pci總線ID:0000:01:00.0),具有Cuda計算能力3.0。最低要求的Cuda能力是3.5。 很好。 – Carsten

+0

你可以自己編譯使用3.0。 – etarion

+0

我目前正在嘗試,但tensorflw構建需要45分鐘在我的系統上。我希望我給了它正確的構建參數 – Carsten

回答