Revision 4d01302e738b587dc98161fd7e664888c377a093 authored by Jacob DeWitt on 02 November 2017, 22:09:05 UTC, committed by Jacob DeWitt on 11 November 2017, 20:38:57 UTC
CNTKLibraryCAPI.h defines the interface that is exported from the DLL or shared object.
EvaluatorCAPI.cpp implements the functions defined by CNTKLibraryCAPI.h. In most cases, it delegates the actual work to the evaluator wrapper class in EvaluatorWrapper.cpp by casting the handle passed as the first argument to an instance of that class.
These functions need to catch all exceptions and convert them to error codes. Some error codes for this API are defined in CNTKLibraryCAPI.h

some more small changes

Split EvaluatorWrapper class into separate file.

more changes
1 parent 16a41ce
Raw File
CNTK.Cpp.props
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(SolutionDir)\CNTK.Common.props" />
  <PropertyGroup>
    <CudaVersion />
    <CudaVersion Condition="Exists('$(CUDA_PATH_V8_0)') And '$(CudaVersion)' == ''">8.0</CudaVersion>
    <CudaVersion Condition="Exists('$(CUDA_PATH_V7_5)') And '$(CudaVersion)' == ''">7.5</CudaVersion>

    <NvmlInclude />
    <NvmlInclude Condition="'$(CudaVersion)' == '7.5'">"c:\Program Files\NVIDIA Corporation\GDK\gdk_win7_amd64_release\nvml\include"</NvmlInclude>
    <NvmlInclude Condition="'$(CudaVersion)' == '8.0'" />

    <NvmlLibPath />
    <NvmlLibPath Condition="'$(CudaVersion)' == '7.5'">"c:\Program Files\NVIDIA Corporation\GDK\gdk_win7_amd64_release\nvml\lib"</NvmlLibPath>
    <NvmlLibPath Condition="'$(CudaVersion)' == '8.0'" />

    <NvmlDll>%ProgramW6432%\NVIDIA Corporation\NVSMI\nvml.dll</NvmlDll>
    <NvmlDll Condition="Exists('c:\local\bindrop\NVSMI\nvml.dll')">c:\local\bindrop\NVSMI\nvml.dll</NvmlDll>

    <HasOpenCv>false</HasOpenCv>
    <HasOpenCv Condition="Exists('$(OPENCV_PATH)') Or Exists('$(OPENCV_PATH_V31)')">true</HasOpenCv>
    
    <HasProtobuf>false</HasProtobuf>
    <HasProtobuf Condition="Exists('$(PROTOBUF_PATH)')">true</HasProtobuf>

    <HasBoost>false</HasBoost>
    <HasBoost Condition="Exists('$(BOOST_INCLUDE_PATH)') And Exists('$(BOOST_LIB_PATH)')">true</HasBoost>

    <UseZip>false</UseZip>
    <UseZip Condition="Exists('$(ZLIB_PATH)')">true</UseZip>

    <HasMultiverso>false</HasMultiverso>
    <HasMultiverso Condition="Exists('$(SolutionDir)\Source\Multiverso\include\multiverso')">true</HasMultiverso>

    <IsUWP>false</IsUWP>
    <IsUWP Condition="'$(Configuration)'=='Debug_UWP' Or '$(Configuration)'=='Release_UWP'">true</IsUWP>
    <OutputSuffix Condition="!$(IsUWP)"/>

  </PropertyGroup>

  <PropertyGroup Condition="$(IsUWP)">
    <MathLibrary>OpenBLAS</MathLibrary>
    <CNTKCustomOpenBLASVersion>2</CNTKCustomOpenBLASVersion>
    <MathLibraryName>OpenBLAS library (Version: $(CNTKCustomOpenBLASVersion))</MathLibraryName>
    <CNTKCustomOpenBLASPath>$(CNTK_OPENBLAS_PATH)\$(CNTKCustomOpenBLASVersion)</CNTKCustomOpenBLASPath>    
    <MathIncludePath>$(CNTKCustomOpenBLASPath)</MathIncludePath>
    <MathLibraryPath>$(CNTKCustomOpenBLASPath)\lib\x64\RELEASE</MathLibraryPath>
    <MathDefine>USE_OPENBLAS;OS_WINNT;ARCH_X86_64;C_MSVC</MathDefine>
    <MathLinkLibrary>libopenblas.lib</MathLinkLibrary>
    <MathDelayLoad>libopenblas.dll</MathDelayLoad>
    <MathPostBuildCopyPattern>$(MathLibraryPath)\*.dll</MathPostBuildCopyPattern>
    <OutputSuffix>_app</OutputSuffix>
    <AppContainerApplication>true</AppContainerApplication>
    <ApplicationType>Windows Store</ApplicationType>
    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
    <WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
    <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
    <DefaultLanguage>en-US</DefaultLanguage>
  </PropertyGroup>

  <PropertyGroup>
    <!-- If an executable links Cntk.Reader-$(CntkComponentVersion).lib, it has dependency on Cntk.Common.dll, Cntk.Math.dll and Cntk.PerformanceProfiler.dll -->
    <ReaderLibs>Cntk.Reader$(OutputSuffix)-$(CntkComponentVersion).lib;Cntk.Common$(OutputSuffix)-$(CntkComponentVersion).lib;Cntk.Math$(OutputSuffix)-$(CntkComponentVersion).lib;</ReaderLibs>
  </PropertyGroup>

  <PropertyGroup Condition="!$(IsUWP)">
    <MathLibrary>MKL</MathLibrary>
    <CNTKCustomMKLVersion>3</CNTKCustomMKLVersion>
    <CNTKCustomMKLPath>$(CNTK_MKL_PATH)\$(CNTKCustomMKLVersion)</CNTKCustomMKLPath>
    <MathIncludePath>$(CNTKCustomMKLPath)\include</MathIncludePath>
    <MathDefine>USE_MKL</MathDefine>
    <!-- Only non-UWP configurations consume PerformanceProfiler -->
    <ReaderLibs>Cntk.PerformanceProfiler-$(CntkComponentVersion).lib;$(ReaderLibs)</ReaderLibs>
  </PropertyGroup>

  <PropertyGroup Condition="!$(IsUWP) And '$(CNTK_MKL_SEQUENTIAL)' != '1'">
    <MathLibraryName>CNTK custom MKL Parallel (Version: $(CNTKCustomMKLVersion))</MathLibraryName>
    <MathLibraryPath>$(CNTKCustomMKLPath)\x64\parallel</MathLibraryPath>
    <MathLinkLibrary>mkl_cntk_p.lib</MathLinkLibrary>
    <MathDelayLoad>mkl_cntk_p.dll</MathDelayLoad>
    <MathPostBuildCopyPattern>$(MathLibraryPath)\*.dll</MathPostBuildCopyPattern>
    <UnitTestDlls>$(OutDir)mkl_cntk_p.dll;$(OutDir)libiomp5md.dll;</UnitTestDlls>
  </PropertyGroup>
  <PropertyGroup Condition="!$(IsUWP) And '$(CNTK_MKL_SEQUENTIAL)' == '1'">
    <MathLibraryName>CNTK custom MKL Sequential (Version: $(CNTKCustomMKLVersion))</MathLibraryName>
    <MathLibraryPath>$(CNTKCustomMKLPath)\x64\sequential</MathLibraryPath>
    <MathLinkLibrary>mkl_cntk_s.lib</MathLinkLibrary>
    <MathDelayLoad>mkl_cntk_s.dll</MathDelayLoad>
    <MathPostBuildCopyPattern>$(MathLibraryPath)\*.dll</MathPostBuildCopyPattern>
    <UnitTestDlls>$(OutDir)mkl_cntk_s.dll;</UnitTestDlls>
  </PropertyGroup>

  <PropertyGroup Condition="$(UseZip)">
    <ZipInclude>$(ZLIB_PATH)\include;$(ZLIB_PATH)\lib\libzip\include;</ZipInclude>
    <ZipDefine>USE_ZIP</ZipDefine>
    <ZipLibPath>$(ZLIB_PATH)\lib;</ZipLibPath>
    <ZipLibs>zlib.lib;zip.lib;</ZipLibs>
  </PropertyGroup>

  <PropertyGroup Condition="Exists('$(OPENCV_PATH)')">
    <OpenCvPath>$(OPENCV_PATH)</OpenCvPath>
    <OpenCvVersion>300</OpenCvVersion>
  </PropertyGroup>

  <PropertyGroup Condition="Exists('$(OPENCV_PATH_V31)')">
    <OpenCvPath>$(OPENCV_PATH_V31)</OpenCvPath>
    <OpenCvVersion>310</OpenCvVersion>
  </PropertyGroup>

  <PropertyGroup Condition="$(HasOpenCv)">
    <OpenCvInclude>$(OpenCvPath)\include;</OpenCvInclude>
    <OpenCvWorld Condition="$(ReleaseBuild)">opencv_world$(OpenCvVersion)</OpenCvWorld>
    <OpenCvWorld Condition="$(DebugBuild)">opencv_world$(OpenCvVersion)d</OpenCvWorld>
    <OpenCvLib>$(OpenCvWorld).lib</OpenCvLib>
    <OpenCvLibPath>$(OpenCvPath)\x64\vc14\lib</OpenCvLibPath>
    <OpenCvBinPath>$(OpenCvPath)\x64\vc14\bin</OpenCvBinPath>
  </PropertyGroup>

  <PropertyGroup Condition="$(HasProtobuf)">
    <ProtobufInclude>$(PROTOBUF_PATH)\include;</ProtobufInclude>
    <ProtobufLibPath>$(PROTOBUF_PATH)\lib;</ProtobufLibPath>
    <ProtobufLib Condition="$(ReleaseBuild)">libprotobuf.lib</ProtobufLib>
    <ProtobufLib Condition="$(DebugBuild)">libprotobufd.lib</ProtobufLib>
  </PropertyGroup>

  <PropertyGroup Condition="'$(CudaVersion)' == '8.0'">
    <CudaPath>$(CUDA_PATH_V8_0)</CudaPath>
    <CudaRuntimeDll>cudart64_80.dll</CudaRuntimeDll>
    <CudaDlls>cublas64_80.dll;cusparse64_80.dll;curand64_80.dll;$(CudaRuntimeDll)</CudaDlls>

