File: test_external_memory.py

package info (click to toggle)
xgboost 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 13,796 kB
  • sloc: cpp: 67,502; python: 35,503; java: 4,676; ansic: 1,426; sh: 1,320; xml: 1,197; makefile: 204; javascript: 19
file content (28 lines) | stat: -rw-r--r-- 795 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Copyright 2024, XGBoost contributors"""

import pytest
from distributed import Client, Scheduler, Worker
from distributed.utils_test import gen_cluster

from xgboost import testing as tm
from xgboost.testing.dask import check_external_memory, get_rabit_args


@pytest.mark.parametrize("is_qdm", [True, False])
@gen_cluster(client=True)
async def test_external_memory(
    client: Client, s: Scheduler, a: Worker, b: Worker, is_qdm: bool
) -> None:
    workers = tm.dask.get_client_workers(client)
    n_workers = len(workers)
    args = await get_rabit_args(client, n_workers)

    futs = client.map(
        check_external_memory,
        range(n_workers),
        n_workers=n_workers,
        device="cpu",
        comm_args=args,
        is_qdm=is_qdm,
    )
    await client.gather(futs)