Repository navigation
Conversation
nvCOMP's import deletes the libnvcomp attribute of the nvidia package but leaves nvidia.libnvcomp in sys.modules. libcudf's loader runs `import nvidia.libnvcomp` and then `nvidia.libnvcomp.load_library()`, so importing cudf, cuML or rapids-singlecell after a GPU read raised AttributeError. The pipeline now imports nvCOMP through one helper that puts the attribute back. Signed-off-by: Intron7 <sdicks@nvidia.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6 +/- ##
==========================================
+ Coverage 96.76% 96.77% +0.01%
==========================================
Files 6 6
Lines 1175 1180 +5
==========================================
+ Hits 1137 1142 +5
Misses 38 38
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
nvCOMP's
__init__loads its library withimport nvidia.libnvcomp,nvidia.libnvcomp.load_library()and thendel nvidia.libnvcomp. That removes the attribute from thenvidiapackage but leaves the module insys.modules, soa later
import nvidia.libnvcompdoesn't set it again. libcudf's loader (libcudf/load.py) runs exactly that importand then
nvidia.libnvcomp.load_library(). zarr-kvikio imports nvCOMP at its first GPU decode, so importing cudf, cuMLor rapids-singlecell after a GPU read raised
The pipeline now imports nvCOMP through
_nvcomp(), which puts the attribute back. It keepsimport nvidia.nvcomp as nv, which (unlike readingnvidia.nvcomp) also works while another thread's first import isfinishing.
Not covered: a libcudf loader that runs in another thread while the process imports nvCOMP for the first time
(~50 ms) can still fail, since the attribute is deleted inside nvCOMP's
__init__.Tested with this patch on an RTX PRO 6000 (CUDA 13, Python 3.14):
test_reads_keep_cudf_importablefails without the fix and passes with it.import rapids_singlecellraised before and works now.