CNTK custom MKL support
This commit is contained in:
Родитель
4132eec7f8
Коммит
52ae07279d
|
@ -190,3 +190,7 @@ Source/CNTK/buildinfo.h$$
|
|||
# Unit test output
|
||||
Tests/UnitTests/ReaderTests/Control/**/*_Output.txt
|
||||
Tests/UnitTests/NetworkTests/Output/
|
||||
|
||||
Dependencies/CNTKCustomMKL/Publish
|
||||
Dependencies/CNTKCustomMKL/CNTKCustomMKL-Linux-*.tgz
|
||||
Dependencies/CNTKCustomMKL/CNTKCustomMKL-Windows-*.zip
|
||||
|
|
|
@ -29,6 +29,46 @@
|
|||
|
||||
</PropertyGroup>
|
||||
|
||||
<Choose>
|
||||
<When Condition="Exists('$(ACML_PATH)')">
|
||||
<PropertyGroup>
|
||||
<MathLibraryName>ACML</MathLibraryName>
|
||||
<MathIncludePath>$(ACML_PATH)\include</MathIncludePath>
|
||||
<MathLibraryPath>$(ACML_PATH)\lib</MathLibraryPath>
|
||||
<MathLinkLibrary>libacml_mp_dll.lib</MathLinkLibrary>
|
||||
<MathDelayLoad>libacml_mp_dll.dll</MathDelayLoad>
|
||||
<MathPostBuildCopyPattern>$(ACML_PATH)\lib\*.dll</MathPostBuildCopyPattern>
|
||||
<UnitTestDlls>$(OutDir)libacml_mp_dll.dll;$(OutDir)libifcoremd.dll;$(OutDir)libifportmd.dll;$(OutDir)libiomp*.dll;$(OutDir)libmmd.dll;$(OutDir)svml_dispmd.dll;</UnitTestDlls>
|
||||
<MathDefine>USE_ACML</MathDefine>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
|
||||
<!-- See https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Windows#optional-mkl on how to configure to build CNTK with MKL -->
|
||||
<When Condition="'$(CNTK_MKL)' == '1'">
|
||||
<PropertyGroup>
|
||||
<CNTKCustomMKLVersion>1</CNTKCustomMKLVersion>
|
||||
<CNTKCustomMKLPath>$(CNTK_MKL_PATH)\$(CNTKCustomMKLVersion)</CNTKCustomMKLPath>
|
||||
<MathIncludePath>$(CNTKCustomMKLPath)\include</MathIncludePath>
|
||||
<MathPostBuildCopyPattern>$(MathLibraryPath)\*.dll</MathPostBuildCopyPattern>
|
||||
<MathDefine>USE_MKL</MathDefine>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(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>
|
||||
<UnitTestDlls>$(OutDir)mkl_cntk_p.dll;$(OutDir)libiomp5md.dll;</UnitTestDlls>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(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>
|
||||
<UnitTestDlls>$(OutDir)mkl_cntk_s.dll;</UnitTestDlls>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
|
||||
<PropertyGroup Condition="'$(CudaVersion)' == '7.5'">
|
||||
<CudaPath>$(CUDA_PATH_V7_5)</CudaPath>
|
||||
<CudaRuntimeDll>cudart64_75.dll</CudaRuntimeDll>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
This archive contains header files as well as redistributable components of
|
||||
the Intel (r) Math Kernel Library (Intel (r) MKL).
|
||||
|
||||
Included is also a custom library created out of Intel (r) Math Kernel Library
|
||||
(Intel (r) MKL) required for building the Microsoft Computational Network
|
||||
Toolkit (CNTK). More details on CNTK be found here: http://www.cntk.ai
|
||||
|
||||
Please see LICENSE.md for full license information.
|
|
@ -0,0 +1,24 @@
|
|||
# CNTK custom MKL
|
||||
|
||||
This directory contains the necessary files to create a custom Intel® Math Kernel Library (MKL)
|
||||
for usage by CNTK ("CNTK custom MKL" for short).
|
||||
|
||||
By default, a CNTK binary with Intel® MKL support includes a prebuilt CNTK
|
||||
custom MKL.
|
||||
If you want to build CNTK with Intel® MKL support yourself, you can install a
|
||||
prebuilt CNTK custom MKL, available for separate download from the CNTK
|
||||
downloads page.
|
||||
See [CNTK's setup instructions](https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-your-machine)
|
||||
for more details.
|
||||
|
||||
If you want to add new Intel® MKL functions to be used by CNTK you will have to
|
||||
build your own CNTK custom MKL.
|
||||
This requires you to install the [Intel MKL SDK](https://software.intel.com/en-us/intel-mkl/) for your platform.
|
||||
Then, in this directory,
|
||||
* extend the file `headers.txt` to expose new headers,
|
||||
* extend the file `functions.txt` to expose new functions, and
|
||||
* use `build-linux.sh` or `build-windows.cmd` to build for your platform.
|
||||
|
||||
For further documentation please see the Developer Guide for the Intel® MKL, in particular
|
||||
[Building Custom Shared Objects (Linux)](https://software.intel.com/en-us/node/528533) and
|
||||
[Building Custom Dynamic-link Libraries (Windows)](https://software.intel.com/en-us/node/528362).
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
#
|
||||
# Licensed under the MIT license. See LICENSE.md file in the project root
|
||||
# for full license information.
|
||||
# ==============================================================================
|
||||
#
|
||||
|
||||
# Stop on error, trace commands
|
||||
set -e -x
|
||||
|
||||
# Enter directory the script is located in
|
||||
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
||||
|
||||
# TODO configurable
|
||||
MKLROOT=/opt/intel/compilers_and_libraries_2016.2.181/linux/mkl
|
||||
MKLBUILDERROOT=$MKLROOT/tools/builder
|
||||
CNTKCUSTOMMKLVERSION=$(cat version.txt)
|
||||
|
||||
rm -rf Publish
|
||||
|
||||
mkdir Publish{,/$CNTKCUSTOMMKLVERSION{,/x64}}
|
||||
|
||||
for THREADING in parallel sequential
|
||||
do
|
||||
LIBBASENAME=libmkl_cntk_$(echo $THREADING | cut -c 1)
|
||||
make -f $MKLBUILDERROOT/makefile libintel64 \
|
||||
export=functions.txt \
|
||||
threading=$THREADING \
|
||||
name=$LIBBASENAME \
|
||||
MKLROOT=$MKLROOT
|
||||
mkdir Publish/$CNTKCUSTOMMKLVERSION/x64/$THREADING
|
||||
mv $LIBBASENAME.so Publish/$CNTKCUSTOMMKLVERSION/x64/$THREADING
|
||||
done
|
||||
|
||||
cp -p $MKLROOT/../compiler/lib/intel64_lin/libiomp5.so Publish/$CNTKCUSTOMMKLVERSION/x64/parallel
|
||||
|
||||
rsync -av --files-from headers.txt $MKLROOT/include Publish/$CNTKCUSTOMMKLVERSION/include
|
||||
|
||||
cp -p README-for-redistributable.txt Publish/$CNTKCUSTOMMKLVERSION/README.txt
|
||||
cp -p ../../LICENSE.md Publish/$CNTKCUSTOMMKLVERSION
|
||||
|
||||
cd Publish
|
||||
tar -czf ../CNTKCustomMKL-Linux-$CNTKCUSTOMMKLVERSION.tgz $CNTKCUSTOMMKLVERSION
|
||||
cd ..
|
|
@ -0,0 +1,156 @@
|
|||
@echo off
|
||||
REM
|
||||
REM Copyright (c) Microsoft. All rights reserved.
|
||||
REM
|
||||
REM Licensed under the MIT license. See LICENSE.md file in the project root
|
||||
REM for full license information.
|
||||
REM ==============================================================================
|
||||
REM
|
||||
echo.
|
||||
echo This batch file will build a custom MKL dynamic link library for usage by CNTK.
|
||||
echo.
|
||||
echo Requirements:
|
||||
echo - Intel MKL SDK installed on the machine
|
||||
echo - MKLROOT environment variable is set to the MKL directory inside the Intel MKL SDK
|
||||
echo - Visual Studio 2013 installed and included in the path
|
||||
echo.
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
|
||||
pushd "%~dp0"
|
||||
if errorlevel 1 (
|
||||
echo Could not change directory to script location.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not defined MKLROOT (
|
||||
echo Error: Environment variable MKLROOT is undefined.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%MKLROOT%" (
|
||||
echo Error: Directory doesn't exist: "%MKLROOT%".
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set MKLBUILDERROOT=%MKLROOT%\tools\builder
|
||||
|
||||
if not exist "%MKLBUILDERROOT%" (
|
||||
echo Error: Directory doesn't exist: "%MKLBUILDERROOT%".
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
where /q nmake.exe
|
||||
if errorlevel 1 (
|
||||
echo Error: NMAKE.EXE not in path.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
where /q link.exe
|
||||
if errorlevel 1 (
|
||||
echo Error: LINK.EXE not in path.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set /p CNTKCUSTOMMKLVERSION=<version.txt
|
||||
if not defined CNTKCUSTOMMKLVERSION (
|
||||
echo Cannot determine CNTK custom MKL version.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if exist lib rmdir /s /q lib
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
if exist Publish rmdir /s /q Publish
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
mkdir Publish\%CNTKCUSTOMMKLVERSION%\x64
|
||||
|
||||
echo.
|
||||
echo Copying "%MKLBUILDERROOT%\lib".
|
||||
|
||||
xcopy /s /e /y /i "%MKLBUILDERROOT%\lib" lib
|
||||
if errorlevel 1 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Compiling and copying libraries.
|
||||
|
||||
for %%t in (
|
||||
parallel
|
||||
sequential
|
||||
) do (
|
||||
|
||||
set TFIRSTCHAR=%%t
|
||||
set TFIRSTCHAR=!TFIRSTCHAR:~0,1!
|
||||
set LIBBASENAME=mkl_cntk_!TFIRSTCHAR!
|
||||
|
||||
echo.
|
||||
echo Calling NMAKE libintel64 export=functions.txt threading=%%t name=!LIBBASENAME! MKLROOT="%MKLROOT%".
|
||||
NMAKE /f "%MKLBUILDERROOT%\makefile" ^
|
||||
libintel64 ^
|
||||
export=functions.txt ^
|
||||
threading=%%t ^
|
||||
name=!LIBBASENAME! ^
|
||||
MKLROOT="%MKLROOT%"
|
||||
|
||||
if errorlevel 1 (
|
||||
echo Error: NMAKE.exe for threading=%%t failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
mkdir Publish\%CNTKCUSTOMMKLVERSION%\x64\%%t
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
move !LIBBASENAME!.dll Publish\%CNTKCUSTOMMKLVERSION%\x64\%%t
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
move !LIBBASENAME!.lib Publish\%CNTKCUSTOMMKLVERSION%\x64\%%t
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
del !LIBBASENAME!*
|
||||
if errorlevel 1 exit /b 1
|
||||
@REM TODO manifest?
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Copying libiomp5md.dll.
|
||||
|
||||
copy "%MKLROOT%\..\redist\intel64_win\compiler\libiomp5md.dll" Publish\%CNTKCUSTOMMKLVERSION%\x64\parallel
|
||||
if errorlevel 1 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Removing LIB directory.
|
||||
|
||||
rmdir /s /q lib
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
echo.
|
||||
echo Copying include files to Publish\%CNTKCUSTOMMKLVERSION%\include.
|
||||
|
||||
mkdir Publish\%CNTKCUSTOMMKLVERSION%\include
|
||||
|
||||
for /f %%h in (headers.txt) do (
|
||||
copy "%MKLROOT%\include\%%h" Publish\%CNTKCUSTOMMKLVERSION%\include
|
||||
if errorlevel 1 (
|
||||
echo Failed to copy "%MKLROOT%\include\%%h".
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
copy README-for-redistributable.txt Publish\%CNTKCUSTOMMKLVERSION%\README.txt
|
||||
if errorlevel 1 (
|
||||
echo Failed to copy README.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
copy ..\..\LICENSE.md Publish\%CNTKCUSTOMMKLVERSION%
|
||||
if errorlevel 1 (
|
||||
echo Failed to copy LICENSE.md.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
popd
|
|
@ -0,0 +1,17 @@
|
|||
cblas_dgemm
|
||||
cblas_dasum
|
||||
cblas_daxpy
|
||||
cblas_dcopy
|
||||
cblas_ddot
|
||||
cblas_dnrm2
|
||||
cblas_dscal
|
||||
cblas_sasum
|
||||
cblas_saxpy
|
||||
cblas_scopy
|
||||
cblas_sgemm
|
||||
cblas_sscal
|
||||
cblas_sdot
|
||||
cblas_snrm2
|
||||
dgesvd
|
||||
sgesvd
|
||||
MKL_Set_Num_Threads
|
|
@ -0,0 +1,31 @@
|
|||
mkl_blas.h
|
||||
mkl_cblas.h
|
||||
mkl_df_defines.h
|
||||
mkl_df_functions.h
|
||||
mkl_df_types.h
|
||||
mkl_df.h
|
||||
mkl_dfti.h
|
||||
mkl_direct_call.h
|
||||
mkl_dss.h
|
||||
mkl_lapack.h
|
||||
mkl_lapacke.h
|
||||
mkl_pardiso.h
|
||||
mkl_poisson.h
|
||||
mkl_rci.h
|
||||
mkl_service.h
|
||||
mkl_solvers_ee.h
|
||||
mkl_sparse_handle.h
|
||||
mkl_spblas.h
|
||||
mkl_trans.h
|
||||
mkl_trig_transforms.h
|
||||
mkl_types.h
|
||||
mkl_version.h
|
||||
mkl_vml_defines.h
|
||||
mkl_vml_functions.h
|
||||
mkl_vml_types.h
|
||||
mkl_vml.h
|
||||
mkl_vsl_defines.h
|
||||
mkl_vsl_functions.h
|
||||
mkl_vsl_types.h
|
||||
mkl_vsl.h
|
||||
mkl.h
|
|
@ -0,0 +1 @@
|
|||
1
|
18
LICENSE.md
18
LICENSE.md
|
@ -12,7 +12,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||
|
||||
This project is based on or incorporates material from the projects listed below (Third Party IP). The original copyright notice and the license under which Microsoft received such Third Party IP, are set forth below. Such licenses and notices are provided for informational purposes only. Where permitted, Microsoft licenses the Third Party IP to you under the licensing terms for the Microsoft product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise.
|
||||
|
||||
### a. BOOST C++ LIBRARIES
|
||||
### a. INTEL (R) MATH KERNEL LIBRARY (INTEL (R) MKL)
|
||||
|
||||
CNTK distribution contains Redistributable components of Intel (r) Math Kernel Library (Intel (r) MKL)
|
||||
|
||||
### b. BOOST C++ LIBRARIES
|
||||
|
||||
Copyright Beman Dawes, David Abrahams, 1998-2005.
|
||||
Copyright Rene Rivera 2004-2007.
|
||||
|
@ -27,7 +31,7 @@ The copyright notices in the Software and this entire statement, including the a
|
|||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
### b. ATIS DATASETS
|
||||
### c. ATIS DATASETS
|
||||
|
||||
CNTK distribution contains a subset of ATIS Datasets:
|
||||
|
||||
|
@ -39,23 +43,23 @@ Dahl, Deborah, et al. ATIS3 Test Data LDC95S26. Web Download. Philadelphia: Ling
|
|||
|
||||
Dahl, Deborah, et al. ATIS3 Training Data LDC94S19. Web Download. Philadelphia: Linguistic Data Consortium, 1994.
|
||||
|
||||
### c. TIMIT ACOUSTIC-PHONETIC CONTINUOUS SPEECH CORPUS
|
||||
### d. TIMIT ACOUSTIC-PHONETIC CONTINUOUS SPEECH CORPUS
|
||||
|
||||
CNTK distribution contains a subset of TIMIT Acoustic-Phonetic Continuous Speech Corpus:
|
||||
|
||||
Garofolo, John, et al. TIMIT Acoustic-Phonetic Continuous Speech Corpus LDC93S1. Web Download. Philadelphia: Linguistic Data Consortium, 1993.
|
||||
|
||||
### d. THE PENN TREEBANK PROJECT
|
||||
### e. THE PENN TREEBANK PROJECT
|
||||
|
||||
CNTK distribution contains a subset of the data of The Penn Treebank Project:
|
||||
|
||||
Marcus, Mitchell, Beatrice Santorini, and Mary Ann Marcinkiewicz. Treebank-2 LDC95T7. Web Download. Philadelphia: Linguistic Data Consortium, 1995.
|
||||
|
||||
### e. THE CMU AUDIO DATABASES
|
||||
### f. THE CMU AUDIO DATABASES
|
||||
|
||||
CNTK distribution contains a subset of the CMU Audio Databases
|
||||
Copyright (c) 1991-2005 Carnegie Mellon University. All rights reserved.
|
||||
|
||||
### f. THE MNIST DATABASE OF HANDWRITTEN DIGITS
|
||||
### g. THE MNIST DATABASE OF HANDWRITTEN DIGITS
|
||||
|
||||
CNTK distribution contains a subset of the MNIST Database of Handwritten Digits
|
||||
CNTK distribution contains a subset of the MNIST Database of Handwritten Digits
|
18
Makefile
18
Makefile
|
@ -11,7 +11,11 @@
|
|||
# defaults to release
|
||||
# ACML_PATH= path to ACML library installation
|
||||
# only needed if MATHLIB=acml
|
||||
# MKL_PATH= path to MKL library installation
|
||||
# MKL_PATH= path to CNTK custom MKL installation
|
||||
# only needed if MATHLIB=mkl
|
||||
# CNTK_CUSTOM_MKL_VERSION=2
|
||||
# version for the CNTK custom MKL installation
|
||||
# MKL_THREADING=parallel|sequential
|
||||
# only needed if MATHLIB=mkl
|
||||
# GDK_PATH= path to cuda gdk installation, so $(GDK_PATH)/include/nvidia/gdk/nvml.h exists
|
||||
# defaults to /usr
|
||||
|
@ -131,9 +135,15 @@ ifeq ("$(MATHLIB)","acml")
|
|||
endif
|
||||
|
||||
ifeq ("$(MATHLIB)","mkl")
|
||||
INCLUDEPATH += $(MKL_PATH)/mkl/include
|
||||
LIBPATH += $(MKL_PATH)/compiler/lib/intel64 $(MKL_PATH)/mkl/lib/intel64 $(MKL_PATH)/compiler/lib/mic $(MKL_PATH)/mkl/lib/mic
|
||||
LIBS += -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lm -liomp5 -lpthread
|
||||
INCLUDEPATH += $(MKL_PATH)/$(CNTK_CUSTOM_MKL_VERSION)/include
|
||||
LIBS += -lm
|
||||
ifeq ("$(MKL_THREADING)","sequential")
|
||||
LIBPATH += $(MKL_PATH)/$(CNTK_CUSTOM_MKL_VERSION)/x64/sequential
|
||||
LIBS += -lmkl_cntk_s
|
||||
else
|
||||
LIBPATH += $(MKL_PATH)/$(CNTK_CUSTOM_MKL_VERSION)/x64/parallel
|
||||
LIBS += -lmkl_cntk_p -liomp5 -lpthread
|
||||
endif
|
||||
COMMON_FLAGS += -DUSE_MKL
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
@echo off
|
||||
setlocal enableDelayedexpansion
|
||||
|
||||
::: Copyright (c) Microsoft. All rights reserved.
|
||||
:::
|
||||
::: Licensed under the MIT license. See LICENSE.md file in the project root
|
||||
::: for full license information.
|
||||
::: ==============================================================================
|
||||
:::
|
||||
::: This is called as a pre-build step for the CNTK executable.
|
||||
::: It receives the build's configuration, $(Configuration), as first paramter.
|
||||
::: It creates buildinfo.h, which makes version information available to the executable itself.
|
||||
|
@ -28,9 +34,14 @@ if not errorlevel 1 (
|
|||
)
|
||||
)
|
||||
|
||||
:: For now, math lib is basically hardwired
|
||||
if exist ACML_PATH (
|
||||
echo #define _MATHLIB_ "acml">> buildinfo.h$$
|
||||
if "%CNTK_MKL%" == "1" (
|
||||
if "%CNTK_MKL_SEQUENTIAL%" == "1" (
|
||||
echo #define _MATHLIB_ "mkl-sequential">> buildinfo.h$$
|
||||
) else (
|
||||
echo #define _MATHLIB_ "mkl">> buildinfo.h$$
|
||||
)
|
||||
) else (
|
||||
echo #define _MATHLIB_ "acml">> buildinfo.h$$
|
||||
)
|
||||
|
||||
echo #define _BUILDER_ "%USERNAME%" >> buildinfo.h$$
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" InitialTargets="CheckDependencies" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -31,7 +31,6 @@
|
|||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseIntelMKL>No</UseIntelMKL>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(ReleaseBuild)" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
|
@ -39,8 +38,6 @@
|
|||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseIntelMKL>No</UseIntelMKL>
|
||||
<UseIntelIPP>false</UseIntelIPP>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
|
@ -55,17 +52,17 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ACML_PATH)\include;$(SolutionDir)Source\Common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(MathIncludePath);$(SolutionDir)Source\Common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(ACML_PATH)\lib;$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(MathLibraryPath);$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(DebugBuild)">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>USE_ACML; NO_SYNC; WIN32; _DEBUG; _WINDOWS; _USRDLL; MATH_EXPORTS; %(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>$(MathDefine); NO_SYNC; WIN32; _DEBUG; _WINDOWS; _USRDLL; MATH_EXPORTS; %(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<Optimization>Disabled</Optimization>
|
||||
|
@ -77,13 +74,13 @@
|
|||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libacml_mp_dll.lib;Common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>libacml_mp_dll.dll; $(CudaDlls); %(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<AdditionalDependencies>$(MathLinkLibrary);Common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>$(MathDelayLoad); $(CudaDlls); %(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<Profile>true</Profile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /D /I /Y "$(ACML_PATH)\lib\*.dll" "$(OutputPath)"</Command>
|
||||
<Message>Copying ACML DLLs</Message>
|
||||
<Command>xcopy /D /I /Y "$(MathPostBuildCopyPattern)" "$(OutDir)"</Command>
|
||||
<Message>Copying $(MathLibraryName) DLLs</Message>
|
||||
</PostBuildEvent>
|
||||
<CudaCompile>
|
||||
<TargetMachinePlatform>64</TargetMachinePlatform>
|
||||
|
@ -103,7 +100,7 @@
|
|||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>USE_ACML; NO_SYNC; WIN32; NDEBUG; _WINDOWS; _USRDLL; MATH_EXPORTS; %(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>$(MathDefine); NO_SYNC; WIN32; NDEBUG; _WINDOWS; _USRDLL; MATH_EXPORTS; %(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
|
@ -119,13 +116,13 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>libacml_mp_dll.lib;Common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(MathLinkLibrary);Common.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>$(MathDelayLoad); $(CudaDlls); %(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<Profile>true</Profile>
|
||||
<DelayLoadDLLs>libacml_mp_dll.dll; $(CudaDlls); %(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /D /I /Y "$(ACML_PATH)\lib\*.dll" "$(OutputPath)"</Command>
|
||||
<Message>Copying ACML DLLs</Message>
|
||||
<Command>xcopy /D /I /Y "$(MathPostBuildCopyPattern)" "$(OutDir)"</Command>
|
||||
<Message>Copying $(MathLibraryName) DLLs</Message>
|
||||
</PostBuildEvent>
|
||||
<CudaCompile>
|
||||
<FastMath>true</FastMath>
|
||||
|
@ -155,7 +152,7 @@
|
|||
<PreprocessorDefinitions>CPUONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<DelayLoadDLLs>libacml_mp_dll.dll</DelayLoadDLLs>
|
||||
<DelayLoadDLLs>$(MathDelayLoad)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -167,9 +164,9 @@
|
|||
<ClInclude Include="ConvolutionEngine.h" />
|
||||
<ClInclude Include="ConvolveGeometry.h" />
|
||||
<ClInclude Include="CPUMatrix.h" />
|
||||
<ClInclude Include="CPURNGHandle.h" />
|
||||
<ClInclude Include="CPURNGHandle.h" />
|
||||
<ClInclude Include="MatrixQuantizerImpl.h" />
|
||||
<ClInclude Include="RNGHandle.h" />
|
||||
<ClInclude Include="RNGHandle.h" />
|
||||
<ClInclude Include="TensorOps.h" />
|
||||
<ClInclude Include="TensorView.h" />
|
||||
<None Include="GPUWatcher.cu" />
|
||||
|
@ -193,7 +190,7 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="BatchNormalizationEngine.cpp" />
|
||||
<ClCompile Include="ConvolutionEngine.cpp" />
|
||||
<ClCompile Include="CPURNGHandle.cpp" />
|
||||
<ClCompile Include="CPURNGHandle.cpp" />
|
||||
<ClCompile Include="CPUSparseMatrix.cpp" />
|
||||
<ClCompile Include="CUDAPageLockedMemAllocator.cpp" />
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
|
@ -207,7 +204,7 @@
|
|||
<ClCompile Include="NoGPU.cpp" />
|
||||
<ClCompile Include="Matrix.cpp" />
|
||||
<ClCompile Include="QuantizedMatrix.cpp" />
|
||||
<ClCompile Include="RNGHandle.cpp" />
|
||||
<ClCompile Include="RNGHandle.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
|
@ -218,4 +215,8 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
<Target Name="CheckDependencies">
|
||||
<Error Condition="'$(CNTK_MKL)' == '1' And !Exists('$(CNTKCustomMKLPath)')" Text="CNTK custom MKL not found. See https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Windows#optional-mkl for instructions." />
|
||||
<Error Condition="'$(CNTK_MKL)' != '1' And !Exists('$(ACML_PATH)')" Text="ACML not found. See https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Windows#acml for instructions." />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" InitialTargets="CheckDependencies" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
|
|
|
@ -158,10 +158,10 @@
|
|||
<CuDnnDll Condition="$(GpuBuild) And Exists('$(OutDir)..\cudnn64_4.dll')">$(OutDir)..\cudnn64_4.dll</CuDnnDll>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<UnitTestDependencies Include="$(OutDir)CNTK.Core.BS;$(OutDir)..\evaldll.dll;$(OutDir)..\Math.dll;$(OutDir)..\libacml_mp_dll.dll;$(OutDir)..\libifcoremd.dll;$(OutDir)..\libifportmd.dll;$(OutDir)..\libiomp*.dll;$(OutDir)..\libmmd.dll;$(OutDir)..\svml_dispmd.dll;" />
|
||||
<UnitTestDependencies Include="$(OutDir)CNTK.Core.BS;$(OutDir)..\evaldll.dll;$(OutDir)..\Math.dll;$(UnitTestDlls)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(GpuBuild)">
|
||||
<UnitTestDependencies Include="$(OutDir)CNTK.Core.BS;$(OutDir)..\evaldll.dll;$(OutDir)..\cuda*.dll;$(OutDir)..\svml_dispmd.dll;$(CuDnnDll);$(UnitTestDependencies)" />
|
||||
<UnitTestDependencies Include="$(OutDir)CNTK.Core.BS;$(OutDir)..\evaldll.dll;$(OutDir)..\cuda*.dll;$(CuDnnDll);$(UnitTestDependencies)" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(UnitTestDependencies)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true">
|
||||
<Output TaskParameter="DestinationFiles" ItemName="NewFileWrites" />
|
||||
|
|
|
@ -224,7 +224,7 @@ BOOST_AUTO_TEST_CASE(ConvolutionForward)
|
|||
std::string emsg;
|
||||
|
||||
BOOST_REQUIRE_MESSAGE(!out.HasNan("out"), "out" << msgNan);
|
||||
BOOST_REQUIRE_MESSAGE(CheckEqual(out, outB, emsg, relErr * 4, absErr * 8), "out" << msg << ". " << emsg);
|
||||
BOOST_REQUIRE_MESSAGE(CheckEqual(out, outB, emsg, relErr * 4, absErr * 9), "out" << msg << ". " << emsg);
|
||||
BOOST_REQUIRE_MESSAGE(CountNans(outBuf) == crowOut * 2 * n, "out" << msgNotNan);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" InitialTargets="CheckDependencies" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
|
@ -168,10 +168,10 @@
|
|||
<CuDnnDll Condition="$(GpuBuild) And Exists('$(OutDir)..\cudnn64_4.dll')">$(OutDir)..\cudnn64_4.dll</CuDnnDll>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<UnitTestDependencies Include="$(OutDir)..\Math.dll;$(OutDir)..\libacml_mp_dll.dll;$(OutDir)..\libifcoremd.dll;$(OutDir)..\libifportmd.dll;$(OutDir)..\libiomp*.dll;$(OutDir)..\libmmd.dll;$(OutDir)..\svml_dispmd.dll;" />
|
||||
<UnitTestDependencies Include="$(OutDir)..\Math.dll;$(UnitTestDlls);" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(GpuBuild)">
|
||||
<UnitTestDependencies Include="$(OutDir)..\cuda*.dll;$(OutDir)..\svml_dispmd.dll;$(CuDnnDll);$(UnitTestDependencies)" />
|
||||
<UnitTestDependencies Include="$(OutDir)..\cuda*.dll;$(CuDnnDll);$(UnitTestDependencies)" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(UnitTestDependencies)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true">
|
||||
<Output TaskParameter="DestinationFiles" ItemName="NewFileWrites" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" InitialTargets="CheckDependencies" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
|
@ -134,7 +134,7 @@
|
|||
</Target>
|
||||
<Target Name="CopyUnitTestDependencies" AfterTargets="Build">
|
||||
<ItemGroup>
|
||||
<UnitTestDependencies Include="$(OutDir)..\Math.dll;$(OutDir)..\libacml_mp_dll.dll;$(OutDir)..\libifcoremd.dll;$(OutDir)..\libifportmd.dll;$(OutDir)..\libiomp*.dll;$(OutDir)..\libmmd.dll;$(OutDir)..\svml_dispmd.dll;" />
|
||||
<UnitTestDependencies Include="$(OutDir)..\Math.dll;$(UnitTestDlls);" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(UnitTestDependencies)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true">
|
||||
<Output TaskParameter="DestinationFiles" ItemName="NewFileWrites" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" InitialTargets="CheckDependencies" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
|
@ -262,7 +262,7 @@
|
|||
</PropertyGroup>
|
||||
<Target Name="CopyUnitTestDependencies" AfterTargets="Build">
|
||||
<ItemGroup>
|
||||
<UnitTestDependencies Include="$(OutDir)..\Math.dll;$(OutDir)..\ucifastreader.dll;$(OutDir)..\cntktextformatreader.dll;$(OutDir)..\htkmlfreader.dll;$(OutDir)..\HTKDeserializers.dll;$(OutDir)..\compositedatareader.dll;$(OutDir)..\libacml_mp_dll.dll;$(OutDir)..\libifcoremd.dll;$(OutDir)..\libifportmd.dll;$(OutDir)..\libiomp*.dll;$(OutDir)..\libmmd.dll;$(OutDir)..\svml_dispmd.dll;$(ImageReaderDependencies);" />
|
||||
<UnitTestDependencies Include="$(OutDir)..\Math.dll;$(OutDir)..\ucifastreader.dll;$(OutDir)..\cntktextformatreader.dll;$(OutDir)..\htkmlfreader.dll;$(OutDir)..\HTKDeserializers.dll;$(OutDir)..\compositedatareader.dll;$(UnitTestDlls);$(ImageReaderDependencies);" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(UnitTestDependencies)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true">
|
||||
<Output TaskParameter="DestinationFiles" ItemName="NewFileWrites" />
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
#
|
||||
# Licensed under the MIT license. See LICENSE.md file in the project root
|
||||
# for full license information.
|
||||
# ==============================================================================
|
||||
#
|
||||
# TODO --math-library support on Windows
|
||||
|
||||
# Setting some default values
|
||||
BUILD=1
|
||||
|
@ -9,6 +17,7 @@ RANDOM_OUTPUT=0
|
|||
CODE_COVERAGE=no
|
||||
FLAVORS="debug:release"
|
||||
TARGETS="cpu:gpu"
|
||||
MATH_LIBRARY="acml"
|
||||
TESTTARGETS="cpu:gpu"
|
||||
|
||||
# parsing command line arguments:
|
||||
|
@ -25,6 +34,7 @@ case $key in
|
|||
echo " -b|--build-only - just build, do not run"
|
||||
echo " -f|--flavors <flavor1:flavor2...> - which flavor to build (by default $FLAVORS)"
|
||||
echo " -t|--targets <target1:target2...> - which target to build (by default $TARGETS)"
|
||||
echo " -m|--math-library <mathlibrary> - which math library to build with (by default $MATH_LIBRARY)"
|
||||
echo " -tt|--test-targets <testtarget1:testtarget2...> - which target to test (by default $TESTTARGETS)"
|
||||
echo " -cc|--code-coverage - build with support for code coverage (gcov)"
|
||||
echo " -cb|--clean-build - clean up the enlistment binaries before build"
|
||||
|
@ -64,6 +74,24 @@ case $key in
|
|||
TARGETS="${2,,}"
|
||||
shift # past argument
|
||||
;;
|
||||
-m|--math-library)
|
||||
case ${2,,} in
|
||||
acml)
|
||||
MATH_LIBRARY_OPTION="--with-acml=$ACML_PATH"
|
||||
;;
|
||||
mkl)
|
||||
MATH_LIBRARY_OPTION="--with-mkl=$MKL_PATH"
|
||||
;;
|
||||
mkl-sequential)
|
||||
MATH_LIBRARY_OPTION="--with-mkl-sequential=$MKL_PATH"
|
||||
;;
|
||||
*)
|
||||
echo Unknown math library $MATH_LIBRARY
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift # past argument
|
||||
;;
|
||||
-tt|--test-targets)
|
||||
TESTTARGETS="${2,,}"
|
||||
shift # past argument
|
||||
|
@ -76,7 +104,7 @@ case $key in
|
|||
shift # past argument
|
||||
;;
|
||||
*)
|
||||
echo Unkown option $key
|
||||
echo Unknown option $key
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -86,7 +114,7 @@ done
|
|||
# Step 0 -- Validate all necessary prerequisites and check for incompatible options
|
||||
# It is possible to use this script on Windows to build CNTK
|
||||
# from Cygwin window with Visual C++ environment loaded.
|
||||
# In that case OS environment variable will be set and we
|
||||
# In that case OS environment variable will be set and we
|
||||
# can use it to differentiate from Linux.
|
||||
if [[ $CLEAN_BEFORE == 1 && $RUN == 1 && $BUILD == 0 ]]; then
|
||||
echo "============ ERROR: Incompatible options RUN and CLEAN_BEFORE set without BUILD ============"
|
||||
|
@ -99,7 +127,7 @@ if [[ $OS == "Windows_NT" && $OSTYPE == "cygwin" ]]; then
|
|||
PREFIX_DIR=x64
|
||||
BIN_NAME=CNTK.exe
|
||||
BUILD_OS="windows"
|
||||
|
||||
|
||||
if [[ $VS120COMNTOOLS == "" ]]; then
|
||||
echo "============ Visual Studio 12.0 environment not properly setup or VS not installed ============"
|
||||
echo "============ Please find and run the appropriate vcvarsall.bat script ============"
|
||||
|
@ -224,7 +252,7 @@ if [[ $BUILD == 1 ]]; then
|
|||
OneBitSGDOPT=yes
|
||||
fi
|
||||
fi
|
||||
./configure --with-build-top=$BUILD_DIR --with-acml=$ACML_PATH --with-buildtype=$FLAVOR --cuda=$CUDAOPT --with-code-coverage=$CODE_COVERAGE --1bitsgd=$OneBitSGDOPT
|
||||
./configure --with-build-top=$BUILD_DIR ${MATH_LIBRARY_OPTION} --with-buildtype=$FLAVOR --cuda=$CUDAOPT --with-code-coverage=$CODE_COVERAGE --1bitsgd=$OneBitSGDOPT
|
||||
if [[ $CLEAN_BEFORE == 1 ]]; then
|
||||
make -C $BUILD_DIR -f $MAKEFILE clean 1>&6 2>&7 || exit $?
|
||||
fi
|
||||
|
@ -278,7 +306,7 @@ if [[ $RUN == 1 ]]; then
|
|||
fi
|
||||
OUT_FILE="$RUN_FILE.$FLAVOR.$TARGET.$TESTTARGET.out"
|
||||
|
||||
BIN_PATH=$CNTK_ROOT/$PREFIX_DIR/$FLAVOR_DIR/$BIN_NAME
|
||||
BIN_PATH=$CNTK_ROOT/$PREFIX_DIR/$FLAVOR_DIR/$BIN_NAME
|
||||
if ! [[ -f $BIN_PATH ]]; then
|
||||
echo "============ ERROR: CNTK did not build properly for $TARGET/$FLAVOR ============"
|
||||
echo "Missing file: $BIN_PATH"
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
#
|
||||
# Licensed under the MIT license. See LICENSE.md file in the project root
|
||||
# for full license information.
|
||||
# ==============================================================================
|
||||
#
|
||||
# Description: this script is used to generated buildinfo.h in Source/CNTK
|
||||
# which will contain the following infomation to be displayed at runtime:
|
||||
# BUILDTYPE (release/debug)
|
||||
|
@ -24,7 +30,7 @@ usage ()
|
|||
echo "This script assumes git can be used"
|
||||
echo "This script assumes Config.make has been made"
|
||||
echo "-------------------------------------------------------------------"
|
||||
if [ ! -z "$1" ] ; then
|
||||
if [ ! -z "$1" ] ; then
|
||||
echo "ERROR message: $1"
|
||||
fi
|
||||
exit 1
|
||||
|
@ -60,20 +66,20 @@ makebuildinfo()
|
|||
printf "#define _MATHLIB_ \"%s\"\n" "$MATHLIB"
|
||||
printf "#define _BUILDSHA1_ \"%s\"\n" "$GIT_COMMIT"
|
||||
printf "#define _BUILDBRANCH_ \"%s\"\n" "$GIT_BRANCH"
|
||||
if [ -z "$CUDA_PATH" ]; then
|
||||
if [ -z "$CUDA_PATH" ]; then
|
||||
printf "#define _BUILDTARGET_ \"CPU-only\"\n"
|
||||
else
|
||||
printf "#define _BUILDTARGET_ \"GPU\"\n"
|
||||
printf "#define _CUDA_PATH_ \"%s\"\n" "$CUDA_PATH"
|
||||
fi
|
||||
if [ ! -z "$CUB_PATH" ]; then
|
||||
if [ ! -z "$CUB_PATH" ]; then
|
||||
printf "#define _CUB_PATH_ \"%s\"\n" "$CUB_PATH"
|
||||
fi
|
||||
if [ ! -z "$CUDNN_PATH" ]; then
|
||||
if [ ! -z "$CUDNN_PATH" ]; then
|
||||
printf "#define _CUDNN_PATH_ \"%s\"\n" $CUDNN_PATH
|
||||
fi
|
||||
printf "#define _BUILDTYPE_ \"%s\"\n" "$BUILDTYPE"
|
||||
if [ ! -z "$WITH_1BITSGD" ]; then
|
||||
if [ ! -z "$WITH_1BITSGD" ]; then
|
||||
printf "#define _WITH_1BITSGD_ \"yes\"\n"
|
||||
else
|
||||
printf "#define _WITH_1BITSGD_ \"no\"\n"
|
||||
|
@ -87,48 +93,53 @@ makebuildinfo()
|
|||
|
||||
#//////////////////////////////////////////////////////#
|
||||
# main function #
|
||||
#//////////////////////////////////////////////////////#
|
||||
if [ $# -ne 1 ]; then
|
||||
usage
|
||||
#//////////////////////////////////////////////////////#
|
||||
if [ $# -ne 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
config=$1
|
||||
|
||||
# 1. check whether we have git and what is the sha-1 value
|
||||
# Check whether we have git and what is the SHA-1 value
|
||||
if Has_Git; then has_git=1; else has_git=0; usage "git does not exist"; fi
|
||||
GIT_STATUS=' (modified)'
|
||||
git diff --quiet && git diff --cached --quiet && GIT_STATUS=''
|
||||
GIT_COMMIT=`git rev-parse HEAD`$GIT_STATUS
|
||||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
# 2. looking into Config.make
|
||||
if [ ! -e $config ] ; then
|
||||
# Looking into Config.make
|
||||
if [ ! -e $config ] ; then
|
||||
usage "Config.make not exists"
|
||||
fi
|
||||
source $config
|
||||
|
||||
# 3. whether we have CUDA_PATH
|
||||
if [ -z "${CUDA_PATH+x}" ]; then
|
||||
# Whether we have CUDA_PATH
|
||||
if [ -z "${CUDA_PATH+x}" ]; then
|
||||
CUDAPATH=""
|
||||
else
|
||||
CUDAPATH=$CUDA_PATH
|
||||
fi
|
||||
|
||||
# 4. whether we have CUB_PATH
|
||||
if [ -z "${CUB_PATH+x}" ]; then
|
||||
# Whether we have CUB_PATH
|
||||
if [ -z "${CUB_PATH+x}" ]; then
|
||||
CUBPATH=""
|
||||
else
|
||||
CUBPATH=$CUB_PATH
|
||||
fi
|
||||
|
||||
# 5. Build machine info
|
||||
# Identify MKL variant being used
|
||||
if [ "$MATHLIB" = "mkl" -a "$MKL_THREADING" = "sequential" ]; then
|
||||
MATHLIB=mkl-sequential
|
||||
fi
|
||||
|
||||
# Build machine info
|
||||
BUILDER=$USER
|
||||
BUILDMACHINE=`hostname`
|
||||
BUILDPATH=`pwd`
|
||||
|
||||
# 6. make buildinfo.h (only update if changed)
|
||||
# Make buildinfo.h (only update if changed)
|
||||
target=Source/CNTK/buildinfo.h
|
||||
if [ ! -d Source ] ; then
|
||||
if [ ! -d Source ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
#
|
||||
# Licensed under the MIT license. See LICENSE.md file in the project root
|
||||
# for full license information.
|
||||
# ==============================================================================
|
||||
#
|
||||
|
||||
configure=$0
|
||||
build_top=$PWD
|
||||
|
@ -12,9 +19,12 @@ have_acml=no
|
|||
acml_path=
|
||||
acml_check=include/acml.h
|
||||
|
||||
# CNTK Custom MKL Version
|
||||
cntk_custom_mkl_version=1
|
||||
|
||||
have_mkl=no
|
||||
mkl_path=
|
||||
mkl_check=mkl/include/mkl.h
|
||||
mkl_check=$cntk_custom_mkl_version/include/mkl.h
|
||||
|
||||
# Experimental OpenBLAS support.
|
||||
have_openblas=no
|
||||
|
@ -23,7 +33,7 @@ openblas_check=include/openblas_config.h
|
|||
|
||||
have_kaldi=no
|
||||
kaldi_path=
|
||||
kaldi_check=src/kaldi.mk
|
||||
kaldi_check=src/kaldi.mk
|
||||
|
||||
have_buildtype=no
|
||||
buildtype=
|
||||
|
@ -58,11 +68,11 @@ default_use_code_coverage=no
|
|||
enable_code_coverage=$default_use_code_coverage
|
||||
|
||||
# List from best to worst choice
|
||||
default_path_list="/usr /usr/local /opt /opt/local /opt/intel"
|
||||
default_path_list="/usr /usr/local /opt /opt/local"
|
||||
|
||||
# List from best to worst choice
|
||||
default_acmls="acml5.3.1/ifort64_mp"
|
||||
default_mkls=""
|
||||
default_mkls="CNTKCustomMKL"
|
||||
default_openblas=""
|
||||
|
||||
# NOTE: Will get compilation errors with cuda-6.0
|
||||
|
@ -171,7 +181,7 @@ function is_hardlinked ()
|
|||
echo $r
|
||||
}
|
||||
|
||||
function default_use_cuda ()
|
||||
function default_use_cuda ()
|
||||
{
|
||||
if test x$(find_cuda) = x || test x$(find_gdk) = x
|
||||
then
|
||||
|
@ -182,7 +192,7 @@ function default_use_cuda ()
|
|||
}
|
||||
enable_cuda=$(default_use_cuda)
|
||||
|
||||
function show_default ()
|
||||
function show_default ()
|
||||
{
|
||||
if test x$1 = x
|
||||
then
|
||||
|
@ -207,6 +217,7 @@ function show_help ()
|
|||
echo " --with-cudnn[=directory] $(show_default $(find_cudnn))"
|
||||
echo " --with-acml[=directory] $(show_default $(find_acml))"
|
||||
echo " --with-mkl[=directory] $(show_default $(find_mkl))"
|
||||
echo " --with-mkl-sequential[=directory] $(show_default $(find_mkl))"
|
||||
echo " --with-openblas[=directory] (experimental) $(show_default $(find_openblas))"
|
||||
echo " --with-buildtype=(debug|release) $(show_default $default_buildtype)"
|
||||
echo " --with-kaldi[=directory] $(show_default $(find_kaldi))"
|
||||
|
@ -392,12 +403,16 @@ do
|
|||
--with-mkl*)
|
||||
have_mkl=yes
|
||||
mathlib=mkl
|
||||
mkl_threading=parallel
|
||||
case $key in
|
||||
--with-mkl-sequential*) mkl_threading=sequential ;;
|
||||
esac
|
||||
if test x$optarg = x
|
||||
then
|
||||
mkl_path=$(find_mkl)
|
||||
if test x$mkl_path = x
|
||||
then
|
||||
echo "Cannot find mkl directory"
|
||||
echo "Cannot find CNTK custom MKL directory"
|
||||
echo "Please specify a value for --with-mkl"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -406,7 +421,7 @@ do
|
|||
then
|
||||
mkl_path=$optarg
|
||||
else
|
||||
echo "Invalid mkl directory $optarg"
|
||||
echo "Invalid CNTK custom MKL directory $optarg"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -534,7 +549,7 @@ then
|
|||
if test x$mkl_path = x
|
||||
then
|
||||
echo "Cannot find a CPU math library."
|
||||
echo "Please specify --with-acml, --with-mkl, --with-openblas with a path."
|
||||
echo "Please specify --with-acml, --with-mkl, --with-mkl-sequential, --with-openblas with a path."
|
||||
exit 1
|
||||
else
|
||||
mathlib=mkl
|
||||
|
@ -637,6 +652,8 @@ case $mathlib in
|
|||
;;
|
||||
mkl)
|
||||
echo MKL_PATH=$mkl_path >> $config
|
||||
echo MKL_THREADING=$mkl_threading >> $config
|
||||
echo CNTK_CUSTOM_MKL_VERSION=$cntk_custom_mkl_version >> $config
|
||||
;;
|
||||
openblas)
|
||||
echo OPENBLAS_PATH=$openblas_path >> $config
|
||||
|
@ -678,6 +695,6 @@ then
|
|||
echo all clean : >> $makefile
|
||||
printf '\t$(MAKE) -C $(dir) BUILD_TOP=$(BUILD_TOP) $@\n' >> $makefile
|
||||
fi
|
||||
echo run
|
||||
echo run
|
||||
echo '>make -j all'
|
||||
echo to build
|
||||
|
|
Загрузка…
Ссылка в новой задаче