cuSVM is a CUDA implementation of support vector classification and regression. Recently, I had some questions on a post regarding compiling cuSVM using Visual Studio. Out of curiosity, I downloaded cuSVM and went to work myself.
Now, if you just download cuSVM and open up the Visual Studio solution, you will be a bit dissapointed as it does not compile and is not contained in a CUDA project. In order to correct this, I took the steps listed below. While I encourage you to read the steps and complete this process yourself, you may also download the files used in this project by clicking here.
- Create a new CUDA 4.0 Project called "cuSVMPredict"
- Create a new CUDA 4.0 Project called "cuSVMTrain"
- Add the appropriate files from the original cuSVM project. This is done by copying each file into the correct location on the file system, right-clicking on the project and selecting "Add -> Existing Item...". The files needed include:
- For cuSVMPredict: cuSVMPredict.cpp, cuSVMPredictKernel.cu, PredictModule.def
- For cuSVMTrain: cuSVMTrain.cpp, cuSVMSolver.cu, TrainModule.def
- Copy the "inc" directory into the root of the solution
- Open up the file "cuSVMSolver.cu" in the "cuSVMTrain" project
- Add "using namespace std;" on line 17, after the final include statement
- For each project, right-click on the project and select "Properties"
- Make the following changes:
- Under "Configuration Properties -> General":
- Change "Target Extension" to ".mexw32"
- Change "Configuration Type" to "Dynamic Library (.dll)"
- Under "Configuration Properties -> C/C++ -> General -> Additional Include Directories":
- Add your Matlab include directory (MATLABDIR\extern\include)
- Add "..\inc"
- Add the CUDA GPU Computing SDK include directory. On Windows 7 this is "C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\inc"
- Under "Configuration Properties -> CUDA C/C++ -> Common -> Additional Include Directories":
- Add your Matlab include directory (MATLABDIR\extern\include)
- Add the CUDA GPU Computing SDK include directory. On Windows 7 this is "C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\inc"
- Under "Configuration Properties -> Linker -> General -> Additional Library Directories":
- Add your Matlab include directory (MATLABDIR\extern\lib\win32\microsoft)
- Add the CUDA GPU Computing SDK bin directory. On Windows 7 this is "C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\bin"
- Under "Configuration Properties -> Linker -> Input -> Additional Dependencies":
- Add "cuda.lib"
- Add "cublas.lib"
- Add "libmex.lib"
- Add "libmat.lib"
- Add "libmx.lib"
- Under "Configuration Properties -> General":
- Right-click on the solution and select "Build Solution"
Having completed these steps, you should be good to go.