TensorFlow 报错 failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
来源:互联网 发布:多路访问网络协议 编辑:程序博客网 时间:2024/05/18 01:55
今天使用python virtualenv安装TensorFlow gpu版,一直报错
各种配置版本按官网来的https://www.tensorflow.org/
cuda8.0 cudnn5.1
错误如下
2017-06-16 13:53:53.632070: W tensorflow/stream_executor/cuda/cuda_driver.cc:523] A non-primary context 0x3f287f0 exists before initializing the StreamExecutor. We haven't verified StreamExecutor works with that.
2017-06-16 13:53:53.632367: E tensorflow/core/common_runtime/direct_session.cc:138] Internal: failed initializing StreamExecutor for CUDA device ordinal 1: Internal: failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zw/jy/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1292, in __init__
super(Session, self).__init__(target, graph, config=config)
File "/home/zw/jy/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 562, in __init__
self._session = tf_session.TF_NewDeprecatedSession(opts, status)
File "/usr/lib/python3.5/contextlib.py", line 66, in __exit__
next(self.gen)
File "/home/zw/jy/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InternalError: Failed to create session.
后来参考一下连接解决错误
https://stackoverflow.com/questions/37893755/tensorflow-set-cuda-visible-devices-within-jupyter
https://stackoverflow.com/questions/44375177/tensorflow-unusual-cuda-related-error
http://www.cnblogs.com/darkknightzh/p/6591923.html
原因是在创建session时没有使用我想让它用的gpu
所以需要设置
CUDA_VISIBLE_DEVICES
方法1 在python程序中
import osos.environ["CUDA_VISIBLE_DEVICES"] = "1"
方法2
运行时CUDA_VISIBLE_DEVICES=1 python **.py方法3
直接在环境变量中 export
- TensorFlow 报错 failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
- Tensorflow: failed call to cuInit: CUDA_ERROR_UNKNOWN
- TensorFlow的图像预处理报错ValueError: Tried to convert ‘min_object_covered’ to a tensor and failed.
- Delphi 程序启动报错 "A call to an OS function failed."
- hadoop报错report: Call From xxx to xxx failed on connect
- hbase链接hadoop报错CopyFromLocal: Call to localhost/127.0.0.1:8020 failed on connection exception:
- Call to lnusertemp failed
- tensorflow安装问题:No module named pywrap_tensorflow_internal&failed call to cuInit:CUDA_ERROR_NO_DEVICE
- 解决 tensorflow softmax_cross_entropy_with_logits() 报错 Only call `softmax_cross_entropy_with_logits`
- Tensorflow导入报"Failed to load the native TensorFlow runtime."解决方案
- uploadify3.2.1 Call to StartUpload failed Call to ReturnUploadStart failed
- hive运行报Call to master/**.** failed on local exception: java.nio.channels.ClosedByInterr
- tensorflow 报错 InternalError: Blas SGEMM launch failed
- scrapy报错: failed to create process
- Tomcat 报错:Failed to start Compenent
- build报错Failed to Crunch File
- 报错:Failed to finalize session : INSTALL_FAILED_INVALID_APKLE:
- Vue 报错 Failed to resolve filter
- 使用Mybatis Generator自动生成代码
- 深度学习性能提升的诀窍
- 数值包装类型和equals和=
- layer.prompt输入框改成laydate时间控件
- php上传时,上传文件类型对照表
- TensorFlow 报错 failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
- 【脚本语言系列】关于PythonNoSQL数据库处理redis,你需要知道的事
- easyui propertyGrid
- RxJava使用场景小结
- 国内阿里Maven仓库镜像Maven配置文件Maven仓库速度快
- KMP算法详解与Java实现
- PDFObject.js去掉下载和打印功能
- 三菱PLC与研华webaccess以太网通讯配置
- CodeChef AUG14 SIGFIB