Windows 10 + VS2013 编译 Caffe
2016-08-18 12:06
549 查看
Prerequisites
NVidia Geforece 840M (any CUDA supported cards)Windows 10 Home
Matlab (optional, R2012b)
Anaconda python (optional, python 2.7)
Git
Pre-installs
cuda_7.5.18_win10.execudnn-7.0-win-x64-v4.0-prod.zip
Note: Caffe doesn’t support cudnn v5.0 yet, install v4.0 instead, otherwise you will get complaints.
Clone
By default,git clonefetches all the branches on the remote repository, so first clone the sources, and switch to the branch
windows.
git clone https://github.com/BVLC/caffe.git git branch -a #check all the branches git checkout windows
Dependencies
The following dependency packages will be automatically fetched from Internet by NuGet when you start build the project.LevelDB-vc120.1.2.0.0
boost_thread-vc120.1.59.0.0
OpenBLAS.0.2.14.1
gflags.2.1.2.1
OpenCV.2.4.10
glog.0.3.3.0
boost.1.59.0.0
hdf5-v120-complete.1.8.15.2
boost_chrono-vc120.1.59.0.0
lmdb-v120-clean.0.9.14.0
boost_date_time-vc120.1.59.0.0
protobuf-v120.2.6.1
boost_filesystem-vc120.1.59.0.0
protoc_x64.2.6.1
boost_python2.7-vc120.1.59.0.0
repositories.config
boost_system-vc120.1.59.0.0
After downloading is complete, check these packages here, right-click the project,
Manage NuGet Packages.
Configs
MyCommonSettings.propsis as follows, the differences from the
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros"> <BuildDir>$(SolutionDir)..\Build</BuildDir> <!--NOTE: CpuOnlyBuild and UseCuDNN flags can't be set at the same time.--> <CpuOnlyBuild>false</CpuOnlyBuild> <UseCuDNN>true</UseCuDNN> <CudaVersion>7.5</CudaVersion> <!-- NOTE: If Python support is enabled, PythonDir (below) needs to be set to the root of your Python installation. If your Python installation does not contain debug libraries, debug build will not work. --> <PythonSupport>true</PythonSupport> <!-- NOTE: If Matlab support is enabled, MatlabDir (below) needs to be set to the root of your Matlab installation. --> <MatlabSupport>true</MatlabSupport> <CudaDependencies></CudaDependencies> <!-- Set CUDA architecture suitable for your GPU. Setting proper architecture is important to mimize your run and compile time. --> <CudaArchitecture>compute_35,sm_35;compute_52,sm_52</CudaArchitecture> <!-- CuDNN 3 and 4 are supported --> <CuDnnPath></CuDnnPath> <ScriptsDir>$(SolutionDir)\scripts</ScriptsDir> </PropertyGroup> <PropertyGroup Condition="'$(CpuOnlyBuild)'=='false'"> <CudaDependencies>cublas.lib;cuda.lib;curand.lib;cudart.lib</CudaDependencies> </PropertyGroup> <PropertyGroup Condition="'$(UseCuDNN)'=='true'"> <CudaDependencies>cudnn.lib;$(CudaDependencies)</CudaDependencies> </PropertyGroup> <PropertyGroup Condition="'$(UseCuDNN)'=='true' And $(CuDnnPath)!=''"> <LibraryPath>$(CuDnnPath)\cuda\lib\x64;$(LibraryPath)</LibraryPath> <IncludePath>$(CuDnnPath)\cuda\include;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup> <OutDir>$(BuildDir)\$(Platform)\$(Configuration)\</OutDir> <IntDir>$(BuildDir)\Int\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir> </PropertyGroup> <PropertyGroup> <LibraryPath>$(OutDir);$(CUDA_PATH)\lib\$(Platform);$(LibraryPath)</LibraryPath> <IncludePath>$(SolutionDir)..\include;$(SolutionDir)..\include\caffe\proto;$(CUDA_PATH)\include;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(PythonSupport)'=='true'"> <PythonDir>C:\Program Files\Anaconda</PythonDir> <LibraryPath>$(PythonDir)\libs;$(LibraryPath)</LibraryPath> <IncludePath>$(PythonDir)\include;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(MatlabSupport)'=='true'"> <MatlabDir>C:\Program Files\MATLAB\R2012b</MatlabDir> <LibraryPath>$(MatlabDir)\extern\lib\win64\microsoft;$(LibraryPath)</LibraryPath> <IncludePath>$(MatlabDir)\extern\include;$(IncludePath)</IncludePath> </PropertyGroup> <ItemDefinitionGroup Condition="'$(CpuOnlyBuild)'=='true'"> <ClCompile> <PreprocessorDefinitions>CPU_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(UseCuDNN)'=='true'"> <ClCompile> <PreprocessorDefinitions>USE_CUDNN;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <CudaCompile> <Defines>USE_CUDNN</Defines> </CudaCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(PythonSupport)'=='true'"> <ClCompile> <PreprocessorDefinitions>WITH_PYTHON_LAYER;BOOST_PYTHON_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(MatlabSupport)'=='true'"> <ClCompile> <PreprocessorDefinitions>MATLAB_MEX_FILE;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup> <ClCompile> <MinimalRebuild>false</MinimalRebuild> <MultiProcessorCompilation>true</MultiProcessorCompilation> <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;USE_OPENCV;USE_LEVELDB;USE_LMDB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <TreatWarningAsError>true</TreatWarningAsError> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <Optimization>Full</Optimization> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> <GenerateDebugInformation>true</GenerateDebugInformation> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> </Link> </ItemDefinitionGroup> </Project>
Compilation
Compilelibcaffefirst
Compile
caffenext
Build Solution or compile the rest.
Troubleshooting
pyconfig.h: No such file or directory
Set Anaconda path in
CommonSettings.prop
<PropertyGroup Condition="'$(PythonSupport)'=='true'"> <PythonDir>C:\Program Files\Anaconda</PythonDir> <LibraryPath>$(PythonDir)\libs;$(LibraryPath)</LibraryPath>
The builds tools for v140 (Platform Toolset = 'v140') cannot be found
It might be caused by building caffe with vs2015 first, change it here,
Configuration Properties > General > Platform Toolset > Visual Studio 2013 (v120)
PyObject
Set False to “Treat Warnings As Errors”, it is here
Configuration Properties > C/C++ > General > Treat Warnings As Errors
References
http://blog.csdn.net/tina_ttl/article/details/51722983https://github.com/BVLC/caffe/issues/489
相关文章推荐
- window下编译Caffe时(Windows10+Caffe+CUDA7.5+VS2013)注意事项
- windows10+cuda8.0+cudnn5.1+vs2013下编译caffe
- Windows10+Caffe+CUDA7.5+VS2013环境配置
- Windows10+VS2013环境下Dlib库的编译与使用
- Windows 下(VS2013)编译 Caffe Fast RCNN (CPU Only)
- win10+VS2013编译caffe的common.cpp错误error C4996: ‘getpid': The POSIX name for this item is deprecated.
- caffe-windows VS2013编译 无GPU
- Windows10+Caffe+CUDA7.5+VS2013环境配置
- Windows下VS2013编译Caffe完全手册
- Windows 10 下 VS2013 和 matlab2015b 编译 vlfeat-0.9.20 图文详细版
- Windows 7+VS2013将caffe编译成动态链接库并进行调用
- 【caffe】windows下vs2013+opencv3.2.0+opencv_contrib(包含dnn)+cmake3.8编译与配置
- 用Visual Studio 2013(VS2013)调用Caffe(注意:不是编译Windows版的Caffe)
- Windows+VS2013爆详细Caffe编译安装教程
- 基于chyh1990/caffe-compact在windows vs2013上编译caffe步骤
- windows7下cygwin+vs2013编译webkit源码
- Win10+VS2013编译OSG3.4
- Windows 7 64位下caffe配置cuda7.5 VS2013
- Windows下用VS2013加载caffemodel做图像分类