Visual Studio 2015+cuda8.0+cudnn5 configuration caffe-windows (BLVC)

Source: Internet
Author: User

Consolidated Source: angle_cal 2016-12-19 17:32 624 ℃ 0 Reviews

The BLVC version of Caffe-windows already supports visual Studio 2015, and the following configuration process is integrated with the experience of others and is validated to ensure effectiveness.

  1. Download Caffe-windows (BLVC)
    : GitHub
    Download good unzip.
  2. install vs2015,cuda,cudnn,anaconda,cmake 
    VS2015  
    Installation Please do it yourself, you need to note:  
    ① If you have previously installed an early-morning VS, then installing VS2015 may cause problems with the original version, so if possible, try to use only the latest version, if you have to co-exist new and old version, the more secure solution is to uninstall the old version first, and then install the VS2015, Then install the earlier version of VS2013,  
    ②vs2015 when installed, the default is to uncheck the C + + language, using the custom installation mode.  
    CUDA  
    Please search CUDA8.0, to the official website of nvidia to download the corresponding version of the operating system, when installed, please turn off anti-virus software or authorized by the Administrator account, the installation process is best to look at it, will do a lot of sensitive operation, if the antivirus software interception, installation will fail.  
    CUDNN  
    Please search CUDNN, also on the official website of nvidia to download, this thing after download is a compressed package, opened after a folder called Cuda. On his handling, the article will mention, Now download the spare.  
    Anaconda  
    This is a Python scientific computing library that integrates many modules and programs to download the corresponding python2/according to the version you want to use. Python3 Anaconda, you do not need to install Python first, if you have previously installed Python, you can completely uninstall it, if you do not want to uninstall, make sure that in the system variables, anaconda variables in front of Python (this is important) . 
    CMake  
    3.7.0 or later versions of the CMake can be, note that in order to avoid unnecessary trouble, we do not use the CMake interface, So please add the directory where the CMake.exe is located to the system variable path.
  3. Download dependencies
    Under (RootDir): \caffe-windows\scripts, there is a Python script: download_prebuilt_dependencies.py, running this script, will download a name called: "/libraries_ V140_X64_PY27_1.0.1.TAR.BZ2 "Compressed package, this package will appear where you run the script, and the script will unzip it, (RootDir): \caffe-windows will appear under a folder called libraries, we (RootDir): \caffe-windows A new folder called "Build", put this libraries folder in.
    If the download is slow, you can use this link to note that the file name actually contains a lot of information, please check, this is not the same as your actual situation, if not the same, please use a script to download.
  4. Confirm Environment Variables

    Note: The environment variables for Anaconda and Cuda are added by the installer itself, and the last side of the build variable requires you to add the 3rd step of the directory, and the CMake variable to add in.
  5. Modify a batch-processing script
    (RootDir): \caffe-windows\scripts has a build_win.cmd script that edits this script:
    The first step:
    Comment out 115 lines-137 lines of all code, add "::" At the beginning of the line to comment out this line.
    Step Two:
    Processing CUDNN;
    Here are two methods, one: the CUDNN compressed package, the Cuda folder in the three subfolders of the files, copied to the corresponding directory Cuda, Cuda's installation directory is: "C:\Program files\nvidia GPU Computing toolkit\cuda\v8.0 ", using this method, when the program needs to use CUDNN, we do not need to do any processing to find the CUDNN library, because it exists in the Cuda directory, and Cuda's variables are installed at the time of the automatic configuration.
    Method Two: In the above script 143 lines-155 lines that piece (below), add Cudnn directory:
:: Configure using CMake and using the Caffe-builder dependencies:: Add-dcudnn_root=c:/projects/caffe/cudnn-8.0-windows 10-x64-v5.1/cuda ^:: Below to use CuDNN cmake-g "! cmake_generator! "^-dblas=Open ^-Dcmake_build_type: string=%cmake_config% ^-Dbuild_shared_libs:bool=%cmake_build_shared_libs% ^- Dbuild_python:bool=%build_python% ^- Dbuild_python_layer:bool=%build_python_layer% ^-dbuild_matlab:bool=%build_matlab% ^-dcpu_only:bool=%cpu_only% ^- dcudnn_root=c:\projects\cuda ^:: Above line is CUDNN directory-c%cd%\libraries\ Caffe-builder-config.cmake ^ %~dp0\:         
      1
    • 2
    • 3
    • 4
    • 5
    • 6

With this method, if the problem occurs at a later step, delete the code, and then use method one.
6. Call CMake to build the solution
In (RootDir): Open the command-line window in the \caffe-windows\build (press Shift right-click the File Manager blank, select "Open command line Here"), run Build_win.cmd, if the above operation is not a problem, Then this step will call the CMake build solution, please look at the first output of those information, if the use of the compiler is VC140, will generate VS2015 solution.
7. Use vs to open the solution
Wait for the above script to complete, a Caffe.sln will appear in the build, and the solution can be opened directly using VS2015.

8. Other precautions
① do not refer to VS2013 's relevant experience to configure Caffe on VS2015, do not use the Microsoft version, be sure to use the BLVC version.
② Why use VS2015? Use this method to configure the Caffe, do not need to manage nuget package, and even if you want to use NUGET,VS2015 Package Manager is also more useful than VS2013, if you need to modify the Caffe source code or to read the source code frequently, Then I recommend you to use VS2015, and there is a very important thing: since the new can use so why use the old?
③python2 and Python3 can be used, if you're running a Python script that prompts you for some packages that you can't find, install anaconda and make sure Anaconda is ranked higher in the environment variables than Python, or unload python directly.
④ If you must use the CMake interface and encounter attributes that are not filled in, see the files in the Build_win.cmd script.
⑤ If you want to change something, whether you use the GPU, whether you support MATLAB, and so on, now there are two ways: one is to directly define the C + + preprocessor, the other is to modify the call CMake the script, directly generate a special version you want, the method of modifying the configuration file may not work , because these projects did not load the Commonsettings.props file at all.

Visual Studio 2015+cuda8.0+cudnn5 configuration caffe-windows (BLVC)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.