Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by the Berkeley Vision and Learning Center (BVLC) and by community contributors. Yangqing Jia created the project during his PhD at UC Berkeley. Caffe is released under the BSD 2-Clause license. In this tutorial I’ll show you how to compile Caffe with support from nVIDIA’s GPU computing capabilities, CUDA and CUDA Neural Network on a Windows 10-x64 machine.
In order to successfully build Caffe from source, you will need to meet the following prerequisites:
Microsoft Visual Studio 2013
You should have Microsoft Visual Stduio 2013 (which currently is the only version that CUDA 7.5 has compatibility with). Any edition (as long as it is VS2013 with MSVC12 compiler) will work, but if you do not have any of the professional/paid versions, you can simply get the free Community Edition from HERE. You need to have it installed before continuing with the rest of build process, because CUDA 7.5 at this moment only works with this version of Visual Studio and it DOES NOT work with Visual Studio 2015 or later (unless nVIDIA updates its NSIGHT package).
NVIDIA CUDA Toolkit 7.5
You need to install CUDA 7.5 from HERE. Please note that if you are a hardcore gamer ( like myself 😀 ) make sure that uncheck the suggested driver versions since they are really outdated. If you do not care about gaming, you can go ahead and install the drivers which are included with the CUDA installer, as it is necessary to allow the installation of GPU Deployment Kit (which is NOT necessary to build Caffe, just saying!)
After successful installation of CUDA 7.5, make sure that the following environment variables have been added to your system. Double check the correctness of the paths (just to be sure…for comparison, you can see the values which I have in my own system):
CUDA_PATH => C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
CUDA_PATH_V7_5 => C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
NVIDIA CUDA Neural Network Library 4
You will need nVIDIA’s CUDA Neural Network library version 4 which can be downloaded from HERE. The correct archive file is named cudnn-7.0-win-x64-v4.0-prod.zip. After extraction, this archive file yields a folder named cuda which is indeed quite confusing. But you only need to copy this folder and paste it in your actual CUDA installation folder. Again, in my case, I pasted this folder right into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
Now, pay a visit to your Environment Variables Settings and add the following enteries (replace the given path to the actual place you have installed the CUDA and copied cuda aka cudnn folder into):
CUDNN_PATH => C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
CuDnnPath=> C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5
Somehow if you do not add these two options, the build process will fail, complaining about not being able to fine cudnn.h file. By now, this file should be in the following path if you have followed my guideline:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\cuda\include\cudnn.h
NUGET Command-Line utility
You will need to download many dependencies of Caffe using nuget command line utility which can be downloaded from HERE. I am using version 3.X. Just make sure to put this single exe file somewhere which is known by your Path environment (e.g. make a directory named tools in your C: drive and add that directory to Path).
Do I really need to explain this?!