adding fix for mkl library error

This commit is contained in:
Abhishek Jindal 2021-10-13 13:06:57 -07:00
parent 175974444c
commit 73b87c73c2
2 changed files with 11 additions and 2 deletions

View file

@ -11,6 +11,7 @@ source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_eager_srcs})
add_library(onnxruntime_eager ${onnxruntime_eager_srcs})
if(MSVC AND onnxruntime_ENABLE_EAGER_MODE)
set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_aten.cpp" PROPERTIES COMPILE_FLAGS "/wd4100" COMPILE_FLAGS "/wd4458")
set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_aten.g.cpp" PROPERTIES COMPILE_FLAGS "/wd4275")
set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_customops.g.cpp" PROPERTIES COMPILE_FLAGS "/wd4100")
set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_backends.cpp" PROPERTIES COMPILE_FLAGS "/wd4100")
set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_hooks.cpp" PROPERTIES COMPILE_FLAGS "/wd4100")

View file

@ -105,7 +105,15 @@ if (onnxruntime_ENABLE_EAGER_MODE)
# todo: this is because the prebuild pytorch may use a different version of protobuf headers.
# force the build to find the protobuf headers ort using.
target_include_directories(onnxruntime_pybind11_state PRIVATE "${REPO_ROOT}/cmake/external/protobuf/src")
target_link_libraries(onnxruntime_pybind11_state PRIVATE onnxruntime_eager ${TORCH_LIBRARIES} ${TORCH_PYTHON_LIBRARY})
# Commenting this out for linking MKL error and adding individual libraries
# target_link_libraries(onnxruntime_pybind11_state PRIVATE onnxruntime_eager ${TORCH_LIBRARIES} ${TORCH_PYTHON_LIBRARY})
target_include_directories(onnxruntime_pybind11_state PRIVATE "${TORCH_INSTALL_PREFIX}/include" "${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include")
if (MSVC)
target_link_libraries(onnxruntime_pybind11_state PRIVATE onnxruntime_eager "${TORCH_INSTALL_PREFIX}/lib/torch.lib" "${TORCH_INSTALL_PREFIX}/lib/torch_cpu.lib" "${TORCH_INSTALL_PREFIX}/lib/c10.lib" "${TORCH_INSTALL_PREFIX}/lib/kineto.lib" ${TORCH_PYTHON_LIBRARY})
else()
target_link_libraries(onnxruntime_pybind11_state PRIVATE onnxruntime_eager "${TORCH_INSTALL_PREFIX}/lib/libtorch.so" ${TORCH_PYTHON_LIBRARY})
endif()
# the ort_aten.g.cpp is generated from tools. currently it has some limitations.
# todo: fix this
if (NOT MSVC)
@ -115,7 +123,7 @@ if (onnxruntime_ENABLE_EAGER_MODE)
set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_tensor.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
endif()
if (MSVC)
target_compile_options(onnxruntime_pybind11_state PUBLIC "/wd4100" "/wd4324" "/wd4458" "/wd4127" "/wd4193" "/wd4624" "/wd4702")
target_compile_options(onnxruntime_pybind11_state PUBLIC "/wd4100" "/wd4324" "/wd4458" "/wd4127" "/wd4193" "/wd4624" "/wd4702" "/wd4244" "/wd4275" "/wd4267")
endif()
endif()