Building of vs2015+caffe+python3.5 compiling environment

Source: Internet
Author: User
Tags echo info

Modify the Build_win.cmd as follows:

@echo off@setlocal enabledelayedexpansion:: Default valuesif DEFINED appveyor (echo Setting appveyor defaults if NO T DEFINED msvc_version Set msvc_version=14 if not DEFINED With_ninja set with_ninja=1 if not DEFINED cpu_only set CP    u_only=0 if not DEFINED cuda_arch_name set Cuda_arch_name=auto if not DEFINED cmake_config set cmake_config=release If not DEFINED USE_NCCL set use_nccl=0 if not DEFINED cmake_build_shared_libs set cmake_build_shared_libs=0 if NO T DEFINED python_version Set python_version=3 if not DEFINED Build_python set build_python=1 if not DEFINED build_py Thon_layer set Build_python_layer=1 if not DEFINED Build_matlab set build_matlab=0 if not DEFINED Python_exe set PYT Hon_exe=python if not DEFINED run_tests set run_tests=0 if not DEFINED run_lint set run_lint=0 if not DEFINED RUN _install set run_install=0:: Set python 2.7 with Conda as the default Python if! python_version! EQU 2 (Set Conda_root=d:\miniconda-x64):: Set python 3.5 with Conda as the default Python if! python_version! EQU 3 (Set conda_root=d:\env\anaconda3420) set path=! conda_root!;! conda_root!\scripts;! conda_root!\library\bin;!    path! :: Check that we have the right Python version! python_exe!     --version:: Add The required Channels Conda config--add channels Conda-forge conda config--add channels Willyd :: Update Conda Conda update conda-y:: Download Other required packages Conda install--yes cmake Ninja num  PY scipy protobuf==3.1.0 Six scikit-image pyyaml pydotplus Graphviz if ERRORLEVEL 1 (Echo Error:conda Update or Install failed exit/b 1):: Install Cuda and disable tests if needed if! with_cuda! = = 1 (call%~dp0\appveyor\appveyor_install_cuda.cmd set cpu_only=0 set run_tests=0 set USE_NC      cl=1) Else (set Cpu_only=1):: Disable The tests in debug config if "%cmake_config%" = = "Debug" (  echo disabling tests on appveyor with config = =%cmake_config% set run_tests=0):: Disable linting with PY Thon 3 until we find why the script fails if! python_version!  EQU 3 (set run_lint=0)) Else (:: Change the settings here to match your setup:: Change Msvc_version to Use VS. If not DEFINED msvc_version set msvc_version=14:: Change to 1 to use Ninja generator (builds MUC H faster) If not DEFINED With_ninja set with_ninja=0:: Change to 1 to build Caffe without CUDA support if not DE  Fined Cpu_only set cpu_only=0:: Change to generate CUDA code for one of the following GPU architectures:: [Fermi Kepler Maxwell Pascal all] If the DEFINED cuda_arch_name set Cuda_arch_name=auto:: Change to Debug to build Debu    G. This was only relevant for the Ninja generator the Visual Studio generator would generate both Debug and Release configs If not DEFINED Cmake_config set Cmake_config=release:: Set to 1 to use NCCL if not DEFINED USE_NCCL set use_nccl=0:: Change to 1 to build a caffe.dll if not DEFINED Cmake_build_shared_li BS Set Cmake_build_shared_libs=0:: Change to 3 if using Python 3.5 (only 2.7 and 3.5 is supported) if not DEFINED    Python_version Set python_version=3:: Change these options for your needs. If not DEFINED Build_python set build_python=1 if not DEFINED Build_python_layer set build_python_layer=1 if not DEF ined Build_matlab Set build_matlab=0:: If Python is on your path leave this alone If not DEFINED Python_exe set PYT Hon_exe=python:: Run the tests if not DEFINED run_tests set run_tests=0:: Run lint if not DEFINED run_lint s ET run_lint=0:: Build The install target if not DEFINED Run_install set run_install=0):: Set the appropriate CMake Generator:: Use the exclamation mark! below to delay the:: Expansion of Cmake_generatorif%with_ninja% EQU 0 (if "%msvc_version%" = = "+" (Set Cmake_g Enerator=visual Studio 14 Win64) If "%msvc_version%" = = "(set cmake_generator=visual Studio Win64) if"! cmake_generator! " = = "" (Echo error:unsupported MSVC version exit/b 1)) Else (set Cmake_generator=ninja) echo INFO: = ===========================================================echo INFO:Summary:echo INFO: ========================= ===================================echo info:msvc_version =! Msvc_version!echo Info:with_ninja =! With_ninja!echo Info:cmake_generator = "! cmake_generator! " echo info:cpu_only =! Cpu_only!echo Info:cuda_arch_name =! Cuda_arch_name!echo Info:cmake_config =! Cmake_config!echo INFO:USE_NCCL =! Use_nccl!echo info:cmake_build_shared_libs =! Cmake_build_shared_libs!echo info:python_version =! Python_version!echo Info:build_python =! Build_python!echo Info:build_python_layer =! BUILD_python_layer!echo Info:build_matlab =! Build_matlab!echo Info:python_exe = "! python_exe! " echo info:run_tests =! Run_tests!echo Info:run_lint =! Run_lint!echo Info:run_install =! Run_install!echo INFO: ============================================================:: Build and Exectute the tests:: Don't run the tests with shared libraryif! run_tests! EQU 1 (If%cmake_build_shared_libs% EQU 1 (Echo warning:disabling tests with SHARED library BUILD set run_tests=0)) If not EXIST build mkdir buildpushd Build:: Setup the environement for VS X64set batch_file=! Vs%msvc_version%0comntools!.. \.. \vc\vcvarsall.batcall "%batch_file%" AMD64:: Configure using CMake and using the Caffe-builder dependencies:: Add-dcudnn_ Root=c:/projects/caffe/cudnn-8.0-windows10-x64-v5.1/cuda ^:: Below to use CUDNNCMAKE-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_laye r:bool=%build_python_layer% ^-dbuild_matlab:bool=%build_matlab% ^-dcpu_only:bool=%cpu_only% ^-DCOPY_PRER equisites:bool=1 ^-dinstall_prerequisites:bool=1 ^-duse_nccl:bool=! use_nccl! ^-dcuda_arch_name:string=%cuda_arch_name% ^ "%~dp0\ ..."  If ERRORLEVEL 1 (Echo error:configure failed exit/b 1):: Lintif%run_lint% EQU 1 (cmake--build.--target LINT --config%cmake_config%) If ERRORLEVEL 1 (Echo Error:lint failed exit/b 1):: Build the library and Toolscmake--build . --config%cmake_config%if ERRORLEVEL 1 (Echo Error:build failed exit/b 1):: Build and Exectute the Testsif! run_tests!        EQU 1 (cmake--build.--target runtest--config%cmake_config% if ERRORLEVEL 1 (Echo error:tests failed Exit/b 1) If%build_python% EQU 1 (If%build_python_layer% EQU 1 (:: Run PYTHon tests only in Release build since:: The _caffe module was _caffe-d is debug if "%cmake_config%" = = "Release" (:: Run The Python tests cmake--build.--target pytest If ERROR        Level 1 (Echo Error:python tests failed exit/b 1)) )) If%run_install% EQU 1 (cmake--build.--target INSTALL--config%cmake_config%) popd@endlocal

  

May have an error:

Does not match the generator used Previously:ninja

Delete the generated build folder and restart CMD when you are sure that the settings above are not error-free.

Building of vs2015+caffe+python3.5 compiling environment

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.