我正在使用nVIDIA 950M图形设备在Ubuntu18.04上工作,尝试安装tensorflow-gpu,cuda和cudnn,一起工作 .

我首先尝试安装nVIDIA驱动程序,cuda 9.0,cudnn 7.1和tensorflow-gpu 1.8 . 按照install tensorflow完成安装步骤,但测试运行失败,如下所示:

import tensorflow as tf

/usr/local/lib/python2.7/dist-packages/h5py/ init .py:36:FutureWarning:不推荐将issubdtype的第二个参数从 float 转换为 np.floating . 将来,它将被视为 np.float64 == np.dtype(float).type . 从._conv导入register_converters作为_register_converters

a=tf.constant(10)
b=tf.constant(39)
tf.Session()

但是我收到以下错误:

2018-06-22 22:42:44.102246: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

2018-06-22 22:42:44.373094: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:898] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero

2018-06-22 22:42:44.373508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties: 

name: GeForce GTX 950M major: 5 minor: 0 memoryClockRate(GHz): 0.928
pciBusID: 0000:01:00.0

totalMemory: 3.95GiB freeMemory: 3.91GiB

2018-06-22 22:42:44.373526: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0

2018-06-22 22:42:44.438843: E tensorflow/core/common_runtime/direct_session.cc:154] Internal: CUDA runtime implicit initialization on GPU:0 failed. Status: unknown error

Traceback (most recent call last):

File `<stdin>`, line 1, in <module>

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1560, in __init__

super(Session, self).__init__(target, graph, config=config)

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 633, in __init__

self._session = tf_session.TF_NewSession(self._graph._c_graph, opts)
tensorflow.python.framework.errors_impl.InternalError: Failed to create session.

然后我尝试导出CUDA_VISIBLE_DEVICES ='0',但没有运气 .

然后我用 nvidia-smi 检查nVIDIA驱动程序

它正确显示驱动程序:NVIDIA-SMI 390.67驱动程序版本:390.67

然后检查 nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver

Copyright (c) 2005-2017 NVIDIA Corporation

Built on Fri_Sep__1_21:08:03_CDT_2017

Cuda compilation tools, release 9.0, V9.0.176

另请查看 deviceQuery

./deviceQuery 

./deviceQuery Starting...

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

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 950M"

CUDA Driver Version / Runtime Version          9.1 / 9.0

CUDA Capability Major/Minor version number:    5.0

Total amount of global memory:                 4046 MBytes (4242604032 bytes)

( 5) Multiprocessors, (128) CUDA Cores/MP:     640 CUDA Cores

GPU Max Clock rate:                            928 MHz (0.93 GHz)

Memory Clock rate:                             2505 Mhz

Memory Bus Width:                              128-bit

L2 Cache Size:                                 2097152 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

Supports Cooperative Kernel Launch:            No

Supports MultiDevice Co-op Kernel Launch:      No

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 = 9.1, CUDA Runtime 

Version = 9.0, NumDevs = 1

Result = PASS

此外,其中一个CUDA样本经过测试,没有错误 . 我该如何解决上述问题?最后但并非最不重要的是,当我使用 prime-select nvidia 启用nVIIDA并重新启动到文本模式时,如何验证nVIDIA卡是否正在控制而不是集成卡?

那么我还能做些什么来修复我的环境呢?