Skip to content

Commit 51a5201

Browse files
committed
Add cuDF spilling argument tests
1 parent e764a4e commit 51a5201

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

dask_cuda/tests/test_dask_cuda_worker.py

+63
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,69 @@ def test_rmm_logging(loop): # noqa: F811
231231
assert v is rmm.mr.LoggingResourceAdaptor
232232

233233

234+
def test_cudf_spill_disabled(loop): # noqa: F811
235+
cudf = pytest.importorskip("cudf")
236+
with popen(["dask", "scheduler", "--port", "9369", "--no-dashboard"]):
237+
with popen(
238+
[
239+
"dask",
240+
"cuda",
241+
"worker",
242+
"127.0.0.1:9369",
243+
"--host",
244+
"127.0.0.1",
245+
"--no-dashboard",
246+
]
247+
):
248+
with Client("127.0.0.1:9369", loop=loop) as client:
249+
assert wait_workers(client, n_gpus=get_n_gpus())
250+
251+
cudf_spill = client.run(
252+
cudf.get_option, "spill",
253+
)
254+
for v in cudf_spill.values():
255+
assert v is False
256+
257+
cudf_spill_stats = client.run(
258+
cudf.get_option, "spill_stats"
259+
)
260+
for v in cudf_spill_stats.values():
261+
assert v == 0
262+
263+
264+
def test_cudf_spill(loop): # noqa: F811
265+
cudf = pytest.importorskip("cudf")
266+
with popen(["dask", "scheduler", "--port", "9369", "--no-dashboard"]):
267+
with popen(
268+
[
269+
"dask",
270+
"cuda",
271+
"worker",
272+
"127.0.0.1:9369",
273+
"--host",
274+
"127.0.0.1",
275+
"--no-dashboard",
276+
"--enable-cudf-spill",
277+
"--cudf-spill-stats",
278+
"2",
279+
]
280+
):
281+
with Client("127.0.0.1:9369", loop=loop) as client:
282+
assert wait_workers(client, n_gpus=get_n_gpus())
283+
284+
cudf_spill = client.run(
285+
cudf.get_option, "spill"
286+
)
287+
for v in cudf_spill.values():
288+
assert v is True
289+
290+
cudf_spill_stats = client.run(
291+
cudf.get_option, "spill_stats"
292+
)
293+
for v in cudf_spill_stats.values():
294+
assert v == 2
295+
296+
234297
@patch.dict(os.environ, {"CUDA_VISIBLE_DEVICES": "0"})
235298
def test_dashboard_address(loop): # noqa: F811
236299
with popen(["dask", "scheduler", "--port", "9369", "--no-dashboard"]):

dask_cuda/tests/test_local_cuda_cluster.py

+44
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,50 @@ async def test_worker_fraction_limits():
500500
)
501501

502502

503+
@gen_test(timeout=20)
504+
async def test_cudf_spill_disabled():
505+
cudf = pytest.importorskip("cudf")
506+
507+
async with LocalCUDACluster(
508+
asynchronous=True,
509+
) as cluster:
510+
async with Client(cluster, asynchronous=True) as client:
511+
cudf_spill = await client.run(
512+
cudf.get_option, "spill",
513+
)
514+
for v in cudf_spill.values():
515+
assert v is False
516+
517+
cudf_spill_stats = await client.run(
518+
cudf.get_option, "spill_stats",
519+
)
520+
for v in cudf_spill_stats.values():
521+
assert v == 0
522+
523+
524+
@gen_test(timeout=20)
525+
async def test_cudf_spill():
526+
cudf = pytest.importorskip("cudf")
527+
528+
async with LocalCUDACluster(
529+
enable_cudf_spill=True,
530+
cudf_spill_stats=2,
531+
asynchronous=True,
532+
) as cluster:
533+
async with Client(cluster, asynchronous=True) as client:
534+
cudf_spill = await client.run(
535+
cudf.get_option, "spill",
536+
)
537+
for v in cudf_spill.values():
538+
assert v is True
539+
540+
cudf_spill_stats = await client.run(
541+
cudf.get_option, "spill_stats",
542+
)
543+
for v in cudf_spill_stats.values():
544+
assert v == 2
545+
546+
503547
@pytest.mark.parametrize(
504548
"protocol",
505549
["ucx", "ucxx"],

0 commit comments

Comments
 (0)