Skip to content
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

[BUG] fix empty initialization of device_ndarray in pylibraft #2061

Merged

Conversation

mfoerste4
Copy link
Collaborator

The device_ndarray.empty() function can be used to allocate device memory without initialization. Previously, the memory has been allocated (uninitialized) on the host and then been copied to the device.

This PR fixes the behavior for 'empty()' by allowing the device_ndarray to be initialized by an array_interface instead of an numpy.ndarray instance, which conditionally allows to skip the initialization of the DeviceBuffer.

CC @tfeher, @cjnolet

@mfoerste4 mfoerste4 requested a review from a team as a code owner December 13, 2023 16:13
@cjnolet cjnolet added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Dec 13, 2023
Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @mfoerste4

Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @mfoerste4

@cjnolet
Copy link
Member

cjnolet commented Dec 15, 2023

/merge

@rapids-bot rapids-bot bot merged commit 1beb556 into rapidsai:branch-24.02 Dec 15, 2023
61 checks passed
ChristinaZ pushed a commit to ChristinaZ/raft that referenced this pull request Jan 17, 2024
…ai#2061)

The `device_ndarray.empty()` function can be used to allocate device memory without initialization. Previously, the memory has been allocated (uninitialized) on the host and then been copied to the device.

This PR fixes the behavior for 'empty()' by allowing the `device_ndarray` to be initialized by an `array_interface` instead of an `numpy.ndarray` instance, which conditionally allows to skip the initialization of the `DeviceBuffer`.

CC @tfeher, @cjnolet

Authors:
  - Malte Förster (https://github.com/mfoerste4)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#2061
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change python
Projects
Development

Successfully merging this pull request may close these issues.

2 participants