您好,登錄后才能下訂單哦!
這篇文章主要介紹了caffe如何安裝,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
win10
visual studio 2015
CUDA10.0(caffe官方給出的是CUDA8.0,但是據說只有10.0版本才支持RTX2070、2080、2080Ti)
cudnn 在官網下載與CUDA10.0對應的版本
python3.5-anaconda
caffe官方要求的其他工具
安裝CUDA工具,最好是把系統上其他版本的CUDA刪除掉,到官網下載CUDA10.0以及對應版本的cudnn;
python必須選擇3.5版本,官網FAQ里有鏈接可以下載默認python3.5的安裝包;
anaconda安裝其他工具時,如果網速較慢,可以使用國內的開源鏡像站,如清華大學開源鏡像站;
:: 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=!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 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 )
以上代碼主要修改CPU_ONLY
, WITH_NINJA
, PYTHON_VERSION
,CONDA_ROOT
, 等變量;
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 ^ -DUSE_NCCL:BOOL=!USE_NCCL! ^ -DCUDA_ARCH_NAME:STRING=%CUDA_ARCH_NAME% ^ -DCUDNN_ROOT=C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.0\cuda ^ "%~dp0\.."
以上代碼主要添加一個變量CUDNN_ROOT
;
cmake/cuda.cmake
set(Caffe_known_gpu_archs "30 35 50 60 61 75")
set(__nvcc_out "7.5") # string(REGEX MATCH "([1-9].[0-9])" __nvcc_out "${__nvcc_out}") # string(REPLACE "2.1" "2.1(2.0)" __nvcc_out "${__nvcc_out}") set(CUDA_gpu_detect_output ${__nvcc_out} CACHE INTERNAL "Returned GPU architetures from caffe_detect_gpus tool" FORCE)
主要是添加了一行,注釋了2行;
C:\Users\ducks\.caffe\dependencies\libraries_v140_x64_py35_1.1.0\libraries\include\boost-1_61\boost\config\compiler\nvcc.hpp
// #if !defined(__CUDACC_VER__) || (__CUDACC_VER__ < 70500) // # define BOOST_NO_CXX11_VARIADIC_TEMPLATES // #endif
刪除caffe目錄里面的build
目錄,如果之前編譯失敗了,必須執行這一步。
在caffe目錄執行script\build_win.cmd
感謝你能夠認真閱讀完這篇文章,希望小編分享的“caffe如何安裝”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。