查看keras认得到的GPU

from keras import backend as K
K.tensorflow_backend._get_available_gpus()

Out[28]:

['/job:localhost/replica:0/task:0/device:GPU:0']

查看更详细device信息

from tensorflow.python.client import device_lib
import tensorflow as tf print(device_lib.list_local_devices())
print(tf.test.is_built_with_cuda())

output:

 [name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 9443078288448539683
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 14589028880023685106
physical_device_desc: "device: XLA_CPU device"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 12944586764183584921
physical_device_desc: "device: XLA_GPU device"
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 8365150044
locality {
bus_id: 1
links {
}
}
incarnation: 8725535454902618392
physical_device_desc: "device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:00:04.0, compute capability: 6.0"
]
True
 
查看正在使用的GPU
import tensorflow as tf
print (tf.__version__)
if tf.test.gpu_device_name():
print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
else:
print("Please install GPU version of TF")

output:

1.13.1
Default GPU Device: /device:GPU:0
 
 
如果你用的 PyTorch, 请移步 怎么用 pytorch 查看 GPU 信息

怎么查看keras 或者 tensorflow 正在使用的GPU的更多相关文章

  1. Keras---Virtualenv 下安装Keras (基于Tensorflow后端)

    Python---Virtualenv 下安装Keras  (基于Tensorflow后端)   一.Keras简介 https://keras-cn.readthedocs.io/en/latest ...

  2. TensorFlow+Keras 03 TensorFlow 与 Keras 介绍

    1 TensorFlow 架构图 1.1 处理器 TensorFlow 可以在CPU.GPU.TPU中执行 1.2 平台 TensorFlow 具备跨平台能力,Windows .Linux.Andro ...

  3. Reducing and Profiling GPU Memory Usage in Keras with TensorFlow Backend

    keras 自适应分配显存 & 清理不用的变量释放 GPU 显存 Intro Are you running out of GPU memory when using keras or ten ...

  4. 在android上跑 keras 或 tensorflow 模型

    https://groups.google.com/forum/#!topic/keras-users/Yob7mIDmTFs http://talc1.loria.fr/users/cerisara ...

  5. keras 与tensorflow 混合使用

    keras 与tensorflow 混合使用 tr:nth-child(odd) > td, .table-striped tbody > tr:nth-child(odd) > t ...

  6. 使用C++部署Keras或TensorFlow模型

    本文介绍如何在C++环境中部署Keras或TensorFlow模型. 一.对于Keras, 第一步,使用Keras搭建.训练.保存模型. model.save('./your_keras_model. ...

  7. 版本问题---keras和tensorflow的版本对应关系

    keras和tensorflow的版本对应关系,可参考: Framework Env name (--env parameter) Description Docker Image Packages ...

  8. tensorflow 1.12.0 gpu + python3.6.8 + win10 + GTX1060 + cuda9.0 + cudnn7.4 + vs2017)

    在安装tensorflow-gpu时,也看过不少的博客,讲得乱七八糟的,也不能这样说,只是每个人安装的环境或需求不一样,因此没有找到一个适合自己的教程去安装tensorflow-gpu版本.当然,入手 ...

  9. tensorflow 指定使用gpu处理,tensorflow占用多个GPU但只有一个在跑

    我们在刚使用tensorflow的过程中,会遇到这个问题,通常我们有多个gpu,但是 在通过nvidia-smi查看的时候,一般多个gpu的资源都被占满,但是只有一个gpu的GPU-Util 和 21 ...

随机推荐

  1. POJ 1383题解(树的直径)(BFS)

    题面 Labyrinth Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 4997 Accepted: 1861 Descript ...

  2. Kotlin学习(2)函数

    函数声明: fun plus(a:Int,b:String):Boolean{ //fun 函数名(参数名:参数类型,参数名:参数类型):返回值类型 println(a) return true // ...

  3. SCUT - 297 - 狂符「幻视调律(Visionary Tuning)」 - 重链剖分

    https://scut.online/p/297 一般的树剖是关于点权的,但是突发奇想好像边权也是一样的.做一些小改动. #include<bits/stdc++.h> #define ...

  4. EOJ Monthly 2019.2 A. 回收卫星

    题目传送门 题意: 你可以询问一个三维坐标,机器会告诉你这个坐标在不在目标圆中, 并且(0,0,0)是一定在圆上的,叫你求出圆心坐标 思路: 因为(0,0,0)一定在圆上,所以我们可以把圆心分成3个坐 ...

  5. 把int 类型转化为varchar并且去掉小数点同时以千分号‘,’分割

    把int 类型转化为money 类型,再转化为varchar,去掉小数点同时以千分号‘,’分割. select '$' + left(Convert(VARCHAR, cast(10000 as mo ...

  6. Linux常用指令全集

    Linux简介及Ubuntu安装 常见指令 系统管理命令 打包压缩相关命令 关机/重启机器 Linux管道 Linux软件包管理 vim使用 用户及用户组管理 文件权限管理 大牛笔记-www.weix ...

  7. SpringBoot中设置自定义拦截器

    SpringBoot中设置自动以拦截器需要写一个类继承HandlerInterceptorAdapter并重写preHandle方法 例子 public class AuthorityIntercep ...

  8. js string相关方法

    1>concat()      //合并返回新的字符串 var a="么么么么",b="ssss"; a.concat(b) //"么么么么ss ...

  9. xps9560黑苹果展示

    花费了一些时间来安装黑苹果 - - .,  展示一波 更换了DW1820a无线网卡,花费70+ 手上这台笔记本,在安装黑苹果的时候基本没遇见太大的问题,一路顺风顺水. 桌面,程序坞调小放在左侧   极 ...

  10. 用jquery制作的简单轮播图

    我也是进入H5前端的小菜鸟一枚,最近才进入jquery的学习,所以打算对自己的学习进行记录. 今天分享的是一个简单的轮播图,这个轮播图的特效很简单,能够进行图片的轮播以及点击相应图片,图片能够跳转到相 ...