我有两台电脑,而不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驱动程序,这确实可以促进部署。 –