jorisvandenbossche commented on code in PR #40385:
URL: https://github.com/apache/arrow/pull/40385#discussion_r1541059218


##########
python/pyarrow/__init__.py:
##########
@@ -281,6 +281,13 @@ def print_entry(label, value):
 
 import pyarrow.types as types
 
+try:
+    # Try importing the cuda module to ensure libarrow_cuda gets loaded
+    # to register the CUDA device for the C Data Interface import
+    import pyarrow.cuda
+except ImportError:

Review Comment:
   I _think_ that this is required to get this working, but it's not actually 
tested right now. That's because the current tests use `pyarrow.cuda` anyway to 
create the test data (and so will pass without doing the above). 
   (to properly test it, we would need to use another library such as nanoarrow 
to create the data and then import in pyarrow without direct usage of 
`pyarrow.cuda`)
   
   If we worry about import time that is being added here, I could also move 
this import to only do this on-demand at first usage of one of the 
`import_from_c_device` methods.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to