您的位置:首页 > 其它

Compiling Cuda-convnet based CUDA5 on Visual Studio 2010/2012

2013-12-20 11:56 387 查看




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
with
helper_cuda.h
in
all C++ files
Replace
cutilCheckMsg
with
getLastCudaError
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
and
Py_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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