From bf606efbca83bde14e2926a0f99ea057df819cd6 Mon Sep 17 00:00:00 2001 From: Matthew Murray <41342305+Matt711@users.noreply.github.com> Date: Sat, 14 Dec 2024 00:19:07 -0500 Subject: [PATCH] Remove `rmm._lib` (#1765) Closes #1762 Authors: - Matthew Murray (https://github.com/Matt711) Approvers: - Bradley Dice (https://github.com/bdice) URL: https://github.com/rapidsai/rmm/pull/1765 --- python/rmm/rmm/__init__.py | 16 ------ python/rmm/rmm/_lib/__init__.py | 23 -------- python/rmm/rmm/_lib/cuda_stream.pxd | 16 ------ python/rmm/rmm/_lib/cuda_stream.py | 15 ----- python/rmm/rmm/_lib/cuda_stream_pool.pxd | 15 ----- python/rmm/rmm/_lib/cuda_stream_view.pxd | 20 ------- python/rmm/rmm/_lib/device_buffer.pxd | 27 --------- python/rmm/rmm/_lib/device_buffer.py | 21 ------- python/rmm/rmm/_lib/device_uvector.pxd | 15 ----- python/rmm/rmm/_lib/helper.pxd | 15 ----- python/rmm/rmm/_lib/logger.pxd | 24 -------- python/rmm/rmm/_lib/logger.py | 24 -------- python/rmm/rmm/_lib/memory_resource.pxd | 62 --------------------- python/rmm/rmm/_lib/memory_resource.py | 45 --------------- python/rmm/rmm/_lib/per_device_resource.pxd | 21 ------- python/rmm/rmm/tests/test_rmm.py | 6 -- 16 files changed, 365 deletions(-) delete mode 100644 python/rmm/rmm/_lib/__init__.py delete mode 100644 python/rmm/rmm/_lib/cuda_stream.pxd delete mode 100644 python/rmm/rmm/_lib/cuda_stream.py delete mode 100644 python/rmm/rmm/_lib/cuda_stream_pool.pxd delete mode 100644 python/rmm/rmm/_lib/cuda_stream_view.pxd delete mode 100644 python/rmm/rmm/_lib/device_buffer.pxd delete mode 100644 python/rmm/rmm/_lib/device_buffer.py delete mode 100644 python/rmm/rmm/_lib/device_uvector.pxd delete mode 100644 python/rmm/rmm/_lib/helper.pxd delete mode 100644 python/rmm/rmm/_lib/logger.pxd delete mode 100644 python/rmm/rmm/_lib/logger.py delete mode 100644 python/rmm/rmm/_lib/memory_resource.pxd delete mode 100644 python/rmm/rmm/_lib/memory_resource.py delete mode 100644 python/rmm/rmm/_lib/per_device_resource.pxd diff --git a/python/rmm/rmm/__init__.py b/python/rmm/rmm/__init__.py index 5c865eba8..f1d6e2d7e 100644 --- a/python/rmm/rmm/__init__.py +++ b/python/rmm/rmm/__init__.py @@ -54,19 +54,3 @@ "should_log", "unregister_reinitialize_hook", ] - - -def __getattr__(name): - if name == "_lib": - import importlib - - warnings.warn( - "The `rmm._lib` module is deprecated in will be removed in a future release. Use `rmm.pylibrmm` instead.", - FutureWarning, - stacklevel=2, - ) - - module = importlib.import_module("rmm.pylibrmm") - return module - else: - raise AttributeError(f"Module '{__name__}' has no attribute '{name}'") diff --git a/python/rmm/rmm/_lib/__init__.py b/python/rmm/rmm/_lib/__init__.py deleted file mode 100644 index 7e01bda77..000000000 --- a/python/rmm/rmm/_lib/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2018-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import warnings - -from rmm.pylibrmm import * - -warnings.warn( - "The `rmm._lib` module is deprecated in will be removed in a future release. Use `rmm.pylibrmm` instead.", - FutureWarning, - stacklevel=2, -) diff --git a/python/rmm/rmm/_lib/cuda_stream.pxd b/python/rmm/rmm/_lib/cuda_stream.pxd deleted file mode 100644 index afc365fbb..000000000 --- a/python/rmm/rmm/_lib/cuda_stream.pxd +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm.cuda_stream cimport cuda_stream -from rmm.pylibrmm.cuda_stream cimport CudaStream diff --git a/python/rmm/rmm/_lib/cuda_stream.py b/python/rmm/rmm/_lib/cuda_stream.py deleted file mode 100644 index 1eb424e12..000000000 --- a/python/rmm/rmm/_lib/cuda_stream.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2018-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.pylibrmm.cuda_stream import CudaStream # noqa: F401 diff --git a/python/rmm/rmm/_lib/cuda_stream_pool.pxd b/python/rmm/rmm/_lib/cuda_stream_pool.pxd deleted file mode 100644 index 4da59cc68..000000000 --- a/python/rmm/rmm/_lib/cuda_stream_pool.pxd +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2021-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm.cuda_stream_pool cimport cuda_stream_pool diff --git a/python/rmm/rmm/_lib/cuda_stream_view.pxd b/python/rmm/rmm/_lib/cuda_stream_view.pxd deleted file mode 100644 index c336b0fe8..000000000 --- a/python/rmm/rmm/_lib/cuda_stream_view.pxd +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2020-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm.cuda_stream_view cimport ( - cuda_stream_default, - cuda_stream_legacy, - cuda_stream_per_thread, - cuda_stream_view, -) diff --git a/python/rmm/rmm/_lib/device_buffer.pxd b/python/rmm/rmm/_lib/device_buffer.pxd deleted file mode 100644 index 22833b1b8..000000000 --- a/python/rmm/rmm/_lib/device_buffer.pxd +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm.device_buffer cimport ( - cuda_device_id, - device_buffer, - get_current_cuda_device, - prefetch, -) -from rmm.pylibrmm.device_buffer cimport ( - DeviceBuffer, - copy_device_to_ptr, - copy_host_to_ptr, - copy_ptr_to_host, - to_device, -) diff --git a/python/rmm/rmm/_lib/device_buffer.py b/python/rmm/rmm/_lib/device_buffer.py deleted file mode 100644 index c531bca5f..000000000 --- a/python/rmm/rmm/_lib/device_buffer.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2018-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.pylibrmm.device_buffer import ( # noqa: F401 - DeviceBuffer, - copy_device_to_ptr, - copy_host_to_ptr, - copy_ptr_to_host, - to_device, -) diff --git a/python/rmm/rmm/_lib/device_uvector.pxd b/python/rmm/rmm/_lib/device_uvector.pxd deleted file mode 100644 index 230b0afb3..000000000 --- a/python/rmm/rmm/_lib/device_uvector.pxd +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2021-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm.device_uvector cimport device_uvector diff --git a/python/rmm/rmm/_lib/helper.pxd b/python/rmm/rmm/_lib/helper.pxd deleted file mode 100644 index 4a5159435..000000000 --- a/python/rmm/rmm/_lib/helper.pxd +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.pylibrmm.helper cimport parse_bytes diff --git a/python/rmm/rmm/_lib/logger.pxd b/python/rmm/rmm/_lib/logger.pxd deleted file mode 100644 index bef05c903..000000000 --- a/python/rmm/rmm/_lib/logger.pxd +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2023-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm._logger cimport logger, logging_level, spdlog_logger -from rmm.pylibrmm.logger cimport ( - _validate_level_type, - flush_logger, - get_flush_level, - get_logging_level, - set_flush_level, - set_logging_level, - should_log, -) diff --git a/python/rmm/rmm/_lib/logger.py b/python/rmm/rmm/_lib/logger.py deleted file mode 100644 index 1e9b519b8..000000000 --- a/python/rmm/rmm/_lib/logger.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2018-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm._logger import logging_level # noqa: F401 -from rmm.pylibrmm.logger import ( # noqa: F401 - _validate_level_type, - flush_logger, - get_flush_level, - get_logging_level, - set_flush_level, - set_logging_level, - should_log, -) diff --git a/python/rmm/rmm/_lib/memory_resource.pxd b/python/rmm/rmm/_lib/memory_resource.pxd deleted file mode 100644 index 0d11001a4..000000000 --- a/python/rmm/rmm/_lib/memory_resource.pxd +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm.memory_resource cimport ( - CppExcept, - allocate_callback_t, - allocation_handle_type, - available_device_memory, - binning_memory_resource, - callback_memory_resource, - cuda_async_memory_resource, - cuda_memory_resource, - deallocate_callback_t, - device_memory_resource, - failure_callback_resource_adaptor, - failure_callback_t, - fixed_size_memory_resource, - limiting_resource_adaptor, - logging_resource_adaptor, - managed_memory_resource, - percent_of_free_device_memory, - pool_memory_resource, - prefetch_resource_adaptor, - sam_headroom_memory_resource, - statistics_resource_adaptor, - system_memory_resource, - throw_cpp_except, - tracking_resource_adaptor, - translate_python_except_to_cpp, -) -from rmm.pylibrmm.memory_resource cimport ( - ArenaMemoryResource, - BinningMemoryResource, - CallbackMemoryResource, - CudaAsyncMemoryResource, - CudaMemoryResource, - DeviceMemoryResource, - FailureCallbackResourceAdaptor, - FixedSizeMemoryResource, - LimitingResourceAdaptor, - LoggingResourceAdaptor, - ManagedMemoryResource, - PoolMemoryResource, - PrefetchResourceAdaptor, - SamHeadroomMemoryResource, - StatisticsResourceAdaptor, - SystemMemoryResource, - TrackingResourceAdaptor, - UpstreamResourceAdaptor, - get_current_device_resource, -) diff --git a/python/rmm/rmm/_lib/memory_resource.py b/python/rmm/rmm/_lib/memory_resource.py deleted file mode 100644 index f3a24f635..000000000 --- a/python/rmm/rmm/_lib/memory_resource.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2018-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.pylibrmm.memory_resource import ( # noqa: F401 - ArenaMemoryResource, - BinningMemoryResource, - CallbackMemoryResource, - CudaAsyncMemoryResource, - CudaMemoryResource, - DeviceMemoryResource, - FailureCallbackResourceAdaptor, - FixedSizeMemoryResource, - LimitingResourceAdaptor, - LoggingResourceAdaptor, - ManagedMemoryResource, - PoolMemoryResource, - PrefetchResourceAdaptor, - SamHeadroomMemoryResource, - StatisticsResourceAdaptor, - SystemMemoryResource, - TrackingResourceAdaptor, - UpstreamResourceAdaptor, - _flush_logs, - available_device_memory, - disable_logging, - enable_logging, - get_current_device_resource, - get_current_device_resource_type, - get_log_filenames, - get_per_device_resource_type, - is_initialized, - set_current_device_resource, - set_per_device_resource, -) diff --git a/python/rmm/rmm/_lib/per_device_resource.pxd b/python/rmm/rmm/_lib/per_device_resource.pxd deleted file mode 100644 index 29487f503..000000000 --- a/python/rmm/rmm/_lib/per_device_resource.pxd +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2019-2024, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rmm.librmm.per_device_resource cimport ( - cuda_device_id, - get_current_device_resource, - get_per_device_resource, - set_current_device_resource, - set_per_device_resource, -) diff --git a/python/rmm/rmm/tests/test_rmm.py b/python/rmm/rmm/tests/test_rmm.py index 7d13b5cac..f655b4616 100644 --- a/python/rmm/rmm/tests/test_rmm.py +++ b/python/rmm/rmm/tests/test_rmm.py @@ -1078,9 +1078,3 @@ def test_available_device_memory(): assert initial_memory[1] == final_memory[1] assert initial_memory[0] > 0 assert final_memory[0] > 0 - - -# TODO: Remove test when rmm._lib is removed in 25.02 -def test_deprecate_rmm_lib(): - with pytest.warns(FutureWarning): - rmm._lib.device_buffer.DeviceBuffer(size=100)