From 3d0fa32cf2a2f00d945ddfb469f83c791703aea3 Mon Sep 17 00:00:00 2001 From: GALI PREM SAGAR Date: Thu, 26 Jan 2023 10:06:41 -0600 Subject: [PATCH] [REVIEW] Adapt to changes in `cudf.core.buffer.Buffer` (#5154) This PR adapts to the breaking changes being introduced in: https://github.com/rapidsai/cudf/pull/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) --- .../text/stem/porter_stemmer_utils/suffix_utils.py | 5 +++-- python/cuml/tests/test_input_utils.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/python/cuml/preprocessing/text/stem/porter_stemmer_utils/suffix_utils.py b/python/cuml/preprocessing/text/stem/porter_stemmer_utils/suffix_utils.py index 8beee6b412..ad1e10aeda 100644 --- a/python/cuml/preprocessing/text/stem/porter_stemmer_utils/suffix_utils.py +++ b/python/cuml/preprocessing/text/stem/porter_stemmer_utils/suffix_utils.py @@ -83,6 +83,7 @@ def subtract_valid(input_array, valid_bool_array, sub_val): input_array[pos] = input_array[pos] - sub_val +@cudf.core.buffer.acquire_spill_lock() def get_stem_series(word_str_ser, suffix_len, can_replace_mask): """ word_str_ser: input string column @@ -95,8 +96,8 @@ def get_stem_series(word_str_ser, suffix_len, can_replace_mask): start_series = cudf.Series(cp.zeros(len(word_str_ser), dtype=cp.int32)) end_ser = word_str_ser.str.len() - end_ar = end_ser._column.data_array_view - can_replace_mask_ar = can_replace_mask._column.data_array_view + end_ar = end_ser._column.data_array_view(mode="read") + can_replace_mask_ar = can_replace_mask._column.data_array_view(mode="read") subtract_valid[NBLCK, NTHRD](end_ar, can_replace_mask_ar, suffix_len) return word_str_ser.str.slice_from( diff --git a/python/cuml/tests/test_input_utils.py b/python/cuml/tests/test_input_utils.py index a143ff5882..8031932f94 100644 --- a/python/cuml/tests/test_input_utils.py +++ b/python/cuml/tests/test_input_utils.py @@ -333,7 +333,11 @@ def check_numpy_order(ary, order): def check_ptr(a, b, input_type): if input_type == 'cudf': for (_, col_a), (_, col_b) in zip(a._data.items(), b._data.items()): - assert col_a.base_data.ptr == col_b.base_data.ptr + with cudf.core.buffer.acquire_spill_lock(): + assert ( + col_a.base_data.get_ptr(mode="read") == + col_b.base_data.get_ptr(mode="read") + ) else: def get_ptr(x): try: