-
Notifications
You must be signed in to change notification settings - Fork 564
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
[REVIEW] Adapt to changes in cudf.core.buffer.Buffer
#5154
[REVIEW] Adapt to changes in cudf.core.buffer.Buffer
#5154
Conversation
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.
Looks right to me.
python/cuml/internals/array.py
Outdated
@@ -255,7 +255,7 @@ def __init__(self, | |||
self._mem_type = GlobalSettings().memory_type | |||
|
|||
try: | |||
data = data.ptr | |||
data = data.get_ptr() |
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.
This is correct (cuml is taking ownership of the buffer, so we can't do anything), but I think this is an impossible branch? How could we get here given that if data is a Buffer
that exposes get_ptr
then it also has a __cuda_array_interface__
property so we'll never end up in this branch?
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.
You are right, we will never branch for a Buffer
to this part of the code. Reverted the change.
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.
Can a cuml-ite cast some light on what is meant to be going on in this function? I think that this patch:
diff --git a/python/cuml/internals/array.py b/python/cuml/internals/array.py
index 808b92fe3..f9386ee8a 100644
--- a/python/cuml/internals/array.py
+++ b/python/cuml/internals/array.py
@@ -242,9 +242,7 @@ class CumlArray():
'Must specify dtype when data is passed as a'
' {}'.format(type(data))
)
- if isinstance(data, (CudfBuffer, DeviceBuffer)):
- self._mem_type = MemoryType.device
- elif mem_type is None:
+ if mem_type is None:
if GlobalSettings().memory_type in (
None, MemoryType.mirror
):
@@ -254,13 +252,6 @@ class CumlArray():
)
self._mem_type = GlobalSettings().memory_type
- try:
- data = data.ptr
- if shape is None:
- shape = (data.size,)
- self._owner = data
- except AttributeError: # Not a buffer object
- pass
if isinstance(data, int):
self._owner = owner
else:
Just deletes unreachable code:
- Both
CudfBuffer
andDeviceBuffer
advertise a__cuda_array_interface__
property - Only
CudfBuffer
andDeviceBuffer
have a.ptr
property
So if data
is either a CudfBuffer
or a DeviceBuffer
then we will never fall through the initial
try:
data.__cuda_array_interface__
except AttributeError:
...
check.
@wphicks can you 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.
@wence- Yep, that patch looks right to me. This code was based on an earlier version that did not take advantage of __cuda_array_interface__
at all. To answer the question about what this function is meant to, it helps construct a unified interface for all the data types cuML accepts. This function harvests all the data necessary for the CumlArray to populate a __cuda_array_interface__
or __array_interface__
of its own, even if the original object does not have an array interface.
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, I'll submit something as a followup, in the interests of keeping Prem's change as small as possible
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.
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.
Code changes look good, just had the comment about the temporary changes
ci/build_cpp.sh
Outdated
LIBCUDF_CHANNEL=$(rapids-get-artifact ci/cudf/pull-request/12587/046025a/cudf_conda_cpp_cuda11_$(arch).tar.gz) | ||
|
||
rapids-print-env | ||
|
||
rapids-logger "Begin cpp build" | ||
|
||
rapids-mamba-retry mambabuild conda/recipes/libcuml | ||
rapids-mamba-retry mambabuild \ | ||
--channel "${LIBCUDF_CHANNEL}" \ | ||
conda/recipes/libcuml |
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.
libcudf
is not a depencency of libcuml
just for context. These chanes are just temporary to test things, right?
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.
Yup, all the .sh
file changes will be reverted before merging this PR. Hence tagged it DO NOT MERGE
for now.
ci/build_python.sh
Outdated
PY_VER=${RAPIDS_PY_VERSION//./} | ||
LIBCUDF_CHANNEL=$(rapids-get-artifact ci/cudf/pull-request/12587/046025a/cudf_conda_cpp_cuda11_$(arch).tar.gz) | ||
CUDF_CHANNEL=$(rapids-get-artifact ci/cudf/pull-request/12587/046025a/cudf_conda_python_cuda11_${PY_VER}_$(arch).tar.gz) |
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.
Same question as above. Python cuml
does use cudf
so it makes more sense, but these seem like temporary changes for testing, right?
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.
Yup, same as above
ci/test_python_common.sh
Outdated
PY_VER=${RAPIDS_PY_VERSION//./} | ||
LIBCUDF_CHANNEL=$(rapids-get-artifact ci/cudf/pull-request/12587/046025a/cudf_conda_cpp_cuda11_$(arch).tar.gz) | ||
CUDF_CHANNEL=$(rapids-get-artifact ci/cudf/pull-request/12587/046025a/cudf_conda_python_cuda11_${PY_VER}_$(arch).tar.gz) |
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.
same
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.
ditto as above
Codecov ReportBase: 69.26% // Head: 69.07% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## branch-23.02 #5154 +/- ##
================================================
- Coverage 69.26% 69.07% -0.20%
================================================
Files 192 192
Lines 12333 12370 +37
================================================
+ Hits 8543 8544 +1
- Misses 3790 3826 +36
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
We should probably investigate the test failure we're seeing here rather than just doing a rerun. It looks like we're getting an incorrect array shape for that test, which could certainly be caused by a change to the CumlArray
logic. Could we check to see if this is a regression using the Hypothesis reproducer instructions before merge?
(i deleted my |
Admin merging with permission from @dantegd since these failures are unrelated. |
This PR adapts to the breaking changes being introduced in: rapidsai/cudf#12587 Authors: - GALI PREM SAGAR (https://github.com/galipremsagar) Approvers: - Lawrence Mitchell (https://github.com/wence-) - AJ Schmidt (https://github.com/ajschmidt8) - Dante Gama Dessavre (https://github.com/dantegd)
Noticed while reviewing #5154. Plus an extra (probably benign) typo-bug while I'm here. cc @wphicks Authors: - Lawrence Mitchell (https://github.com/wence-) - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - William Hicks (https://github.com/wphicks) URL: #5166
This PR adapts to the breaking changes being introduced in: rapidsai/cudf#12587