Skip to content

Commit 022f189

Browse files
maresblucianopaz
authored andcommitted
Fix MKL BLAS detection
It seems that libiomp5.lib has been renamed to libiomp5md.lib, so the detection was failing. Add another search step with the new library name. TODO: is there a more modern approach? Co-authored-by: Luciano Paz <luciano.paz.neuro@gmail.com>
1 parent 602eb04 commit 022f189

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pytensor/link/c/cmodule.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2890,7 +2890,7 @@ def default_blas_ldflags() -> str:
28902890
if rpath is not None:
28912891
maybe_add_to_os_environ_pathlist("PATH", rpath)
28922892
try:
2893-
# 1. Try to use MKL with INTEL OpenMP threading
2893+
# 1a. Try to use MKL with INTEL OpenMP threading
28942894
_logger.debug("Checking MKL flags with intel threading")
28952895
return _check_libs(
28962896
all_libs,
@@ -2906,6 +2906,24 @@ def default_blas_ldflags() -> str:
29062906
)
29072907
except Exception as e:
29082908
_logger.debug(e)
2909+
try:
2910+
# 1b. Try to use MKL with INTEL OpenMP threading with renamed iomp5 library
2911+
# Ref: <https://www.intel.com/content/www/us/en/docs/onemkl/developer-guide-windows/2024-1/selecting-libraries-to-link-with.html>
2912+
_logger.debug("Checking MKL flags with intel threading, iomp5md")
2913+
return _check_libs(
2914+
all_libs,
2915+
required_libs=[
2916+
"mkl_core",
2917+
"mkl_rt",
2918+
"mkl_intel_thread",
2919+
"iomp5md",
2920+
"pthread",
2921+
],
2922+
extra_compile_flags=[f"-Wl,-rpath,{rpath}"] if rpath is not None else [],
2923+
cxx_library_dirs=cxx_library_dirs,
2924+
)
2925+
except Exception as e:
2926+
_logger.debug(e)
29092927
try:
29102928
# 2. Try to use MKL with GNU OpenMP threading
29112929
_logger.debug("Checking MKL flags with GNU OpenMP threading")

0 commit comments

Comments
 (0)