首先,通过git下载cuda-convnet2的代码,在build.sh中调整一下路径,就可以成功build了。
装好后想进行一下测试,就取网上找数据,发现imagenet实在太大,就准备用cifar-10。只有10类,50000 train batches, 10000 test batches。下载地址为
下载完后,用python打开保存在meta中的dict,用cPickle解压就行。然后执行python convnet.py --data-path=./dataset/srcdir/cifar-10-py-colmajor/ --save-path=./dataset/tardir/ --test-range=6 --train-range=1-5 --layer-def=./layers/layers-cifar10-11pct.cfg --layer-params=./layers/layer-params-cifar10-11pct.cfg --data-provider=cifar --test-freq=13 --gpu=0
发现出错,在convdata.py中修改img_size为32。。。再跑还是不行src/nvmatrix.cu(394) : getLastCudaError() CUDA error : kSetupCurand: Kernel execution failed : (8) invalid device function .似乎是gtx660 compute capability只有3.0达不到要求。然后尝试修改makefile
To solve the issue we needed to change the makefiles in cuda-convnet2/nvmatrix ,cuda-convnet2/cudaconv3 and cuda-convnet2/cudaconvnet.
In all the three files we added references to architecture 50 in the CUDA code generation flags (used to have only reference to 35), so the section should now look like:
# CUDA code generation flags
GENCODE_SM35 := -gencode arch=compute_35,code=sm_35
GENCODE_SM50 := -gencode arch=compute_50,code=sm_50 GENCODE_FLAGS := $(GENCODE_SM35) $(GENCODE_SM50)
After making the changed you should probably also do a ./build.sh clean and then a new build.
但是build不成功,恐怕还是要换显卡。不过对cuda-convnet2还是更熟悉了一些,主要通过配置layer参数来使用,还是很方便的。