From a295857b0bc7c20bd7a67247188eea237252c7c4 Mon Sep 17 00:00:00 2001 From: viclafargue Date: Wed, 24 Jul 2024 14:30:30 +0200 Subject: [PATCH 1/2] Better communicate expectations of F/C contiguousness --- python/cuml/cuml/internals/array.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/cuml/cuml/internals/array.py b/python/cuml/cuml/internals/array.py index 6b664506ae..6154ecdc55 100644 --- a/python/cuml/cuml/internals/array.py +++ b/python/cuml/cuml/internals/array.py @@ -19,7 +19,7 @@ import pickle from cuml.internals.global_settings import GlobalSettings -from cuml.internals.logger import debug +from cuml.internals.logger import debug, info from cuml.internals.mem_type import MemoryType, MemoryTypeError from cuml.internals.memory_utils import class_with_cupy_rmm, with_cupy_rmm from cuml.internals.safe_imports import ( @@ -1172,6 +1172,11 @@ def from_input( if ( not fail_on_order and order != arr.order and order != "K" ) or make_copy: + info( + f"Expected {order} major order but got something else." + " Converting data; this will result in additional memory" + " utilization." + ) arr = cls( arr.mem_type.xpy.array( arr.to_output("array"), order=order, copy=make_copy From 02ad931bfd22c040f5e996c16b0fee2138964804 Mon Sep 17 00:00:00 2001 From: viclafargue Date: Mon, 29 Jul 2024 17:56:23 +0200 Subject: [PATCH 2/2] Apply review --- python/cuml/cuml/internals/array.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/python/cuml/cuml/internals/array.py b/python/cuml/cuml/internals/array.py index 6154ecdc55..d41f9f7d7d 100644 --- a/python/cuml/cuml/internals/array.py +++ b/python/cuml/cuml/internals/array.py @@ -1172,11 +1172,19 @@ def from_input( if ( not fail_on_order and order != arr.order and order != "K" ) or make_copy: - info( - f"Expected {order} major order but got something else." - " Converting data; this will result in additional memory" - " utilization." - ) + if make_copy: + info( + f"Expected {order} major order but got an uncontiguous array." + " Converting data; this will result in additional memory" + " utilization." + ) + else: + info( + f"Expected {order} major order but got {arr.order}." + " Converting data; this will result in additional memory" + " utilization." + ) + arr = cls( arr.mem_type.xpy.array( arr.to_output("array"), order=order, copy=make_copy