Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install caffe

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install caffe, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Systems and toolkits

Win10

Visual studio 2015

CUDA10.0 (caffe officially gives CUDA8.0, but it is said that only version 10.0 supports RTX2070, 2080, 2080Ti)

Cudnn downloads the version corresponding to CUDA10.0 on the official website.

Python3.5-anaconda

Other tools required by caffe officials

To install CUDA tools, it is best to delete other versions of CUDA on the system and download CUDA10.0 and the corresponding version of cudnn from the official website.

Python must choose version 3.5. There is a link on the official website FAQ to download the default python3.5 installation package.

When anaconda installs other tools, if the network speed is slow, you can use domestic open source image stations, such as Tsinghua University's open source image station.

Modify the configuration file script/build_win.cmd starting at line 4 Modify as follows: Default values if DEFINED APPVEYOR (echo Setting Appveyor defaults if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14 if NOT DEFINED WITH_NINJA set WITH_NINJA=0 if NOT DEFINED CPU_ONLY set CPU_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 NOT DEFINED PYTHON_VERSION set PYTHON _ VERSION=3 if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1 if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1 if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=0 if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python if NOT DEFINED RUN_TESTS set RUN_TESTS=1 if NOT DEFINED RUN_LINT set RUN_LINT=1 if NOT DEFINED RUN_INSTALL set RUN_INSTALL=1:: Set python 2.7 with conda as the default python if! PYTHON_VERSION! EQU 2 (set CONDA_ROOT=C:\ Miniconda-x64):: Set python 3.5 with conda as the default python if! PYTHON_VERSION! EQU 3 (set CONDA_ROOT=C:\ anaconda) set path routing CONDABUOTROTROOT!\ ScriptsShield CONDAOTROOT!\ 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 numpy 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_NCCL=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 python 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 12 to use VS 2013 if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14:: Change to 1 to use Ninja generator (builds much faster) if NOT DEFINED WITH_NINJA set WITH_NINJA=0:: Change to 1 to build caffe without CUDA support if NOT DEFINED CPU_ONLY set CPU_ONLY=0:: Change to generate CUDA code for one of the following GPU architectures:: [Fermi Kepler Maxwell Pascal All] if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto:: Change to Debug to build Debug. This is only relevant for the Ninja generator the Visual Studio generator will 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_LIBS set CMAKE_BUILD_SHARED_LIBS=0:: Change to 3 if using python 3.5 (only 2.7 and 3.5 are 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 DEFINED BUILD_MATLAB set BUILD_MATLAB=0:: If python is on your path leave this alone if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python:: Run the tests if NOT DEFINED RUN_TESTS set RUN_TESTS=0:: Run lint if NOT DEFINED RUN_LINT set RUN_LINT=0:: Build the install target if NOT DEFINED RUN_INSTALL set RUN_INSTALL=0)

The above code mainly modifies CPU_ONLY, WITH_NINJA, PYTHON_VERSION,CONDA_ROOT, etc.

Line 160, modify as follows:

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% ^ -DCOPY_PREREQUISITES:BOOL=1 ^-DINSTALL_PREREQUISITES:BOOL=1 ^-DUSENCCL _ dp0 _ cudnn-10.0\ cuda ^-DCUDA_ARCH_NAME:STRING=%CUDA_ARCH_NAME% ^-DCUDNN_ROOT=C:\ Program Files\ NVIDIA GPU Computing Toolkit\ cudnn-10.0 ^ "% ~ NCCL\.."

The above code mainly adds a variable CUDNN_ROOT

Modify the file cmake/cuda.cmake

Line 7 is modified as follows:

Set (Caffe_known_gpu_archs "30 35 50 60 61 75")

Line 42 is modified as follows:

Set (_ nvcc_out "7.5") # string (REGEX MATCH" ([1-9]. [0-9]) "_ _ nvcc_out" ${_ nvcc_out} ") # string (REPLACE" 2.1"2.1a)" _ nvcc_out "${_ nvcc_out}") set (CUDA_gpu_detect_output ${_ nvcc_out} CACHE INTERNAL "Returned GPU architetures from caffe_detect_gpus tool" FORCE)

Mainly added one line and commented 2 lines

Modify the file C:\ Users\ ducks\ .caffe\ dependencies\ libraries_v140_x64_py35_1.1.0\ libraries\ include\ boost-1_61\ boost\ config\ compiler\ nvcc.hpp

At the beginning of line 22, several lines are commented out:

/ / # if! defined (_ _ CUDACC_VER__) | | (_ _ CUDACC_VER__ < 70500) / / # define BOOST_NO_CXX11_VARIADIC_TEMPLATES// # endif compilation

Delete the build directory in the caffe directory, which must be performed if the previous compilation failed.

Execute script\ build_win.cmd in the caffe directory

Thank you for reading this article carefully. I hope the article "how to install caffe" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report