Skip to content

Commit

Permalink
Fix rmm ._lib imports (#1693)
Browse files Browse the repository at this point in the history
This PR fixes a bug in #1676. It makes sure that rmm imports work correctly using both `from rmm._lib...` and `import rmm._lib...` syntax.

I'm adding DO NOT MERGE until I do some more testing.

Authors:
  - Matthew Murray (https://github.com/Matt711)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #1693
  • Loading branch information
Matt711 authored Oct 4, 2024
1 parent 6489bb7 commit 8150032
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/rmm/rmm/_lib/cuda_stream.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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
21 changes: 21 additions & 0 deletions python/rmm/rmm/_lib/device_buffer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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,
)
24 changes: 24 additions & 0 deletions python/rmm/rmm/_lib/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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,
)
44 changes: 44 additions & 0 deletions python/rmm/rmm/_lib/memory_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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
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,
)

0 comments on commit 8150032

Please sign in to comment.