您好,登录后才能下订单哦!
这篇文章主要介绍了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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。