From ba9c2e7f9d512e4490832a6b8e1981dc9034663b Mon Sep 17 00:00:00 2001 From: Manik Jindal Date: Sun, 28 Jan 2018 11:27:32 -0800 Subject: [PATCH] Fix build if optional MKLDNN is not present --- Source/Math/ConvolutionEngine.cpp | 2 ++ bindings/java/Swig/post-build.cmd | 8 +++++++- bindings/python/vsbuild.bat | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/Math/ConvolutionEngine.cpp b/Source/Math/ConvolutionEngine.cpp index 59315fad6..b197e1e2a 100644 --- a/Source/Math/ConvolutionEngine.cpp +++ b/Source/Math/ConvolutionEngine.cpp @@ -947,10 +947,12 @@ protected: bool Supported(const ConvolveGeometry* geometry, bool forward) { +#ifdef USE_MKLDNN //TODO: test code for linking with mkldnn.dll, will extend to support dilated convolution with MKL-DNN later mkldnn_primitive_attr_t attr; mkldnn_primitive_attr_create(&attr); mkldnn_primitive_attr_destroy(attr); +#endif //MKL2017 does not support asymmetric padding yet if (geometry->IsAsymmetricPadding()) return false; diff --git a/bindings/java/Swig/post-build.cmd b/bindings/java/Swig/post-build.cmd index 3c8274b61..a7e4830db 100644 --- a/bindings/java/Swig/post-build.cmd +++ b/bindings/java/Swig/post-build.cmd @@ -30,11 +30,17 @@ if "%is_gpu%" == "true" ( ) ) -for %%x in (libiomp5md.dll mklml.dll mkldnn.dll Cntk.Math-%version%.dll Cntk.PerformanceProfiler-%version%.dll Cntk.Core-%version%.dll Cntk.Core.JavaBinding-%version%.dll) do ( +for %%x in (libiomp5md.dll mklml.dll Cntk.Math-%version%.dll Cntk.PerformanceProfiler-%version%.dll Cntk.Core-%version%.dll Cntk.Core.JavaBinding-%version%.dll) do ( copy "%output_dir%/%%x" ".\com\microsoft\CNTK\lib\windows\%%x" echo %%x>> .\com\microsoft\CNTK\lib\windows\NATIVE_MANIFEST ) +for %%x in (mkldnn.dll) do ( + (copy "%output_dir%/%%x" ".\com\microsoft\CNTK\lib\windows\%%x") && ( + echo %%x>> .\com\microsoft\CNTK\lib\windows\NATIVE_MANIFEST) || ( + echo "Could not find %%x, skipping") +) + copy .\CNTKNativeUtils.java .\com\microsoft\CNTK\CNTKNativeUtils.java "%JAVA_HOME%\bin\javac" .\com\microsoft\CNTK\*.java || ( diff --git a/bindings/python/vsbuild.bat b/bindings/python/vsbuild.bat index d648d5927..3224e0b58 100644 --- a/bindings/python/vsbuild.bat +++ b/bindings/python/vsbuild.bat @@ -76,7 +76,6 @@ for %%D in ( Cntk.ImageWriter-%CNTK_COMPONENT_VERSION%.dll libiomp5md.dll mklml.dll - mkldnn.dll ) do ( if defined CNTK_LIBRARIES ( set CNTK_LIBRARIES=!CNTK_LIBRARIES!;%CNTK_LIB_PATH%\%%D @@ -85,6 +84,11 @@ for %%D in ( ) ) +@REM mkldnn.dll is optional +if exist mkldnn.dll ( + set CNTK_LIBRARIES=!CNTK_LIBRARIES!;%CNTK_LIB_PATH%\mkldnn.dll +) + @REM Cntk.BinaryConvolution-%CNTK_COMPONENT_VERSION%.dll is optional if exist Cntk.BinaryConvolution-%CNTK_COMPONENT_VERSION%.dll ( set CNTK_LIBRARIES=!CNTK_LIBRARIES!;%CNTK_LIB_PATH%\Cntk.BinaryConvolution-%CNTK_COMPONENT_VERSION%.dll