thesby的专栏

CXXNET是深度学习的高效库,在安装好了caffe之后再安装CXXNET的话,非常简单,因为它们的依赖库差不多。

本文主要就是介绍在安装了caffe之后再安装CXXNET的步骤。如果还没有安装caffe,可以参考这里。

安装平台:ubuntu14.04 LTS 64位。

1、CXXNET 下载。

2、解压文件,,然后把 make/config.mk复制到 cxxnet-master文件夹下面

3、编辑复制后的 config.mk .

#—————————————————–# cxxnet: the configuration compile script## This is the default configuration setup for cxxnet# If you want to change configuration, do the following steps:## – copy this file to the root folder# – modify the configuration you want# – type make or make -j n for parallel build#—————————————————-# choice of compilerexport CC = gccexport CXX = g++export NVCC = nvcc# whether use CUDA during compileUSE_CUDA = 1# add the path to CUDA libary to link and compile flag# if you have already add them to enviroment variable, leave it as NONEUSE_CUDA_PATH =/usr/local/cuda-6.5CUDA_DIR := /usr/local/cuda# whether use opencv during compilation# you can disable it, however, you will not able to use# imbin iteratorUSE_OPENCV = 1USE_OPENCV_DECODER = 1# whether use CUDNN R3 libraryUSE_CUDNN = 0# add the path to CUDNN libary to link and compile flag# if you do not need that, or do not have that, leave it as NONEUSE_CUDNN_PATH = NONE## choose the version of blas you want to use# can be: mkl, blas, atlas, openblasUSE_STATIC_MKL = /opt/intel/composer_xe_2015.1.133USE_BLAS = mkl## add path to intel libary, you may need it# for MKL, if you did not add the path to enviroment variable#USE_INTEL_PATH = NONE# whether compile with parameter serverUSE_DIST_PS = 0PS_PATH = NONEPS_THIRD_PATH = NONE# the additional link flags you want to addADD_LDFLAGS = -ljpeg# the additional compile flags you want to addADD_CFLAGS =## If use MKL, choose static link automaticly to fix python wrapper#ifeq ($(USE_BLAS), mkl)USE_STATIC_MKL = 1endif

这里的mkl和cuda都是采用默认路径安装。

4、sudo sh ./build.sh 就开始build了。这里可能会出现一些问题,比如我的是找不到liomp5这个库,其实它是存在的。所以我就建立了一个软连接 sudo ln -s /opt/intel/composer_xe_2015.1.133/compiler/lib/intel64/libiomp5.so /usr/lib/libiomp5.so 如果遇到类似的问题,只要建立链接即可。

5、cd tools

6、sudo make

大功告成了!可以去example下面跑两个试试,我跑了下 sudo sh run.sh ./MNIST_CONV.conf, 结果如下:

Use CUDA Device 0: GeForce GTX 680finish initialization with 1 devicesInitializing layer: cv1Initializing layer: 1Initializing layer: 2Initializing layer: 3Initializing layer: fc1Initializing layer: se1Initializing layer: fc2Initializing layer: 7SGDUpdater: eta=0.100000, mom=0.900000SGDUpdater: eta=0.100000, mom=0.900000SGDUpdater: eta=0.100000, mom=0.900000SGDUpdater: eta=0.100000, mom=0.900000SGDUpdater: eta=0.100000, mom=0.900000SGDUpdater: eta=0.100000, mom=0.900000node[in].shape: 100,1,28,28node[1].shape: 100,32,14,14node[2].shape: 100,32,7,7node[3].shape: 100,1,1,1568node[4].shape: 100,1,1,100node[5].shape: 100,1,1,100node[6].shape: 100,1,1,10MNISTIterator: load 60000 images, shuffle=1, shape=100,1,28,28MNISTIterator: load 10000 images, shuffle=0, shape=100,1,28,28initializing end, start workinground 0:[ 600] 2 sec elapsed[1] train-error:0.211783 test-error:0.0435round 1:[ 600] 4 sec elapsed[2] train-error:0.0522667 test-error:0.0263round 2:[ 600] 5 sec elapsed[3] train-error:0.0370833 test-error:0.0214round 3:[ 600] 7 sec elapsed[4] train-error:0.0316167 test-error:0.023round 4:[ 600] 8 sec elapsed[5] train-error:0.02905 test-error:0.0152round 5:[ 600] 10 sec elapsed[6] train-error:0.0265167 test-error:0.0166round 6:[ 600] 12 sec elapsed[7] train-error:0.0248333 test-error:0.0164round 7:[ 600] 13 sec elapsed[8] train-error:0.0226667 test-error:0.0144round 8:[ 600] 15 sec elapsed[9] train-error:0.0234167 test-error:0.0139round 9:[ 600] 17 sec elapsed[10] train-error:0.0221 test-error:0.0152round 10:[ 600] 18 sec elapsed[11] train-error:0.0218667 test-error:0.0121round 11:[ 600] 20 sec elapsed[12] train-error:0.02025 test-error:0.0128round 12:[ 600] 22 sec elapsed[13] train-error:0.01925 test-error:0.0142round 13:[ 600] 23 sec elapsed[14] train-error:0.0194333 test-error:0.0129round 14:[ 600] 25 sec elapsed[15] train-error:0.0190167 test-error:0.0114updating end, 25 sec in all速度极快!呵呵。

朋友你如果对深度学习感兴趣,我很希望能和你相互学习交流。

真正的爱,应该超越生命的长度心灵的宽度灵魂的深度

thesby的专栏

相关文章:

你感兴趣的文章:

标签云: