-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-41126: [Python] Basic bindings for Device and MemoryManager classes #41685
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
GH-41126: [Python] Basic bindings for Device and MemoryManager classes #41685
Conversation
|
|
AlenkaF
left a comment
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.
LGTM!
danepitkin
left a comment
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.
Is it possible to add tests to test_cuda.py to test a non-cpu path?
| """ | ||
| Return the DeviceAllocationType of this device. | ||
| """ | ||
| return _wrap_device_allocation_type(self.device.get().device_type()) |
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.
Why do we wrap device_type, but not other properties like is_cpu?
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.
is_cpu is a simple bool, and cython takes care of returning that as a python object. For the type here I wanted to return a python enum (and not just an integer)
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.
Thanks for the explanation!
| The returned singleton instance uses the default MemoryPool. | ||
| """ | ||
| return MemoryManager.wrap(c_default_cpu_memory_manager()) |
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.
Do you plan to later subclass Device with CPUDevice and MemoryManager with CPUMemoryManager, respectively?
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.
Not necessarily, for now, if not needed? For CPU I am not sure if it is worth it, as looking at device.h, it seems the main thing the subclass provides is allowing to specify a memory pool when creating (which we could also expose through default_cpu_memory_manager if we want to expose this?
For CUDA there might be more CUDA-specific methods/attributes where it might be more worth providing a subclass.
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.
Indeed, we can do add them later when desired.
We should certainly do that, but we were planning to do that in a follow-up |
Ah, fair enough. |
|
After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 31fe24d. There were 2 benchmark results with an error:
There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 10 possible false positives for unstable benchmarks that are known to sometimes produce them. |
) ### Rationale for this change Adding tests for the new Buffer properties added in #41685 but now testing that it works out of the box with CUDA. * GitHub Issue: #41126 Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
…221) ### Rationale for this change Adding tests for the new Buffer properties added in apache/arrow#41685 but now testing that it works out of the box with CUDA. * GitHub Issue: #41126 Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Rationale for this change
Add bindings for the C++
arrow::Deviceandarrow::MemoryManagerclasses.What changes are included in this PR?
Basic bindings by adding the
pyarrow.Deviceandpyarrow.MemoryManagerclasses, and just tested for CPU.What is not included here are additional methods on the
MemoryManagerclass (eg to allocate or copy buffers), and this is also not yet tested for CUDA. Planning to do this as follow-ups, and first doing those basic bindings should enable further enhancements to be done in parallel.Are these changes tested?
Yes, for the CPU device only.