linux用cpu模拟cuda,如何在Linux上不使用CUDA使用TensorFlow?

我有两台电脑,而不CUDA:一个在Microsoft Windows上运行,另外一个运行在Linux(Ubuntu的14.04 64位/ Linux的3.13.0-100-通用))如何在Linux上不使用CUDA使用TensorFlow?

我可以在Microsoft Windows使用TensorFlow没有CUDA无任何问题:TensorFlow使用CPU。但是,如果Linux机器我在Python import tensorflow as tf运行,然后TensorFlow未能得到应有的进口正在没有安装CUDA到:

Traceback (most recent call last):

File "", line 1, in

File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in

from tensorflow.python import *

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 72, in

raise ImportError(msg)

ImportError: Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 61, in

from tensorflow.python import pywrap_tensorflow

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in

_pywrap_tensorflow = swig_import_helper()

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper

_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)

ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory

Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

for some common reasons and solutions. Include the entire stack trace

above this error message when asking for help.

我怎么能在Linux上使用TensorFlow没有CUDA?

我使用tensorflow-gpu==1.0.0。

我知道的参数device_count在tensorflow.ConfigProto,允许停用GPU,例如:

import tensorflow as tf

a = tf.constant(1, name = 'a')

b = tf.constant(3, name = 'b')

c = tf.constant(9, name = 'c')

d = tf.add(a, b, name='d')

e = tf.add(d, c, name='e')

config = tf.ConfigProto(device_count={'CPU': 1, 'GPU': 0})

sess = tf.Session(config=config)

print(sess.run([d, e]))

,但它并没有帮助,因为import tensorflow as tf是问题。

我也知道如何安装CUDA 8:

# Install Nvidia drivers, CUDA and CUDA toolkit, following some instructions from http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb

sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb

sudo apt-get update

sudo apt-get install cuda

,但希望避免它这两款机器。

+2

使用'tensorflow-gpu'意味着您必须安装CUDA驱动程序,即使机器没有GPU。如果没有gpu驱动程序,您必须使用编译的版本,在我们的机群中只能使用CPU –

+1

,我们在GPU和非GPU机器上安装GPU驱动程序,以便能够使用相同的TF二进制文件 –

+0

@YaroslavBulatov谢谢,我不知道'tensorflow-gpu'需要CUDA(我认为它可以选择使用GPU)。这解释了。很高兴知道可以在非GPU机器上安装GPU驱动程序,这确实可以促进部署。 –

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值