@@ -53,23 +53,15 @@ def _find_dll_using_nvidia_bin_dirs(libname, lib_searched_for, error_messages, a
5353 return None
5454
5555
56- def _get_cuda_home (priority ):
57- supported_priorities = ("first" , "last" )
58- assert priority in supported_priorities
59- env_priority = os .environ .get ("CUDA_PYTHON_CUDA_HOME_PRIORITY" )
60- if env_priority :
61- if env_priority not in supported_priorities :
62- raise RuntimeError (f"Invalid CUDA_PYTHON_CUDA_HOME_PRIORITY { env_priority !r} ({ supported_priorities = } )" )
63- if priority != env_priority :
64- return None
56+ def _get_cuda_home ():
6557 cuda_home = os .environ .get ("CUDA_HOME" )
6658 if cuda_home is None :
6759 cuda_home = os .environ .get ("CUDA_PATH" )
6860 return cuda_home
6961
7062
71- def _find_lib_dir_using_cuda_home (libname , priority ):
72- cuda_home = _get_cuda_home (priority )
63+ def _find_lib_dir_using_cuda_home (libname ):
64+ cuda_home = _get_cuda_home ()
7365 if cuda_home is None :
7466 return None
7567 if IS_WINDOWS :
@@ -134,30 +126,21 @@ def __init__(self, libname: str):
134126 self .attachments = []
135127 self .abs_path = None
136128
137- cuda_home_lib_dir = _find_lib_dir_using_cuda_home (libname , "first" )
138129 if IS_WINDOWS :
139130 self .lib_searched_for = f"{ libname } *.dll"
140- if cuda_home_lib_dir is not None :
141- self .abs_path = _find_dll_using_lib_dir (
142- cuda_home_lib_dir , libname , self .error_messages , self .attachments
143- )
144131 if self .abs_path is None :
145132 self .abs_path = _find_dll_using_nvidia_bin_dirs (
146133 libname , self .lib_searched_for , self .error_messages , self .attachments
147134 )
148135 else :
149136 self .lib_searched_for = f"lib{ libname } .so"
150- if cuda_home_lib_dir is not None :
151- self .abs_path = _find_so_using_lib_dir (
152- cuda_home_lib_dir , self .lib_searched_for , self .error_messages , self .attachments
153- )
154137 if self .abs_path is None :
155138 self .abs_path = _find_so_using_nvidia_lib_dirs (
156139 libname , self .lib_searched_for , self .error_messages , self .attachments
157140 )
158141
159142 def retry_with_cuda_home_priority_last (self ):
160- cuda_home_lib_dir = _find_lib_dir_using_cuda_home (self .libname , "last" )
143+ cuda_home_lib_dir = _find_lib_dir_using_cuda_home (self .libname )
161144 if cuda_home_lib_dir is not None :
162145 if IS_WINDOWS :
163146 self .abs_path = _find_dll_using_lib_dir (
0 commit comments