-
Notifications
You must be signed in to change notification settings - Fork 171
[path_finder_dev] path_finder Search Priority v2 #604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[path_finder_dev] path_finder Search Priority v2 #604
Conversation
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
6a49659
to
8ddb806
Compare
…ty (see updated README.md).
8ddb806
to
2cf3fa2
Compare
/ok to test 2b74022 |
|
/ok to test 27db0a7 |
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
cuda_bindings/cuda/bindings/_path_finder/find_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
/ok to test b1a5e9d |
The previous implementation checked result_queue.empty() before calling get(), which introduces a classic race condition: the queue may become non-empty immediately after the check, resulting in missed results or misleading errors. This patch replaces the empty() check with result_queue.get(timeout=1.0), allowing the parent process to robustly wait for results with a bounded delay. Also switches from ctx.SimpleQueue() to ctx.Queue() for compatibility with timeout-based get(), which SimpleQueue does not support on Python ≤3.12. Note: The race condition was discovered by Gemini 2.5
cuda_bindings/cuda/bindings/_path_finder/run_python_code_safely.py
Outdated
Show resolved
Hide resolved
Tracking the development history of
|
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
It is pretty awesome that the search priority update also allows us to drop the old Numba code entirely! |
…ority_last() the default.
…returns an incompatible `handle`. Use win32api.LoadLibraryEx() instead to ensure self-consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Several previous discussions on exec
and subprocess/multiprocessing are now moot by removing these unused code entirely.
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/run_python_code_safely.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/run_python_code_safely.py
Outdated
Show resolved
Hide resolved
cuda_bindings/cuda/bindings/_path_finder/load_nvidia_dynamic_library.py
Outdated
Show resolved
Hide resolved
…od. Move run_python_code_safely.py to test/ directory.
* Use win32api.GetModuleFileName() in abs_path_for_dynamic_library(). With this, load_dl_windows.py consistently uses win32api. ctypes is no longer needed, which eliminates the potential for confusion due to different types of handles. * Address review comment #604 (comment) by at-kkraus14 * Rename function run_python_code_safely() → run_in_spawed_child_process() * Change run_in_spawned_child_process() to accept a callable function instead of a string with Python code. * ChatGPT suggestions * Add rethrow as suggested by ChatGPT * Better names: Worker → ChildProcessWrapper, func → target * ChatGPT suggestions * Add minimal test_spawned_process_runner.py as generated by ChatGPT
Continuation of #578
Completely replace
cuda_paths.py
to achieve the desired Search Priority (see updated README.md).Further testing is under #610