tensorflow gpu无法创建会话
我正在使用nVIDIA 950M图形设备开发Ubuntu18.04,尝试安装tensorflow gpu、cuda和cudnn,并一起工作 我首先尝试安装nVIDIA驱动程序、CUDA9.0、CUDNN7.1和tensorflow gpu 1.8。按照以下步骤完成安装步骤,但测试运行失败,如下所示:tensorflow gpu无法创建会话,tensorflow,cudnn,Tensorflow,Cudnn,我正在使用nVIDIA 950M图形设备开发Ubuntu18.04,尝试安装tensorflow gpu、cuda和cudnn,并一起工作 我首先尝试安装nVIDIA驱动程序、CUDA9.0、CUDNN7.1和tensorflow gpu 1.8。按照以下步骤完成安装步骤,但测试运行失败,如下所示: import tensorflow as tf /usr/local/lib/python2.7/dist packages/h5py/init.py:36:FutureWarning:将issu
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
。
from.\u conv导入寄存器\u转换器作为\u寄存器\u转换器
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.
同时检查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
/deviceQuery
/deviceQuery正在启动。。。
CUDA设备查询(运行时API)版本(CUDART静态链接)
检测到1个支持CUDA的设备
装置0:“GeForce GTX 950M”
CUDA驱动程序版本/运行时版本9.1/9.0
CUDA能力主要/次要版本号:5.0
全局内存总量:4046 MB(4242604032字节)
(5)多处理器,(128)CUDA核/MP:640个CUDA核
GPU最大时钟频率:928 MHz(0.93 GHz)
内存时钟频率:2505MHz
内存总线宽度:128位
二级缓存大小:2097152字节
最大纹理尺寸大小(x,y,z)1D=(65536),2D=(655366556),3D=(409640964096)
最大分层1D纹理大小,(num)层1D=(16384),2048层
最大分层2D纹理大小,(num)层2D=(16384,16384),2048层
恒定内存总量:65536字节
每个块的共享内存总量:49152字节
每个块可用的寄存器总数:65536
经纱尺寸:32
每个多处理器的最大线程数:2048
每个块的最大线程数:1024
螺纹块的最大尺寸(x、y、z):(1024、1024、64)
栅格尺寸的最大尺寸(x、y、z):(2147483647、65535、65535)
最大内存间距:2147483647字节
纹理对齐:512字节
并发复制和内核执行:是,使用1个复制引擎
内核的运行时间限制:否
集成GPU共享主机内存:否
支持主机页锁定内存映射:是
表面对齐要求:是
设备具有ECC支持:已禁用
设备支持统一寻址(UVA):是
支持协作内核启动:否
支持多设备协作内核启动:否
设备PCI域ID/总线ID/位置ID:0/1/0
计算模式:
deviceQuery,CUDA驱动程序=CUDART,CUDA驱动程序版本=9.1,CUDA运行时
版本=9.0,NumDevs=1
结果=通过
此外,其中一个CUDA样本测试无误。如何解决上述问题?最后但并非最不重要的一点是,当我使用NavigDA使用代码> Prime选择英伟达< /COD>并重新启动到文本模式时,我如何验证NVIDIA卡正在控制而不是集成卡?p>
那么,我还能做些什么来修复我的环境呢 我做
prime选择nvidia
,然后重新启动,做prime选择查询
,它显示“nvidia”。这是否意味着nvidia卡正在使用??但是为什么我要像下面这样使用lspci-vnn | perl-lne“print if/^\d+\:.+(\[\S+\:\S+\])/”查询PCI设备[,它显示intel图形卡处于控制之下???lshw-c display
将显示所有显示卡,设备ID 0将是默认的。我宁愿说我通过使用“sudo”运行命令来解决这个问题
./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