Initial version of cuda.pathfinder._find_nvidia_headers for nvshmem#661
Initial version of cuda.pathfinder._find_nvidia_headers for nvshmem#661rwgk merged 32 commits intoNVIDIA:mainfrom
cuda.pathfinder._find_nvidia_headers for nvshmem#661Conversation
|
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. |
|
/ok to test |
This comment has been minimized.
This comment has been minimized.
|
Just wondering what is the status for this PR? |
|
I still need to fix this up, after merging #723 a couple days ago. |
|
Is there some mechanism so that user can override the path returned by the api? Or that's largely a library duty to maintain? |
…modernize new code
…more complete commands for setting up manual testing.
path_finder find_nvidia_headers.py (Minimal Viable Product)find_nvidia_headers.py for nvshmem (Minimal Viable Product)
|
/ok to test |
|
Will it tolerate |
The code added in this PR ignores those completely. I've only tested these situations (copy-pasted from the current Offline @leofang wrote that getting headers in general is now the top priority (I just created #832 to track the work). That will bring in Coming back to |
b1ceca6 to
eb2e78a
Compare
…ind_nvidia_headers.py
c822c15 to
c90c393
Compare
|
/ok to test |
leofang
left a comment
There was a problem hiding this comment.
I have not reviewed tests, just the implementation.
cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py
Outdated
Show resolved
Hide resolved
| # Installed from a wheel | ||
| nvidia_sub_dirs = ("nvidia", "nvshmem", "include") | ||
| hdr_dir: str # help mypy | ||
| for hdr_dir in find_sub_dirs_all_sitepackages(nvidia_sub_dirs): |
There was a problem hiding this comment.
We should do it in a follow up, but I think we should really move towards using an importlib based resolution method instead of walking the sitepackages ourselves.
There was a problem hiding this comment.
I thought we discussed and agreed walking the paths is acceptable since on the PyPI side they are predictable? Any reason to prefer importlib?
There was a problem hiding this comment.
I thought we discussed and agreed walking the paths is acceptable since on the PyPI side they are predictable? Any reason to prefer importlib?
Lines crossed here. Let's review under #949 when we get to it.
There was a problem hiding this comment.
Oops, sorry, copy-paste mishap. Corrected (949).
| "site-packages", # pip install | ||
| "dist-packages", # apt install |
There was a problem hiding this comment.
Do we need to do anything for conda packages here?
There was a problem hiding this comment.
This is gated by have_nvidia_nvshmem_package(). ... But I just realized, there is no nvshmem .deb that installs into dist-packages. So I removed dist-packages from here to not implicitly suggest that it exists: commit 2426260
While at it, I added additional test (low-hanging fruits): commit b74a84c
Interactive testing with conda and "all_must_work" set:
$ pytest -ra -s -vv tests/test_find_nvidia_headers.py
========================================================================= test session starts ==========================================================================
platform linux -- Python 3.12.11, pytest-8.4.1, pluggy-1.6.0 -- /home/rgrossekunst/miniforge3/envs/nvshmem/bin/python3.12
cachedir: .pytest_cache
rootdir: /home/rgrossekunst/forked/cuda-python/cuda_pathfinder
configfile: pyproject.toml
collected 2 items
tests/test_find_nvidia_headers.py::test_unknown_libname PASSED
tests/test_find_nvidia_headers.py::test_find_libname_nvshmem PASSED
============================================================================= INFO summary =============================================================================
INFO test_find_libname_nvshmem: hdr_dir='/home/rgrossekunst/miniforge3/envs/nvshmem/include'
========================================================================== 2 passed in 0.01s ===========================================================================
Without wheel or conda ("all_must_work" set):
$ pytest -ra -s -vv tests/test_find_nvidia_headers.py
========================================================================= test session starts ==========================================================================
platform linux -- Python 3.12.3, pytest-8.4.2, pluggy-1.6.0 -- /home/rgrossekunst/JunkVenv/bin/python3
cachedir: .pytest_cache
rootdir: /home/rgrossekunst/forked/cuda-python/cuda_pathfinder
configfile: pyproject.toml
collected 2 items
tests/test_find_nvidia_headers.py::test_unknown_libname PASSED
tests/test_find_nvidia_headers.py::test_find_libname_nvshmem PASSED
============================================================================= INFO summary =============================================================================
INFO test_find_libname_nvshmem: hdr_dir='/usr/include/nvshmem_13'
========================================================================== 2 passed in 0.02s ===========================================================================
I also did negative tests for both, by using bad expected paths, and they fail as expected.
… a .deb that installs into dist-packages does not exist.
|
/ok to test |
|
|
For easy pre-release testing, I uploaded this to TestPyPI: https://test.pypi.org/project/cuda-pathfinder/1.2.2.dev202509051239/ It's exactly the same as under this PR, except that I appended |
…m` (NVIDIA#661) * find_nvidia_headers.py initial version (untested). * Add tests/test_path_finder_find_headers.py, with hard-coded paths. * Better error message: UNKNOWN libname='unknown-libname' * if libname == "nvshmem" and IS_WINDOWS: return None * Move find_nvidia_headers.py → _headers/find_nvidia_headers.py * test_find_nvidia_headers.py: removed hard-wired paths, comments with more complete commands for setting up manual testing. * Make _find_nvidia_header_directory private for now. * test_find_nvidia_headers.py: Move comments with installation commands up. * Add `have_nvidia_nvshmem_package()` function to enable `assert hdr_dir is not None` * Add nvidia-nvshmem-cu12,13 in pyproject.toml * assert site-packages or dist-packages * Add CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS * Transfer `ci/`, `.github/` changes from PR NVIDIA#864 * Add CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS in `ci/`, `.github/` * reverse=True in sorting of "/usr/include/nvshmem_*" (find newest first) * Fix: assert site-packages or dist-packages only if have_nvidia_nvshmem_package() * pytest.skip("nvshmem has no Windows support.") * Add new cuda/pathfinder/_utils/conda_env.py and use from find_nvidia_headers.py * Add new cuda/pathfinder/_utils/env_vars_for_include.py and use from find_nvidia_headers.py * Revert "Add new cuda/pathfinder/_utils/env_vars_for_include.py and use from find_nvidia_headers.py" This reverts commit c90c393. * Revert "Add new cuda/pathfinder/_utils/conda_env.py and use from find_nvidia_headers.py" This reverts commit eb2e78a. * Bump pathfinder version to 1.2.2 and add release/1.2.2-notes.rst * Remove os.path.isdir() tests that are not strictly needed. * test_find_nvidia_headers.py: remove check for `dist-packages` because a .deb that installs into dist-packages does not exist. * Additional testing
Description
Bump cuda-pathfinder version to TODO
Minimal viable product, currently not a public API (by way of using an underscore prefix:
_find_nvidia_headers).To support nvshmem4py.
Commit 673c38c was transferred from PR #864.