Add a check for onnxruntime_USE_MKLML AND onnxruntime_USE_OPENMP (#1131)

* Add a check for onnxruntime_USE_MKLML AND onnxruntime_USE_OPENMP
This commit is contained in:
Changming Sun 2019-05-30 10:23:18 -07:00 committed by GitHub
parent 4e231ad907
commit 66a6f2b0e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -82,6 +82,19 @@ 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_MKLML)
message(FATAL_ERROR "Please use only one of onnxruntime_USE_MKLML, onnxruntime_USE_OPENMP")
endif()
if(onnxruntime_USE_NGRAPH)
message(FATAL_ERROR "Please use only one of onnxruntime_USE_NGRAPH, onnxruntime_USE_OPENMP")
endif()
endif()
if(onnxruntime_ENABLE_LTO)
#TODO: figure out why nsync doesn't work
if(onnxruntime_USE_NSYNC)

View file

@ -320,7 +320,7 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home
"-Donnxruntime_USE_MKLDNN=" + ("ON" if args.use_mkldnn else "OFF"),
"-Donnxruntime_USE_MKLML=" + ("ON" if args.use_mklml else "OFF"),
"-Donnxruntime_USE_NGRAPH=" + ("ON" if args.use_ngraph else "OFF"),
"-Donnxruntime_USE_OPENMP=" + ("ON" if args.use_openmp else "OFF"),
"-Donnxruntime_USE_OPENMP=" + ("ON" if args.use_openmp and not args.use_mklml and not args.use_ngraph else "OFF"),
"-Donnxruntime_USE_TVM=" + ("ON" if args.use_tvm else "OFF"),
"-Donnxruntime_USE_LLVM=" + ("ON" if args.use_llvm else "OFF"),
"-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=" + ("ON" if args.enable_msinternal else "OFF"),