windows add env (#8852)

This commit is contained in:
Xin Qiu 2023-08-30 15:54:52 +08:00 committed by GitHub
parent 731916c639
commit 8eca982301

View file

@ -80,6 +80,10 @@ def _load_shared_library(lib_base_name: str):
cdll_args = dict() # type: ignore cdll_args = dict() # type: ignore
# Add the library directory to the DLL search path on Windows (if needed) # Add the library directory to the DLL search path on Windows (if needed)
if sys.platform == "win32" and sys.version_info >= (3, 8): if sys.platform == "win32" and sys.version_info >= (3, 8):
# On windows, pytorch and our native library use different OMP, we should
# set OMP_WAIT_POLICY=PASSIVE to avoid OMP waiting.
os.environ["OMP_WAIT_POLICY"] = "PASSIVE"
os.add_dll_directory(str(_base_path)) os.add_dll_directory(str(_base_path))
os.environ["PATH"] = str(_base_path) + ";" + os.environ["PATH"] os.environ["PATH"] = str(_base_path) + ";" + os.environ["PATH"]
if "CUDA_PATH" in os.environ: if "CUDA_PATH" in os.environ: