Skip to content

Commit

Permalink
Add cuDF spilling argument tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pentschev committed Jul 23, 2024
1 parent e764a4e commit 51a5201
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
63 changes: 63 additions & 0 deletions dask_cuda/tests/test_dask_cuda_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,69 @@ def test_rmm_logging(loop): # noqa: F811
assert v is rmm.mr.LoggingResourceAdaptor


def test_cudf_spill_disabled(loop): # noqa: F811
cudf = pytest.importorskip("cudf")
with popen(["dask", "scheduler", "--port", "9369", "--no-dashboard"]):
with popen(
[
"dask",
"cuda",
"worker",
"127.0.0.1:9369",
"--host",
"127.0.0.1",
"--no-dashboard",
]
):
with Client("127.0.0.1:9369", loop=loop) as client:
assert wait_workers(client, n_gpus=get_n_gpus())

cudf_spill = client.run(
cudf.get_option, "spill",
)
for v in cudf_spill.values():
assert v is False

cudf_spill_stats = client.run(
cudf.get_option, "spill_stats"
)
for v in cudf_spill_stats.values():
assert v == 0


def test_cudf_spill(loop): # noqa: F811
cudf = pytest.importorskip("cudf")
with popen(["dask", "scheduler", "--port", "9369", "--no-dashboard"]):
with popen(
[
"dask",
"cuda",
"worker",
"127.0.0.1:9369",
"--host",
"127.0.0.1",
"--no-dashboard",
"--enable-cudf-spill",
"--cudf-spill-stats",
"2",
]
):
with Client("127.0.0.1:9369", loop=loop) as client:
assert wait_workers(client, n_gpus=get_n_gpus())

cudf_spill = client.run(
cudf.get_option, "spill"
)
for v in cudf_spill.values():
assert v is True

cudf_spill_stats = client.run(
cudf.get_option, "spill_stats"
)
for v in cudf_spill_stats.values():
assert v == 2


@patch.dict(os.environ, {"CUDA_VISIBLE_DEVICES": "0"})
def test_dashboard_address(loop): # noqa: F811
with popen(["dask", "scheduler", "--port", "9369", "--no-dashboard"]):
Expand Down
44 changes: 44 additions & 0 deletions dask_cuda/tests/test_local_cuda_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,50 @@ async def test_worker_fraction_limits():
)


@gen_test(timeout=20)
async def test_cudf_spill_disabled():
cudf = pytest.importorskip("cudf")

async with LocalCUDACluster(
asynchronous=True,
) as cluster:
async with Client(cluster, asynchronous=True) as client:
cudf_spill = await client.run(
cudf.get_option, "spill",
)
for v in cudf_spill.values():
assert v is False

cudf_spill_stats = await client.run(
cudf.get_option, "spill_stats",
)
for v in cudf_spill_stats.values():
assert v == 0


@gen_test(timeout=20)
async def test_cudf_spill():
cudf = pytest.importorskip("cudf")

async with LocalCUDACluster(
enable_cudf_spill=True,
cudf_spill_stats=2,
asynchronous=True,
) as cluster:
async with Client(cluster, asynchronous=True) as client:
cudf_spill = await client.run(
cudf.get_option, "spill",
)
for v in cudf_spill.values():
assert v is True

cudf_spill_stats = await client.run(
cudf.get_option, "spill_stats",
)
for v in cudf_spill_stats.values():
assert v == 2


@pytest.mark.parametrize(
"protocol",
["ucx", "ucxx"],
Expand Down

0 comments on commit 51a5201

Please sign in to comment.