Install and Run cuda-convnet on Windows

转自:http://personal.ie.cuhk.edu.hk/~xy012/others/install_cudaconvnet.html

Install and Run cuda-convnet on Windows OS with VS2010

Xiong Yuanjun

MMLAB, CUHK


Prerequisite

  • CUDA and a supported NVIDIA GPU. At the time of writing this doc, the CUDA version is 5.5. All following instructions will be based on CUDA 5.5.

  • Download cuda-convnet. The project site is on the github. To get the code, you can both download the zip file, or clone from the github using cmd

    git clone https://github.com/dnouri/cuda-convnet.git

  • Python 2.7 and Numpy, I suggest using WinPython on Windows OS. Why? WinPython contains a python console and numpy-mkl module. Besides, it also embeds many useful packages and a scientific computation friendly Python IDE - Spyder. The installation experience is far from painful compared to install python and all packages related. Remember to install the 64-bit version.

  • PThread, for the threading support.
  • Intel C++ Composer for its intel mkl module.
  • The Visual Studio Project, kindly provided by Oriol Vinyals.
  • Other useful tool: Dependency Walker to look into dll problems.

Installation

1. Prepare the Visual Studio Project

  • Put the content of the visual studio project into the source folder of cuda-convnet. However, you may not be able to open the .sln solution file in VS2010. This is resulted from default directories setting.
  • Open pyconvnet.vcxproj with any text editor or xml parser. Since our main execution platform is on a 64-bit windows OS. We only need to modify setting of the profile .
    • Search for this profile label, and modify the directory setting to the actual path on your machine. In my experience, labels needing attention include ,
    • Modify the CUDA version identifier. Search for CUDA 4.0 (the original code was written with cuda 4.0, however we will use cuda 5.5) and modify any occurrence to CUDA 5.5.
    • The dll and lib files may change their names over versions. First look into the depencies and modify the project profile to adapt to these changes.
  • Now you should be able to open the solution in VS2010.

2. Compile the code

  • Rebuild the solution in VS2010. You may come across some errors. Following are some of them, for more help, you can browse the github homepage and its wiki.
    • First set USE_MKL in preprocessor difinition. This enables the mkl support.
    • The compiler may not find the cutil_inline.h. Actually it's missing in newer version of CUDA. Refer to this gist and add the file to the projects' Headers folder.
    • Compilation error: pthread_muted_t undefined. Try add #include in nvmatrix.cuh.
  • After a successful compilation, you will get a .pyd library called pyconvnet.pyd. This is the python module of cuda-convnet.

Run the sample

  • Download the cifar-10 dataset. Put the content into ($ProjectDir$)/storage2/tiny/cifar-10-batches-py-colmajor/. The zip file should contains 6 data files and 1 meta-file.
  • Set PATH in environment variable. You need these 3 dirs.
    • (pthread directory)\Pre-built.2\dll\x64
    • (Intel composer directory)\redist\intel64\mkl
    • (Intel composer directory)\redist\ia32\mkl
  • However, you may still get dll loading fail. So we can directly copy the related dlls into the project folder (not recommended). As unfortunate as me, I copied mkl_intel_thread.dll, pthreadGC2.dll and pthreadVC2.dll.
  • Now let's run the code, type in the command linepython convnet.py --data-path=./storage2/tiny/cifar-10-batches-py-colmajor/ --save-path=./storage2/tmp --test-range=6 --train-range=1-5 --layer-def=./example-layers/layers-19pct.cfg --layer-params=./example-layers/layer-params-19pct.cfg --data-provider=cifar --test-freq=13 --epoch=200
  • This commnd will run the convnet for 200 iterations and get you a learned classifier.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值