安装步骤:
1. 预安装需求库
sudo apt-get install python-dev python-numpy python-scipy python-magic python-matplotlib libatlas-base-dev libjpeg-dev libopencv-dev git
2. 安装CUDA 6.0
从http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.5-14_amd64.deb下载 cuda-repo-ubuntu1204_6.5-14_amd64.deb
$wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.5-14_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu1204_6.0-37_amd64.deb
$ sudo apt-get update
$ sudo apt-get install cuda
3. 配置CUDA环境变量
vi ~/.bashrc
export CUDA_HOME=/usr/local/cuda-6.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
4. 下载cuda-convnet2源码
git clone https://code.google.com/p/cuda-convnet2/
5. 编译源码
jerry@hq:/u01/cuda-convnet2$ sh build.sh
mkdir -p ./bin//src
g++ -O3 -c -fPIC -DNUMPY_INTERFACE -I./include -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ src/matrix.cpp -o ./bin//src/matrix.o
In file included from /usr/include/python2.7/Python.h:8:0,
from src/../include/matrix.h:22,
from src/matrix.cpp:17:
/usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200112L
^
In file included from /usr/include/stdlib.h:25:0,
from src/../include/matrix_funcs.h:20,
from src/../include/matrix.h:20,
from src/matrix.cpp:17:
/usr/include/features.h:164:0: note: this is the location of the previous definition
# define _POSIX_C_SOURCE 200809L
^
In file included from /usr/include/python2.7/Python.h:8:0,
from src/../include/matrix.h:22,
from src/matrix.cpp:17:
/usr/include/python2.7/pyconfig.h:1183:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
#define _XOPEN_SOURCE 600
^
In file included from /usr/include/stdlib.h:25:0,
from src/../include/matrix_funcs.h:20,
from src/../include/matrix.h:20,
from src/matrix.cpp:17:
/usr/include/features.h:166:0: note: this is the location of the previous definition
# define _XOPEN_SOURCE 700
^
cd ./bin/ && g++ -O3 -DNUMPY_INTERFACE -shared -Wl,-no-undefined -o libutilpy.so src/matrix.o -L/usr/lib/atlas-base -latlas -lcblas -lpython2.7
ln -sf ./bin//libutilpy.so .
mkdir -p ./bin/release
mkdir -p ./obj/release/src
mkdir -p ./bin/release
mkdir -p ./obj/release/src
mkdir -p ./bin/release
mkdir -p ./obj/release/src
mkdir -p ./bin//src
g++ -O3 -c -fPIC -I./include -I/usr/include/python2.7 src/pyext.cpp -o ./bin//src/pyext.o
In file included from /usr/include/python2.7/Python.h:8:0,
from src/../include/pyext.h:23,
from src/pyext.cpp:17:
/usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200112L
^
In file included from /usr/include/stdio.h:28:0,
from src/../include/pyext.h:20,
from src/pyext.cpp:17:
/usr/include/features.h:164:0: note: this is the location of the previous definition
# define _POSIX_C_SOURCE 200809L
^
In file included from /usr/include/python2.7/Python.h:8:0,
from src/../include/pyext.h:23,
from src/pyext.cpp:17:
/usr/include/python2.7/pyconfig.h:1183:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
#define _XOPEN_SOURCE 600
^
In file included from /usr/include/stdio.h:28:0,
from src/../include/pyext.h:20,
from src/pyext.cpp:17:
/usr/include/features.h:166:0: note: this is the location of the previous definition
# define _XOPEN_SOURCE 700
^
cd ./bin/ && g++ -O3 -shared -Wl,-no-undefined -o _MakeDataPyExt.so src/pyext.o -L/usr/local/cuda/lib64 `pkg-config --libs python` `pkg-config --libs opencv` -lpthread
ln -sf ./bin//_MakeDataPyExt.so .
6. 运行脚本
jerry@hq:/u01/cuda-convnet2$ python convnet.py --data-path=/u01/lisa/data/cifar10/cifar-10-batches-py --save-path=/u01/jerry/tmp --test-range=5 --train-range=1-4 --layer-def=./layers/layers-cifar10-11pct.cfg --layer-params=./layers/layer-params-cifar10-11pct.cfg --data-provider=cifar-cropped --test-freq=13 --epochs=100
Option --gpu (GPU override) not supplied
convnet.py usage:
Option Description Default
[--check-grads <0/1> ] - Check gradients and quit? [0]
[--color-noise
[--conserve-mem <0/1> ] - Conserve GPU memory (slower)? [0]
[--conv-to-local
[--epochs
[--feature-path
[--force-save <0/1> ] - Force save before quitting [0]
[--inner-size
[--layer-path
[--load-file
[--logreg-name
[--mini
[--multiview-test <0/1> ] - Cropped DP: test on multiple patches? [0]
[--scalar-mean
[--test-freq
[--test-one <0/1> ] - Test on one batch at a time? [1]
[--test-only <0/1> ] - Test and quit? [0]
[--test-out
[--unshare-weights
[--write-features
--data-path
--data-provider
--gpu
--layer-def
--layer-params
--save-file
--save-path
--test-range
--train-range
由于ubuntu是在windows里的虚拟机,无法使用本机或外置的gpu显卡, 故无法运行程序。 有点遗憾