keras-gpu/tensorflow-gpu运行程序没有调用GPU问题

安装 keras-gpu或者tensorflow-gpu后运行程序,发现没有调用GPU加速。

运行测试程序

import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))

报错:

failed call to cuInit: CUDA_ERROR_UNKNOWN

原因可能在于CUDA没有正确安装,运行CUDA Samples

cd NVIDIA_CUDA-9.2_Samples
make -j
cd ./bin/x86_64/linux/release
sudo ./deviceQuery

报错:

CUDA driver version is insufficient for CUDA runtime version

说明显卡驱动与CUDA驱动不匹配,更新显卡驱动或者降级CUDA,问题解决。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值