TensorFlow报错:failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE

版本:

tensorflow-gpu

原因:

在创建session时没有使用我想让它用的gpu

解决方案:

1. 在python程序中:

import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

2. 运行时:

CUDA_VISIBLE_DEVICES=0 python **.py

3. 直接在环境变量中 export

export CUDA_VISIBLE_DEVICES=‘0‘
python **.py

  

时间: 2024-10-09 04:45:11

TensorFlow报错:failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE的相关文章

fetch 报错 Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.

TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body. 在"窗口"上执行"取"失败:GET / get方法的请求不能有正文. GET requests can't have a request body, you can't make them have one. GET requests only retrieve data,

Vue.js报错Failed to resolve filter问题原因

Vue.js报错Failed to resolve filter问题原因 金刚 vue Vue.js js javascript 之前使用vue.js写分页功能时,写了一个过滤器,发现一个比较奇怪的错误. console控制台调试的时候 提示错误消息: Failed to resolve filter: HomePage console错误信息.jpg 我原来的写法: 原来的错误写法.jpg 错误原因 经过自己的摸索,后来发现竟然是代码顺序错误问题... 由于先执行的pageList,后执行的V

MyEclipse打开 HTML 报错Failed to create the part's controls

拷贝代码时有时会弹出这个错误,页面仍然可以访问,但是无法编辑很郁闷. MyEclipse默认打开编辑页面是MyEclipse visual html designer 右击html页面选择open with,点击 MyEclipse html Editer即可. MyEclipse打开 HTML 报错Failed to create the part's controls

Eclipse启动 报错[Failed to load the JNI shared library jvm.dll

准备要做java服务器,在安装开发环境时,启动Eclipse报错[Failed to load the JNI shared library jvm.dll] 研究了下,造成错误的原因是由于eclipse与jdk的不一致造成的. 我的开发环境是64位windows8 Pro,安装了64位jdk1.6,eclipse却粗物的安装了32位的版本,由于64位和32位匹配不一致,造成了以上错误的发生. 又尝试了一下,32位jdk+64位eclipse也会发生同样的问题. 好了,解决方法很简单,jdk和e

nmap报错: Failed to open device ethxxx

nmap报错:  Failed to open device ethxxx 周银辉 今天用nmap时, 报错:   Failed to open device eth4, 好郁闷. 调查了一下, 是winpcap引起的, 卸载掉winpcap,重新安装winpcap即可. winpcap下载地址: http://www.winpcap.org/install/default.htm

mvn install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2 错误: 找不到符号

报错信息 在Eclipse中执行mvn install时,console端显示如下报错信息: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project ERP: Compilation failure: Compilation failure: [ERROR] \test01\src\main\java\HStyl

inotify报错Failed to watch /opt; /proc/sys/fs/inotify/max_user_watches,K哥

2016.11.8 K哥有2台服务器使用了unison+inotify达到网站文件夹时时同步的效果 今天突然发现inotify占用很大CPU,可以用top命令查看 打开inotify日志查看原因 发现这一报错 Failed to watch /opt; upper limit on inotify watches reached!Please increase the amount of inotify watches allowed per user via `/proc/sys/fs/ino

linux下启动tomcat报错 Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness

INFO [localhost-startStop-1] com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$InfoLogger.log(206) | Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomnessjava.net.UnknownHostException: Oracle.Linu

tomcat运行报错Failed to start component [StandardEngine[Catalina].StandardHost[localhost].

tomcat运行报错Failed to start component [StandardEngine[Catalina].StandardHost[localhost].多半情况是找不到jar包 解决办法: 右键项目-> 属性->添加lib 原文地址:https://www.cnblogs.com/firstdream/p/8401626.html

git报错failed to push some refs to '[email protected]:Markprint/github.git'

 这个不知名小错误用了我两天的空余时间mmp   就是这里报的错 输入 git push origin master -f 解释为: 远程分支上存在本地分支中不存在的提交,往往是多人协作开发过程中遇到的问题,可以先fetch再merge,也就是pull,把远程分支上的提交合并到本地分支之后再push.如果你确定远程分支上那些提交都不需要了,那么直接git push origin master -f,强行让本地分支覆盖远程分支 终于有了,以后还需要具体研究一下 虽然用的github,但是要推广一下