From ebde3209502b753a10eb5f5d245161564b65b396 Mon Sep 17 00:00:00 2001 From: RandySheriffH <48490400+RandySheriffH@users.noreply.github.com> Date: Fri, 2 Apr 2021 12:12:46 -0700 Subject: [PATCH] Add cupti path for python gpu packaging pipeline (#7200) * add cupti dll path for py3.8 * correct path * add prints * replace path join * add all path * restore pipeline * format * expand path only for python 38&39 * add all cupti path Co-authored-by: Randy Shuai --- onnxruntime/python/_pybind_state.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/onnxruntime/python/_pybind_state.py b/onnxruntime/python/_pybind_state.py index c1499ec554..2e3d2c8a58 100644 --- a/onnxruntime/python/_pybind_state.py +++ b/onnxruntime/python/_pybind_state.py @@ -40,6 +40,11 @@ if platform.system() == "Windows": # Python 3.8 (and later) doesn't search system PATH when loading DLLs, so the CUDA location needs to be # specified explicitly using the new API introduced in Python 3.8. os.add_dll_directory(cuda_bin_dir) + cuda_root = os.path.join(cuda_bin_dir, "..", "..") + for root, _, files in os.walk(cuda_root): + for f in files: + if f == "cupti.lib": + os.add_dll_directory(root) else: # Python 3.7 (and earlier) searches directories listed in PATH variable. # Make sure that the target CUDA version is at the beginning (important if multiple CUDA versions are