JUL 06, 2013
Cuda-convnet is a High-performance C++/CUDA implementation of convolutional neural networks. Here is the Project Link.
Cuda-convnet is built for Linux by default. There is no details description or test about compiling the project on Windows. It is said that's possible but not easy to compile and use this code on Windows. Here is a solution for Visual Studio 2010 tested on my local windows pc with GeFore GTX690.
Required Software Installed
Before compile Cuda-convnet for Windows, you should make sure you have:
- Visual Studio 2010/2012
- Python2.7 with numpy
- CUDA5 SDK
- LIBS.zip (This is a zip file including many dll, lib and head file you may need. such as openBLAS and pthread-x64)
Create VC++ Solution
- Download the VS project file here, zipped it; Copy the all cuda-convnet's source code into the zipped project's folder.
- Make sure the configuration type is DLL. Property -> Configuration Properties -> General -> Configuration Type select Dynamic Library(.dll)
- Replace
cutil_inline.h
withhelper_cuda.h
in all C++ files - Replace
cutilCheckMsg
withgetLastCudaError
in all C++ files - Add
#include <helper_image.h>
into include/cudaconv2/conv_util.cuh and include/nvmatrix/nvmatrix.cuh. This is for MIN and MAX macros. - Modify Line31 in include/common/matrixh as below (add
#define NUMPY_INTERFACE
):#define NUMPYINTERFACE #ifdef NUMPYINTERFACE #include #include #endif
- Add
#include <Python.h>
into include/neuron.cuh - Add
#define cutGetMaxGflopsDeviceId() gpuGetMaxGflopsDeviceId()
into src/convnet.cu - In my solution, I use cblas.h instead of MKL. So OpenBLAS is needed. You can download and compile it for VS2010/2012 by MinGW manually or Just use the .dll, .lib and .h file in LIBS.zip
- Replace the dependency on pthreads with pthreads-win32 or Just use the .dll, .lib and .h file in LIBS.zip.
- Property -> Configuration Properties -> C/C++ -> General -> Additional Include Directories may be similar with mine:
C:\Python27\Lib\site-packages\numpy\core\include\numpy;C:\Python27\include;D:\v-yabai\LIBS\Pre-built.2\include;D:\v-yabai\LIBS\include;C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0\common\inc;D:\v-yabai\DNN\cuda-convnet-vs-proj\include\nvmatrix;D:\v-yabai\DNN\cuda-convnet-vs-proj\include\cudaconv2;D:\v-yabai\DNN\cuda-convnet-vs-proj\include\common;D:\v-yabai\DNN\cuda-convnet-vs-proj\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir)
- Property -> Configuration Properties ->Linker -> General -> Additional Library Directories may be similar with mine:
%(AdditionalLibraryDirectories);$(CudaToolkitLibDir)
- Property -> Configuration Properties ->Linker -> Input-> Additional Dependencies may be similar with mine:
C:\Python27\libs\python27.lib;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\lib\x64\cublas.lib;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\lib\x64\cudart.lib;D:\v-yabai\LIBS\libopenblas.lib;D:\v-yabai\LIBS\Pre-built.2\lib\pthreadVSE2.lib;%(AdditionalDependencies)
- Add
MS_NO_COREDLL
andPy_NO_ENABLE_SHARED
in Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions to avoid requiring 'python27_d.lib' - Build for X64 and Enjoy. (TIPS: use Dependency Walker to find the dlls you need, and puts them into vs2010/2012 build output folder)
Posted by WyvernBai Cuda5 , Cuda-convnet , GPU Computing , windows