Skip to content

Create PackedData from cudf PackedColumns #228

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

Merged

Conversation

nirandaperera
Copy link
Contributor

Current PackedData cython API does not contain a constructor that takes in cudf packed columns. This PR adds it.

@nirandaperera nirandaperera requested a review from a team as a code owner April 24, 2025 23:41
@nirandaperera nirandaperera added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Apr 24, 2025
@nirandaperera nirandaperera requested a review from wence- April 24, 2025 23:42
Comment on lines 19 to 22
def __init__(self, PackedColumns packed_columns) -> None:
self.c_obj = make_unique[cpp_PackedData](
move(deref(packed_columns.c_obj).metadata),
move(deref(packed_columns.c_obj).gpu_data))
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to very clearly document that it takes ownership of the data in the passed in PackedColumns object.

@nirandaperera nirandaperera requested a review from wence- April 25, 2025 15:30
@nirandaperera
Copy link
Contributor Author

/ok to test

@nirandaperera nirandaperera requested a review from madsbk April 28, 2025 20:13
Copy link
Member

@madsbk madsbk left a comment

Choose a reason for hiding this comment

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

Looks good, only some minor suggestions.

@@ -13,3 +15,39 @@ cdef class PackedData:
cdef PackedData self = PackedData.__new__(PackedData)
self.c_obj = move(obj)
return self

@staticmethod
def from_cudf_packed_columns(PackedColumns packed_columns) -> PackedData:
Copy link
Member

Choose a reason for hiding this comment

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

No type notation in pyx

Suggested change
def from_cudf_packed_columns(PackedColumns packed_columns) -> PackedData:
def from_cudf_packed_columns(PackedColumns packed_columns):

@@ -13,3 +15,39 @@ cdef class PackedData:
cdef PackedData self = PackedData.__new__(PackedData)
self.c_obj = move(obj)
return self

@staticmethod
Copy link
Member

Choose a reason for hiding this comment

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

@nirandaperera nirandaperera requested a review from madsbk May 9, 2025 17:18
Copy link
Member

@pentschev pentschev left a comment

Choose a reason for hiding this comment

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

Thanks @nirandaperera , left a few comments.

class PackedData:
pass
def __init__(self) -> None: ...
@staticmethod
Copy link
Member

Choose a reason for hiding this comment

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

Should this be @classmethod like in the pyx file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, good catch. Thanks @pentschev

nirandaperera and others added 3 commits May 9, 2025 14:02
Co-authored-by: Peter Andreas Entschev <[email protected]>
Signed-off-by: niranda perera <[email protected]>
…ra/rapidsmpf into packed_data_from_packed_cols
@nirandaperera nirandaperera requested a review from pentschev May 9, 2025 21:51
Signed-off-by: niranda perera <[email protected]>
Copy link
Member

@pentschev pentschev 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 @nirandaperera !

Copy link
Member

@madsbk madsbk left a comment

Choose a reason for hiding this comment

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

Looks good, I only one suggestion

"""
cdef PackedData ret = cls.__new__(cls)
with nogil:
if not (deref(packed_columns.c_obj).metadata and
Copy link
Member

Choose a reason for hiding this comment

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

Also check that packed_columns.c_obj isn't null

Signed-off-by: niranda perera <[email protected]>
@nirandaperera nirandaperera requested a review from madsbk May 12, 2025 20:04
@nirandaperera
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit d03f885 into rapidsai:branch-25.06 May 14, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants