1.libcudart.so.8.0: cannot open shared object file: No such file or directory
kinny@kinny-Lenovo-XiaoXin:~/Study/tensorflow-0.11.0rc0/tensorflow/models/image/mnist$ python convolutional.py Traceback (most recent call last): File "convolutional.py", line 34, in <module> import tensorflow as tf File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module> from tensorflow.python import * File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> _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方法是设置环境变量,把以前设置的cuda环境变量改成一下这样,这个是tensorflow官网上要求的环境变量;
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" export CUDA_HOME=/usr/local/cuda2.TypeError: run() got an unexpected keyword argument ‘argv’
Traceback (most recent call last): File "convolutional.py", line 339, in <module> tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) TypeError: run() got an unexpected keyword argument 'argv'方法是把main里面的argv参数去掉
使用python 虚拟环境使用gpu版本运行mnist例子非常慢,基本卡死在数据下载和读取上了!为了比较gpu和cpu的性能,使用虚拟环境安装了tensorflow的cpu版本;
sudo apt-get install python-pip python-dev python-virtualenv mkdir py2virtualenv virtualenv --system-site-packages ~/py2virtualenv/tensorflowcpu source ~/py2virtualenv/tensorflowcpu/bin/activate export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl pip install --upgrade $TF_BINARY_URL原来cpu版本数据读取和下载很快!cpu适合做IO和简单逻辑运算和加减,但是gpu不行,gpu不适合做高IO和加减法,但是在做矩阵运算表现十分强悍,我在把mnist数据集下载到本地后,分别使用cpu版本和gpu版本跑tensorflow/tensorflow/models/image/mnist/convolutional.py,结果显示:
//cpu版本 Step 8100 (epoch 9.43), 130.6 ms Minibatch loss: 1.630, learning rate: 0.006302 Minibatch error: 0.0% Validation error: 0.8% 平均每 100 次 130.64ms 左右 real 19m5.685s user 67m33.720s sys 0m12.340s //gpu版本 Step 8100 (epoch 9.43), 23.2 ms Minibatch loss: 1.634, learning rate: 0.006302 Minibatch error: 0.0% Validation error: 0.9% 平均每 100 次 23.2ms 左右 real 3m28.296s user 2m45.888s sys 0m29.064sGPU在矩阵密集运算方面完虐cpu,大概是6倍。我的是GTX 950M,不知道现在的GTX 1080M是什么情况。
Ubuntu 16.04下Matlab2014a+Anaconda2+OpenCV3.1+Caffe安装
Ubuntu 16.04系统下CUDA7.5配置Caffe教程
Caffe + Ubuntu 14.04 64bit + CUDA 6.5 配置说明
Caffe配置简明教程 ( Ubuntu 14.04 / CUDA 7.5 / cuDNN 5.1 / OpenCV 3.1 )