Python &引用;cudaGetDevice()失败";尽管遵照指示
我已经经历了所有的过程,最后,我得到了以下错误Python &引用;cudaGetDevice()失败";尽管遵照指示,python,tensorflow,Python,Tensorflow,我已经经历了所有的过程,最后,我得到了以下错误 InternalError:cudaGetDevice()失败。状态:CUDA驱动程序版本不足以支持CUDA运行时版本 但是 我的CUDA版本是9.0 C:\Users\xxx>nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2017 NVIDIA Corporation Built on Fri_Sep__1_21:08:32_Central_D
InternalError:cudaGetDevice()失败。状态:CUDA驱动程序版本不足以支持CUDA运行时版本
但是
我的CUDA版本是9.0
C:\Users\xxx>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:32_Central_Daylight_Time_2017
Cuda compilation tools, release 9.0, V9.0.176
我的驱动程序版本是说它应该是兼容的
NVIDIA驱动程序版本385.54
如果我跑
sess=tf.Session(config=tf.ConfigProto(log\u device\u placement=True))
我明白了
2020-03-03 17:12:44.099395: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2020-03-03 17:12:44.107794: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: Quadro P400 major: 6 minor: 1 memoryClockRate(GHz): 1.2525
pciBusID: 0000:02:00.0
2020-03-03 17:12:44.112565: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-03-03 17:12:44.121275: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
---------------------------------------------------------------------------
InternalError Traceback (most recent call last)
<ipython-input-4-dad9f5fa93d0> in <module>
----> 1 sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site-packages\tensorflow\python\client\session.py in __init__(self, target, graph, config)
1568
1569 """
-> 1570 super(Session, self).__init__(target, graph, config=config)
1571 # NOTE(mrry): Create these on first `__enter__` to avoid a reference cycle.
1572 self._default_graph_context_manager = None
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site-packages\tensorflow\python\client\session.py in __init__(self, target, graph, config)
691 try:
692 # pylint: disable=protected-access
--> 693 self._session = tf_session.TF_NewSessionRef(self._graph._c_graph, opts)
694 # pylint: enable=protected-access
695 finally:
InternalError: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version
2020-03-03 17:12:44.099395:I tensorflow/core/platform/cpu\u feature\u guard.cc:142]您的cpu支持未编译此tensorflow二进制文件以使用的指令:AVX AVX2
2020-03-03 17:12:44.107794:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640]找到了具有以下属性的设备0:
名称:Quadro P400大调:6小调:1内存时钟频率(GHz):1.2525
pciBusID:0000:02:00.0
2020-03-03 17:12:44.112565:I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25]GPU库是静态链接的,跳过dlopen check。
2020-03-03 17:12:44.121275:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763]添加可见gpu设备:0
---------------------------------------------------------------------------
内部错误回溯(最后一次最近调用)
在里面
---->1 sess=tf.Session(config=tf.ConfigProto(log\u device\u placement=True))
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site packages\tensorflow\python\client\session.py in\uuuuuuu init\uuuuuu(self、target、graph、config)
1568
1569 """
->1570 super(Session,self)。\uuuuu init\uuuuuu(目标,图形,配置=config)
1571#注意(mrry):在第一个`uu´输入´´时创建这些,以避免引用循环。
1572 self.\u default\u graph\u context\u manager=None
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site packages\tensorflow\python\client\session.py in\uuuuuuu init\uuuuuu(self、target、graph、config)
691试试:
692#pylint:disable=受保护访问
-->693 self._session=tf_session.tf_NewSessionRef(self._图._c_图,opts)
694#pylint:enable=受保护访问
695最后:
内部错误:cudaGetDevice()失败。状态:CUDA驱动程序版本不足以支持CUDA运行时版本
请让我知道我能提供什么进一步的信息
谢谢大家!
更多信息
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from __future__ import absolute_import, division, print_function, unicode_literals
In [2]: import tensorflow as tf
In [3]: print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
2020-03-03 19:02:07.292400: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
2020-03-03 19:02:07.443544: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: Quadro P400 major: 6 minor: 1 memoryClockRate(GHz): 1.2525
pciBusID: 0000:02:00.0
2020-03-03 19:02:07.448224: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-03-03 19:02:07.453367: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
Num GPUs Available: 1
In [4]: sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
2020-03-03 19:02:52.859131: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2020-03-03 19:02:52.865056: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: Quadro P400 major: 6 minor: 1 memoryClockRate(GHz): 1.2525
pciBusID: 0000:02:00.0
2020-03-03 19:02:52.869160: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-03-03 19:02:52.873013: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
---------------------------------------------------------------------------
InternalError Traceback (most recent call last)
<ipython-input-4-dad9f5fa93d0> in <module>
----> 1 sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site-packages\tensorflow\python\client\session.py in __init__(self, target, graph, config)
1568
1569 """
-> 1570 super(Session, self).__init__(target, graph, config=config)
1571 # NOTE(mrry): Create these on first `__enter__` to avoid a reference cycle.
1572 self._default_graph_context_manager = None
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site-packages\tensorflow\python\client\session.py in __init__(self, target, graph, config)
691 try:
692 # pylint: disable=protected-access
--> 693 self._session = tf_session.TF_NewSessionRef(self._graph._c_graph, opts)
694 # pylint: enable=protected-access
695 finally:
InternalError: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version
Python 3.7.6(默认值,2020年1月8日,20:23:39)[MSC v.1916 64位(AMD64)]
有关详细信息,请键入“版权”、“信用”或“许可证”
IPython 7.12.0--增强的交互式Python。键入“?”以获取帮助。
[1]中:来自uuu未来uuu导入绝对u导入、除法、打印函数、unicode文本
在[2]中:将tensorflow作为tf导入
在[3]中:打印(“可用的GPU数量:”,len(tf.config.experimental.list\u物理设备('GPU'))
2020-03-03 19:02:07.292400:I tensorflow/stream_executor/platform/default/dso_loader.cc:42]已成功打开动态库nvcuda.dll
2020-03-03 19:02:07.443544:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640]找到了具有以下属性的设备0:
名称:Quadro P400大调:6小调:1内存时钟频率(GHz):1.2525
pciBusID:0000:02:00.0
2020-03-03 19:02:07.448224:I tensorflow/streamúexecutor/platform/default/dlopen戋checker戋存根。cc:25]GPU库是静态链接的,跳过dlopen check。
2020-03-03 19:02:07.453367:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763]添加可见gpu设备:0
可用GPU数量:1
在[4]中:sess=tf.Session(config=tf.ConfigProto(log\u device\u placement=True))
2020-03-03 19:02:52.859131:I tensorflow/core/platform/cpu\u feature\u guard.cc:142]您的cpu支持该tensorflow二进制文件未编译为使用的指令:AVX AVX2
2020-03-03 19:02:52.865056:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640]找到了具有以下属性的设备0:
名称:Quadro P400大调:6小调:1内存时钟频率(GHz):1.2525
pciBusID:0000:02:00.0
2020-03-03 19:02:52.869160:I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25]GPU库是静态链接的,跳过dlopen check。
2020-03-03 19:02:52.873013:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763]添加可见gpu设备:0
---------------------------------------------------------------------------
内部错误回溯(最后一次最近调用)
在里面
---->1 sess=tf.Session(config=tf.ConfigProto(log\u device\u placement=True))
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site packages\tensorflow\python\client\session.py in\uuuuuuu init\uuuuuu(self、target、graph、config)
1568
1569 """
->1570 super(Session,self)。\uuuuu init\uuuuuu(目标,图形,配置=config)
1571#注意(mrry):在第一个`uu´输入´´时创建这些,以避免引用循环。
1572 self.\u default\u graph\u context\u manager=None
C:\Programs\Anaconda3\envs\DLC-GPU\lib\site packages\tensorflow\python\client\session.py in\uuuuuuu init\uuuuuu(self、target、graph、config)
691试试:
692#pylint:disable=受保护访问
-->693 self._session=tf_session.tf_NewSessionRef(self._图._c_图,opts)
694#pylint:enable=受保护访问
695最后:
内部错误:cudaGetDevice()失败。状态:CUDA驱动程序版本不足以支持CUDA运行时版本
这是tensorflow版本的问题,或者是程序与所有环境变量之间的交互问题。使用Python3.6和tensorflow 1.8解决了这个问题。
我所做的是编辑环境文件来指定那些版本,它工作了。我知道这不是一个明确的答案,但它可能有助于使它在其他一些情况下发挥作用,并成为找到真正问题的起点。
这些是环境变量:
dependencies:
- python=3.6
- pip
- tensorflow-gpu==1.8
- cudnn=7
- wxpython
- jupyter
- nb_conda
- Shapely
- pip:
- deeplabcut
只需更新您的驱动程序——anaconda正在使用与您的驱动程序版本不兼容的内部CUDA安装@talonmies解决方案的问题在于并非每个nvidia驱动程序都与每个CUDA安装兼容。我确信这个组合