mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[inductor] Windows inductor use intel-openmp. (#160258)
After some debug work, I found PyTorch torch_cpu.dll is using intel-openmp, but not MSVC openmp.
So, switch Windows inductor to intel-openmp.
It fixed: c8205cb354/test/inductor/test_aot_inductor.py (L2405-L2408)
<img width="896" height="230" alt="image" src="https://github.com/user-attachments/assets/273b00f8-7dc1-43c9-9b7f-752e16355a80" />
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160258
Approved by: https://github.com/ezyang
This commit is contained in:
1
setup.py
1
setup.py
@ -1598,6 +1598,7 @@ def main() -> None:
|
||||
"networkx>=2.5.1",
|
||||
"jinja2",
|
||||
"fsspec>=0.8.5",
|
||||
'intel-openmp==2025.1.1 ;platform_system == "Windows" ', # for Windows inductor
|
||||
]
|
||||
if BUILD_PYTHON_ONLY:
|
||||
install_requires += [f"{LIBTORCH_PKG_NAME}=={TORCH_VERSION}"]
|
||||
|
@ -910,8 +910,15 @@ def _get_python_related_args() -> tuple[list[str], list[str]]:
|
||||
str(
|
||||
(
|
||||
Path(sysconfig.get_path("include", scheme="nt")).parent / "libs"
|
||||
).absolute()
|
||||
)
|
||||
).absolute() # python[ver].lib
|
||||
),
|
||||
str(
|
||||
(
|
||||
Path(sysconfig.get_path("include", scheme="nt")).parent
|
||||
/ "Library"
|
||||
/ "lib"
|
||||
).absolute() # install python librarys location, such as intel-openmp
|
||||
),
|
||||
]
|
||||
else:
|
||||
python_lib_path = [sysconfig.get_config_var("LIBDIR")]
|
||||
@ -1077,11 +1084,10 @@ def _get_openmp_args(
|
||||
libs.append("libiomp5md")
|
||||
perload_icx_libomp_win(cpp_compiler)
|
||||
else:
|
||||
# /openmp, /openmp:llvm
|
||||
# llvm on Windows, new openmp: https://devblogs.microsoft.com/cppblog/msvc-openmp-update/
|
||||
# msvc openmp: https://learn.microsoft.com/zh-cn/cpp/build/reference/openmp-enable-openmp-2-0-support?view=msvc-170
|
||||
cflags.append("openmp")
|
||||
cflags.append("openmp:experimental") # MSVC CL
|
||||
cflags.append("openmp:experimental")
|
||||
libs.append("libiomp5md") # intel-openmp
|
||||
ldflags.append("nodefaultlib:vcomp")
|
||||
else:
|
||||
if config.is_fbcode():
|
||||
include_dir_paths.append(build_paths.openmp_include)
|
||||
|
Reference in New Issue
Block a user