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

我有两台没有CUDA的电脑:一台在微软Windows上运行,另一台在Linux上运行(Ubuntu14.0464bit/Linux3.13.0-100-generic)

我可以在微软视窗上使用没有CUDA的TensorFlow,没有任何问题:TensorFlow使用CPU。但是,如果在Linux机器上,我在pythonimport tensorflow as tf中运行,则由于未安装CUDA,无法导入TensorFlow: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上,如果没有CUDA,如何使用TensorFlow?

我用tensorflow-gpu==1.0.0。

我知道tensorflow.ConfigProto中的参数device_count,它允许禁用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

但更愿意在这两台机器上避免。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值