Caffe windows編譯

來源:互聯網
上載者:User

標籤:import   mat   ini   1.0   ror   com   lag   proc   label   

一、編譯環境

1.下載caffe windows版源碼

https://github.com/BVLC/caffe/tree/windows

2.CUDA

  CUDA 7.5 or 8.0 (use CUDA 8 if using Visual Studio 2015)

3.cuDNN v5

  將下載的bin,include及lib拷貝到CUDA對應的目錄(我的為:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5)。

4.Matlab

  R2016b(我的版本)

5.Anaconda Python 2.7

  https://conda.io/miniconda.html

  下載後雙擊可執行程式安裝到C:\Miniconda2。

  安裝完畢後啟動cmd.exe,輸入conda list可以看到一些安裝包;

  更新conda包

conda update conda

   安裝numpy

conda install numpy

 

二、編譯

  進入caffe\windows目錄,複製CommonSettings.props.example檔案為CommonSettings.props(粗體字部分為修改處),其內容如下

<?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>true</CpuOnlyBuild>        <UseCuDNN>false</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 4 and 5 are supported -->        <CuDnnPath>$(CUDA_PATH)</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)\lib\x64;$(LibraryPath)</LibraryPath>        <IncludePath>$(CuDnnPath)\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:\Miniconda2</PythonDir>        <LibraryPath>$(PythonDir)\libs;$(LibraryPath)</LibraryPath>        <IncludePath>$(PythonDir)\include;$(PythonDir)\Lib\site-packages\numpy\core;$(IncludePath)</IncludePath>    </PropertyGroup>    <PropertyGroup Condition="‘$(MatlabSupport)‘==‘true‘">        <MatlabDir>C:\Program Files\MATLAB\R2016b</MatlabDir>        <LibraryPath>$(MatlabDir)\extern\lib\win64\microsoft;$(LibraryPath)</LibraryPath>        <IncludePath>$(MatlabDir)\extern\include;$(MatlabDir)\toolbox\distcomp\gpu\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>

 

  

Caffe windows編譯

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.