<!-- Use NvidiaCompute to define nvcc target architectures (will generate code to support them all, i.e. fat-binary, in release mode)
    In debug mode we only include cubin/PTX for 30 and rely on PTX / JIT to generate the required native cubin format
    http://docs.nvidia.com/cuda/pascal-compatibility-guide/index.html#building-applications-with-pascal-support -->
    <NvidiaCompute Condition="$(DebugBuild)">$(CNTK_CUDA_CODEGEN_DEBUG)</NvidiaCompute>
    <NvidiaCompute Condition="$(DebugBuild) And '$(NvidiaCompute)'==''">compute_30,sm_30</NvidiaCompute>
 
    <NvidiaCompute Condition="$(ReleaseBuild)">$(CNTK_CUDA_CODEGEN_RELEASE)</NvidiaCompute>
    <NvidiaCompute Condition="$(ReleaseBuild) And '$(NvidiaCompute)'==''">compute_30,sm_30;compute_35,sm_35;compute_50,sm_50;compute_60,sm_60;compute_61,sm_61</NvidiaCompute>
  </PropertyGroup>

  <PropertyGroup Condition="'$(CudaVersion)' == '7.5'">
    <CudaPath>$(CUDA_PATH_V7_5)</CudaPath>
    <CudaRuntimeDll>cudart64_75.dll</CudaRuntimeDll>
    <CudaDlls>cublas64_75.dll;cusparse64_75.dll;curand64_75.dll;$(CudaRuntimeDll)</CudaDlls>

    <NvidiaCompute Condition="$(DebugBuild)">$(CNTK_CUDA_CODEGEN_DEBUG)</NvidiaCompute>
    <NvidiaCompute Condition="$(DebugBuild) And '$(NvidiaCompute)'==''">compute_30,sm_30</NvidiaCompute>
 
    <NvidiaCompute Condition="$(ReleaseBuild)">$(CNTK_CUDA_CODEGEN_RELEASE)</NvidiaCompute>
    <NvidiaCompute Condition="$(ReleaseBuild) And '$(NvidiaCompute)'==''">compute_30,sm_30;compute_35,sm_35;compute_50,sm_50</NvidiaCompute>
  </PropertyGroup>

  <PropertyGroup>
    <CudaLibs>cudart.lib;cublas.lib;cusparse.lib;curand.lib</CudaLibs>
    <CudaInclude>$(CudaPath)\include</CudaInclude>
    <CudaLibPath>$(CudaPath)\lib\$(Platform)</CudaLibPath>

    <CudaMsbuildPath Condition="'$(CudaMsbuildPath)' == ''">$(VCTargetsPath)\BuildCustomizations</CudaMsbuildPath>
  </PropertyGroup>

  <!-- TODO warn if ConfigurationType not (yet) defined -->

  <PropertyGroup Condition="'$(ConfigurationType)' == 'StaticLibrary'">
    <UseDebugLibraries>$(DebugBuild)</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>$(ReleaseBuild)</WholeProgramOptimization>
    <LinkIncremental>$(DebugBuild)</LinkIncremental>
  </PropertyGroup>

  <ItemDefinitionGroup>
    <ClCompile>
      <PreprocessorDefinitions>CNTK_COMPONENT_VERSION="$(CntkComponentVersion)"</PreprocessorDefinitions>
      <!-- UWP does not use MPI -->
      <PreprocessorDefinitions Condition="!$(IsUWP)">%(PreprocessorDefinitions);HAS_MPI=1</PreprocessorDefinitions>
    </ClCompile>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="$(IsUWP)">
    <ClCompile>
      <CompileAsWinRT>false</CompileAsWinRT>
      <PreprocessorDefinitions>CNTK_UWP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
    <Link Condition="$(ReleaseBuild)">
      <AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
    </Link>
    <Link Condition="$(DebugBuild)">
      <AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
    </Link>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="'$(ConfigurationType)' == 'StaticLibrary'">
    <ClCompile>
      <WarningLevel>Level4</WarningLevel>
      <TreatWarningAsError>true</TreatWarningAsError>
      <SDLCheck>true</SDLCheck>
      <OpenMPSupport>true</OpenMPSupport>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="'$(ConfigurationType)' == 'StaticLibrary' And $(DebugBuild)">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
    <Link>
      <StackReserveSize>100000000</StackReserveSize>
    </Link>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="$(ReleaseBuild) And !$(NoOptBuild)">
    <ClCompile>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <Profile>true</Profile>
    </Link>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="$(NoOptBuild)">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <FunctionLevelLinking>false</FunctionLevelLinking>
      <IntrinsicFunctions>false</IntrinsicFunctions>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>false</EnableCOMDATFolding>
      <OptimizeReferences>false</OptimizeReferences>
      <Profile>false</Profile>
    </Link>
  </ItemDefinitionGroup>

  <PropertyGroup Condition="$(NoOptBuild)" Label="Configuration">
    <UseDebugLibraries>false</UseDebugLibraries>
    <WholeProgramOptimization>false</WholeProgramOptimization>
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>

</Project>
back to top