diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f85893c47e..7675f569d0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -691,11 +691,7 @@ if(ENABLE_MLALGO OR DEFINED Torch_DIR) set_if_higher(CMAKE_CXX_STANDARD 14) endif() include_directories(${TORCH_INCLUDE_DIRS}) - if(MKL_FOUND) - list(PREPEND math_libs ${TORCH_LIBRARIES}) - else() - list(APPEND math_libs ${TORCH_LIBRARIES}) - endif() + list(APPEND math_libs ${TORCH_LIBRARIES}) add_compile_options(${TORCH_CXX_FLAGS}) endif() diff --git a/toolchain/scripts/lib/config_manager.sh b/toolchain/scripts/lib/config_manager.sh index 65ea5740d26..fc7ca306837 100644 --- a/toolchain/scripts/lib/config_manager.sh +++ b/toolchain/scripts/lib/config_manager.sh @@ -567,6 +567,11 @@ config_apply_env_logic() { echo "Using MKL, so fftw is disabled." CONFIG_CACHE["with_fftw"]="__DONTUSE__" fi + if [ "${CONFIG_CACHE[with_libtorch]}" = "__INSTALL__" ]; then + report_error ${LINENO} \ + "Installing the current prebuilt libtorch package is disabled for oneMKL builds due to known conflicts between bundled and externally linked oneMKL libraries. Please provide a compatible libtorch installation via --with-libtorch=system or --with-libtorch=." + exit 1 + fi fi # Select the correct compute number based on the GPU architecture