正好神船本本的显卡还行,搭建一个GPU计算的深度学习环境
拜读前辈的文章:(AAA BBB CCC为标签)
sudo apt-get install build-essential
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
zzz@zzz-ubuntu:~$ gcc --version
gcc (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sudo chmod +x cuda_9.0.103_384.59_linux.run
sudo sh cuda_9.0.103_384.59_linux.run --tmpdir=/tmp
sudo cp cudnn.h /usr/local/cuda/include/ #复制头文件
sudo cp lib* /usr/local/cuda/lib64/ #复制动态链接库
cd /usr/local/cuda/lib64/
sudo chmod +r libcudnn.so.5.1.10 # ----------------------------------->>>自己查看.so的版本
sudo ln -sf libcudnn.so.5.1.10 libcudnn.so.5
sudo ln -sf libcudnn.so.5 libcudnn.so
sudo ldconfig
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
sudo apt-get install libgflags-dev
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
[----------] Global test environment tear-down
[==========] 2139 tests from 285 test cases ran. (361787 ms total)
[ PASSED ] 2139 tests.
sudo apt-get install ipython-notebook python-sympy #太----慢
sudo pip install jupyter
mkdir notebook
cd notebook
ipython notebook
zzz@zzz-ubuntu:~/caffe-master$ ./data/mnist/get_mnist.sh
Downloading...
--2018-01-31 15:19:44-- http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz
正在解析主机 yann.lecun.com (yann.lecun.com)... 216.165.22.6
正在连接 yann.lecun.com (yann.lecun.com)|216.165.22.6|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 9912422 (9.5M) [application/x-gzip]
正在保存至: “train-images-idx3-ubyte.gz”
train-images-idx3-u 100%[===================>] 9.45M 2.41MB/s in 5.6s
2018-01-31 15:19:50 (1.68 MB/s) - 已保存 “train-images-idx3-ubyte.gz” [9912422/9912422])
--2018-01-31 15:19:51-- http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz
正在解析主机 yann.lecun.com (yann.lecun.com)... 216.165.22.6
正在连接 yann.lecun.com (yann.lecun.com)|216.165.22.6|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 28881 (28K) [application/x-gzip]
正在保存至: “train-labels-idx1-ubyte.gz”
train-labels-idx1-u 100%[===================>] 28.20K 68.9KB/s in 0.4s
2018-01-31 15:19:52 (68.9 KB/s) - 已保存 “train-labels-idx1-ubyte.gz” [28881/28881])
--2018-01-31 15:19:52-- http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz
正在解析主机 yann.lecun.com (yann.lecun.com)... 216.165.22.6
正在连接 yann.lecun.com (yann.lecun.com)|216.165.22.6|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 1648877 (1.6M) [application/x-gzip]
正在保存至: “t10k-images-idx3-ubyte.gz”
t10k-images-idx3-ub 100%[===================>] 1.57M 385KB/s in 4.2s
2018-01-31 15:19:57 (385 KB/s) - 已保存 “t10k-images-idx3-ubyte.gz” [1648877/1648877])
--2018-01-31 15:19:57-- http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz
正在解析主机 yann.lecun.com (yann.lecun.com)... 216.165.22.6
正在连接 yann.lecun.com (yann.lecun.com)|216.165.22.6|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 4542 (4.4K) [application/x-gzip]
正在保存至: “t10k-labels-idx1-ubyte.gz”
t10k-labels-idx1-ub 100%[===================>] 4.44K --.-KB/s in 0.001s
2018-01-31 15:19:58 (4.71 MB/s) - 已保存 “t10k-labels-idx1-ubyte.gz” [4542/4542])
zzz@zzz-ubuntu:~/caffe-master$ ./examples/mnist/create_mnist.sh
Creating lmdb...
I0131 15:20:55.037561 21908 db_lmdb.cpp:35] Opened lmdb examples/mnist/mnist_train_lmdb
I0131 15:20:55.037745 21908 convert_mnist_data.cpp:88] A total of 60000 items.
I0131 15:20:55.037755 21908 convert_mnist_data.cpp:89] Rows: 28 Cols: 28
I0131 15:20:55.890231 21908 convert_mnist_data.cpp:108] Processed 60000 files.
I0131 15:20:56.241214 21914 db_lmdb.cpp:35] Opened lmdb examples/mnist/mnist_test_lmdb
I0131 15:20:56.241405 21914 convert_mnist_data.cpp:88] A total of 10000 items.
I0131 15:20:56.241415 21914 convert_mnist_data.cpp:89] Rows: 28 Cols: 28
I0131 15:20:56.356094 21914 convert_mnist_data.cpp:108] Processed 10000 files.
Done.
zzz@zzz-ubuntu:~/caffe-master$ ./examples/mnist/train_lenet.sh
。。。略
I0131 15:22:26.077268 21940 solver.cpp:310] Iteration 10000, loss = 0.00205961
I0131 15:22:26.077317 21940 solver.cpp:330] Iteration 10000, Testing net (#0)
I0131 15:22:26.186694 21947 data_layer.cpp:73] Restarting data prefetching from start.
I0131 15:22:26.189587 21940 solver.cpp:397] Test net output #0: accuracy = 0.9909
I0131 15:22:26.189636 21940 solver.cpp:397] Test net output #1: loss = 0.0279359 (* 1 = 0.0279359 loss)
I0131 15:22:26.189646 21940 solver.cpp:315] Optimization Done.
I0131 15:22:26.189651 21940 caffe.cpp:259] Optimization Done.