Skip to content

Commit

Permalink
Adapt to rapidsai/rmm#1221 which moves allocator callbacks (#5249)
Browse files Browse the repository at this point in the history
The allocator callbacks now live in their own submodules (so that RMM does not, for example, import pytorch unless required) and so must be explicitly imported.

Authors:
  - Lawrence Mitchell (https://github.com/wence-)

Approvers:
  - Carl Simon Adorf (https://github.com/csadorf)
  - William Hicks (https://github.com/wphicks)

URL: #5249
  • Loading branch information
wence- authored Mar 6, 2023
1 parent bd1b9a8 commit d071e21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion python/cuml/internals/api_context_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
cupy_using_allocator = gpu_only_import_from(
"cupy.cuda", "using_allocator", alt=UnavailableNullContext
)
rmm_cupy_allocator = gpu_only_import_from("rmm", "rmm_cupy_allocator")
rmm_cupy_allocator = gpu_only_import_from(
"rmm.allocators.cupy", "rmm_cupy_allocator"
)


@contextlib.contextmanager
Expand Down
4 changes: 3 additions & 1 deletion python/cuml/internals/memory_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
)
PandasSeries = cpu_only_import_from("pandas", "Series")
PandasDataFrame = cpu_only_import_from("pandas", "DataFrame")
rmm_cupy_allocator = gpu_only_import_from("rmm", "rmm_cupy_allocator")
rmm_cupy_allocator = gpu_only_import_from(
"rmm.allocators.cupy", "rmm_cupy_allocator"
)


def set_global_memory_type(memory_type):
Expand Down
4 changes: 3 additions & 1 deletion wiki/python/ESTIMATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,9 @@ Functionally, you can think of these decorators equivalent to the following pseu
```python
def my_func(self, X):
with cuml.using_ouput_type("mirror"):
with cupy.cuda.cupy_using_allocator(rmm.rmm_cupy_allocator):
with cupy.cuda.cupy_using_allocator(
rmm.allocators.cupy.rmm_cupy_allocator
):
# Set the input properties
self._set_base_attributes(output_type=X, n_features=X)

Expand Down

0 comments on commit d071e21

Please sign in to comment.