Windows 10 + VS2013 编译 Caffe
来源:互联网 发布:苹果电脑数据恢复 编辑:程序博客网 时间:2024/05/22 04:39
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.exe
- cudnn-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 clone
fetches 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.gitgit branch -a #check all the branchesgit 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
My CommonSettings.props
is 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
- Compile
libcaffe
first - Compile
caffe
next - 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/51722983
- https://github.com/BVLC/caffe/issues/489
- Windows 10 + VS2013 编译 Caffe
- 【caffe-Windows】caffe+VS2013+Windows无GPU编译caffe框架
- VS2013下安装&编译Windows Caffe
- VS2013下安装&编译Windows Caffe
- caffe-windows VS2013编译 无GPU
- Windows下VS2013编译Caffe完全手册
- Windows+VS2013爆详细Caffe编译安装教程
- Windows+VS2013爆详细Caffe编译安装教程
- Windows+VS2013爆详细Caffe编译安装教程
- Windows+VS2013爆详细Caffe编译安装教程
- 编译caffe windows vs2013 Nuget 无法下载 依赖包
- 转 Windows+VS2013爆详细Caffe编译安装教程
- Windows+VS2013+cuda7.5爆详细Caffe编译安装教程
- windows caffe vs2013 安装
- caffe windows+vs2013安装
- 基于chyh1990/caffe-compact在windows vs2013上编译caffe步骤
- 用Visual Studio 2013(VS2013)调用Caffe(注意:不是编译Windows版的Caffe)
- 【caffe】windows下caffe+vs2013+python2.7+cuda8.0+cmake3.8编译与配置
- MirrorOfBinaryTree
- build only device cannot be used to run this target问题
- c#实现每隔一段时间执行代码(多线程)
- SQL Server 求指定日期的上季尾日的起始点(比如入参日2016-06-30,返回 2016-03-31 00:00:00.000)
- eclipse 设置 中文doc 失败原因
- Windows 10 + VS2013 编译 Caffe
- 开源框架——轻量级缓存框架——ACache(ASimpleCache)
- 关于考试报名系统,随机取准考证号的问题
- EditText实现话题选择
- 2015年最全的移动WEB前端UI框架
- java 知识点13
- ReactJS
- 注释禁止Format格式化
- SQL基础知识(一)