From 6be93f11e5d3418d758f2169e8d506971e22e103 Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Mon, 22 Jul 2019 16:59:32 -0700 Subject: [PATCH] build mklml/ngraph without openmp (#1460) cleanup the option to build mklml/ngraph without openmp --- cmake/CMakeLists.txt | 9 +++------ .../github/azure-pipelines/nuget/templates/cpu-mklml.yml | 4 ++-- .../github/azure-pipelines/win-mklml-ci-pipeline.yml | 2 +- .../github/azure-pipelines/win-ngraph-ci-pipeline.yml | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 139889a48d56c..6893c00aa32d4 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -85,12 +85,9 @@ set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE) set(NSYNC_ENABLE_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE) set(ONNX_ML 1) -if(onnxruntime_USE_OPENMP AND UNIX) - #if you enabled both of them, the code can still be built and run, but you may see - # 10x performance degradation, because one process should only have one openmp implementation - # mkl(or mklml) depends on Intel OpenMP - # GCC does not support linking against the Intel OpenMP runtime library - # Clang should be ok, but it's not in our consideration right now. +if(onnxruntime_USE_OPENMP) + # MKLML and NGraph depend on their own OpenMP library that may be different with the compiler's. + # Disable the options to build mklml/NGraph and OpenMP together. if(onnxruntime_USE_MKLML) message(FATAL_ERROR "Please use only one of onnxruntime_USE_MKLML, onnxruntime_USE_OPENMP") endif() diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml index 1d7c5d1f307f5..6282e9b4a8360 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/cpu-mklml.yml @@ -12,7 +12,7 @@ jobs: parameters: AgentPool : $(AgentPoolWin) JobName: 'Windows_CI_Dev' - BuildCommand: '$(Build.SourcesDirectory)\tools\ci_build\build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --use_mklml --use_openmp --build_shared_lib --build_csharp --enable_onnx_tests --test_data_url $(TestDataUrl) --test_data_checksum $(TestDataChecksum)' + BuildCommand: '$(Build.SourcesDirectory)\tools\ci_build\build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --use_mklml --build_shared_lib --build_csharp --enable_onnx_tests --test_data_url $(TestDataUrl) --test_data_checksum $(TestDataChecksum)' DoDebugBuild: 'false' DoNugetPack : 'true' DoCompliance: 'false' @@ -45,7 +45,7 @@ jobs: parameters: AgentPool : $(AgentPoolMacOS) JobName: 'MacOS_CI_Dev' - BuildCommand: 'python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_shared_lib --use_mklml --use_openmp --enable_onnx_tests --config RelWithDebInfo' + BuildCommand: 'python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_shared_lib --use_mklml --enable_onnx_tests --config RelWithDebInfo' DoNugetPack : 'true' NuPackScript: | set -e -x diff --git a/tools/ci_build/github/azure-pipelines/win-mklml-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-mklml-ci-pipeline.yml index 6d219135fb17c..e8580f8fd495d 100644 --- a/tools/ci_build/github/azure-pipelines/win-mklml-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-mklml-ci-pipeline.yml @@ -14,7 +14,7 @@ jobs: displayName: 'Download test data and generate cmake config' inputs: filename: '$(Build.BinariesDirectory)\packages\python\python.exe' - arguments: '$(Build.SourcesDirectory)\tools\ci_build\build.py --config Debug Release --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --use_mklml --use_openmp --build_shared_lib --build_csharp --enable_onnx_tests --test_data_url $(TestDataUrl) --test_data_checksum $(TestDataChecksum) --update' + arguments: '$(Build.SourcesDirectory)\tools\ci_build\build.py --config Debug Release --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --use_mklml --build_shared_lib --build_csharp --enable_onnx_tests --test_data_url $(TestDataUrl) --test_data_checksum $(TestDataChecksum) --update' workingDirectory: "$(Build.BinariesDirectory)" - task: VSBuild@1 diff --git a/tools/ci_build/github/azure-pipelines/win-ngraph-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-ngraph-ci-pipeline.yml index b74ef8a788693..d5b1f09b1da99 100644 --- a/tools/ci_build/github/azure-pipelines/win-ngraph-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-ngraph-ci-pipeline.yml @@ -30,7 +30,7 @@ jobs: displayName: 'Test Debug' inputs: filename: '$(Build.BinariesDirectory)\packages\python\python.exe' - arguments: '$(Build.SourcesDirectory)\tools\ci_build\build.py --config Debug --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --enable_pybind --use_openmp --use_ngraph --use_full_protobuf --build_shared_lib --test_data_url $(TestDataUrl) --test_data_checksum $(TestDataChecksum) --gen_doc --test' + arguments: '$(Build.SourcesDirectory)\tools\ci_build\build.py --config Debug --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --enable_pybind --use_ngraph --use_full_protobuf --build_shared_lib --test_data_url $(TestDataUrl) --test_data_checksum $(TestDataChecksum) --gen_doc --test' workingFolder: '$(Build.BinariesDirectory)' - task: VSBuild@1 displayName: 'Build Release'