Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward-merge branch-24.12 into branch-25.02 #1735

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions python/rmm/rmm/tests/test_rmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,28 @@ def callback(nbytes: int) -> bool:
rmm.mr.set_current_device_resource(mr)

with pytest.raises(MemoryError):
rmm.DeviceBuffer(size=int(1e11))
from rmm.mr import available_device_memory

total_memory = available_device_memory()[1]
rmm.DeviceBuffer(size=total_memory * 2)
assert retried[0]


def test_failure_callback_resource_adaptor_error():
def callback(nbytes: int) -> bool:
raise RuntimeError("MyError")

cuda_mr = rmm.mr.CudaMemoryResource()
mr = rmm.mr.FailureCallbackResourceAdaptor(cuda_mr, callback)
rmm.mr.set_current_device_resource(mr)

with pytest.raises(RuntimeError, match="MyError"):
from rmm.mr import available_device_memory

total_memory = available_device_memory()[1]
rmm.DeviceBuffer(size=total_memory * 2)


@pytest.mark.parametrize("managed", [True, False])
def test_prefetch_resource_adaptor(managed):
if managed:
Expand All @@ -823,18 +841,6 @@ def test_prefetch_resource_adaptor(managed):
assert_prefetched(db, device)


def test_failure_callback_resource_adaptor_error():
def callback(nbytes: int) -> bool:
raise RuntimeError("MyError")

cuda_mr = rmm.mr.CudaMemoryResource()
mr = rmm.mr.FailureCallbackResourceAdaptor(cuda_mr, callback)
rmm.mr.set_current_device_resource(mr)

with pytest.raises(RuntimeError, match="MyError"):
rmm.DeviceBuffer(size=int(1e11))


def test_dev_buf_circle_ref_dealloc():
# This test creates a reference cycle containing a `DeviceBuffer`
# and ensures that the garbage collector does not clear it, i.e.,
Expand Down
Loading