Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- check-nightly-ci
- changed-files
- checks
- pytest-entrypoint-tests
- clang-tidy
- conda-cpp-build
- conda-cpp-tests
Expand Down Expand Up @@ -286,6 +287,22 @@ jobs:
# Main builds seed this cache. PR merge refs can restore it but should not create
# duplicate archives that are inaccessible to other PRs.
pre-commit-cache-read-only: true
pytest-entrypoint-tests:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this job gets deleted but if you do keep it, I don't think it needs the NVIDIA-hosted runners and a conda env and the heavy rapidsai/ci-conda image. It seems to me that this could probably run on a GitHub-hosted ubuntu-latest runner, in a python:latest or similar image, and just be

pip install pytest
ci/test_pytest_entrypoint.sh

If you do keep this job, please consider that simplification.

permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
with:
build_type: pull-request
node_type: "cpu8"
arch: "amd64"
container_image: "rapidsai/ci-conda:27.02-latest"
script: "ci/test_pytest_entrypoint.sh"
artifact-name: pytest-entrypoint-tests
clang-tidy:
needs: checks
permissions:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ cpp/Doxyfile
compile_commands.json
.clangd/

# generally prefer 'pyproject.toml' to 'pytest.ini' for pytest options
# Prefer pyproject.toml; allow the isolated runner regression-test config.
# ref: https://github.com/NVIDIA/cuml/pull/6201
pytest.ini
!python/cuml/cuml_accel_tests/upstream/pytest.ini
!ci/tests/pytest.ini

# testing
python/cuml/cuml_accel_tests/upstream/umap/umap-upstream
Expand Down
37 changes: 6 additions & 31 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,8 @@ If you want a list of the available C++ tests:
$ ctest --test-dir cpp/build -N
```

To run all Python tests, including multi-GPU algorithms, from the repo root:
```bash
$ cd python
$ pytest -v
```

To run only single-GPU algorithm tests:

```bash
$ pytest --ignore=cuml/tests/dask --ignore=cuml/tests/test_nccl.py
```

If you want a list of the available Python tests:
```bash
$ pytest cuml/tests --collect-only
```

**Note:** Some tests require `xgboost`. If running tests in conda devcontainers, you must install the `xgboost` conda package manually. See `dependencies.yaml` for version information.
For Python tests and focused local test execution, see
[Running Tests](docs/source/developer_guide/python/development.md#running-tests).

### Manual Process

Expand Down Expand Up @@ -236,23 +220,14 @@ From the repository root:
$ python -m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true python/cuml
```

To run Python tests (optional):

```bash
$ cd python
$ pytest -v
```

To run only single-GPU algorithm tests:
To run Python tests from the repository root:

```bash
$ pytest --ignore=cuml/tests/dask --ignore=cuml/tests/test_nccl.py
pytest -v
```

If you want a list of the available tests:
```bash
$ pytest cuml/tests --collect-only
```
See the [developer testing guide](docs/source/developer_guide/python/development.md#running-tests)
for focused selections and other suites.

### Custom Build Options

Expand Down
66 changes: 66 additions & 0 deletions ci/cuml_pytest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Repository-local pytest defaults, shared by developers and CI adapters."""

import copy
from pathlib import Path

import pytest

REPO = Path(__file__).resolve().parents[1]
PYTHON = REPO / "python/cuml"


def pytest_addoption(parser):
group = parser.getgroup("cuML options")
group.addoption(
"--cuml-suite",
choices=(
"standard",
"dask",
"accel",
"cudf-pandas",
),
default="standard",
help=(
"Test suite and execution configuration. "
"standard (default) runs cuML's single-GPU Python tests, excluding "
"Dask and accelerator suites. "
"Explicit pytest targets replace the default collection target."
),
)


@pytest.hookimpl(tryfirst=True)
def pytest_load_initial_conftests(early_config, parser, args):
options = parser.parse_known_args(args)
suite = options.cuml_suite
targets = {
"standard": PYTHON / "tests",
"dask": PYTHON / "tests/dask",
"accel": PYTHON / "cuml_accel_tests",
"cudf-pandas": PYTHON / "tests",
}
# Let pytest parse its own arguments: -k/-m/-n and their values are not
# collection targets. Do not append a default to explicit selections.
if not options.file_or_dir:
args.append(str(targets[suite]))
if suite in ("standard", "cudf-pandas"):
# Options must precede --, which makes all following args targets.
index = args.index("--") if "--" in args else len(args)
args.insert(index, f"--ignore={PYTHON / 'tests/dask'}")
if suite == "cudf-pandas":
early_config.pluginmanager.import_plugin("cudf.pandas")
from cudf.pandas import install

install()
_refresh_initial_args(early_config, parser, args)


def _refresh_initial_args(config, parser, args):
# Initial conftest discovery uses the pre-parsed namespace, not args.
# Keep both in sync so newly selected suites load their conftests early.
config.known_args_namespace = parser.parse_known_args(
args, namespace=copy.copy(config.known_args_namespace)
)
8 changes: 0 additions & 8 deletions ci/run_cuml_dask_pytests.sh

This file was deleted.

8 changes: 0 additions & 8 deletions ci/run_cuml_integration_pytests.sh

This file was deleted.

8 changes: 0 additions & 8 deletions ci/run_cuml_singlegpu_accel_pytests.sh

This file was deleted.

8 changes: 0 additions & 8 deletions ci/run_cuml_singlegpu_pytests.sh

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We rely on these ci/run_* files to have a way to invoke that tests that isn't tightly coupled to being on GitHub in cuML's open source CI.

That's useful in local development, hardware bringup, DLFW builds, etc.

That's why they were introduced in the first place: #5761

Can we please keep these?

cross-ref: rapidsai/build-planning#269

This file was deleted.

20 changes: 20 additions & 0 deletions ci/test_pytest_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# CPU-only tests of pytest entrypoint behavior; no cuML build or GPU is needed.
set -euo pipefail
REPO=$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")
cd "${REPO}"

source /opt/conda/etc/profile.d/conda.sh
rapids-logger "Create minimal pytest-entrypoint-test environment"
rapids-mamba-retry create --yes --name pytest-entrypoint-tests --override-channels \
--channel conda-forge python=3.12 pytest packaging pyyaml cmake git

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--channel conda-forge python=3.12 pytest packaging pyyaml cmake git
--channel conda-forge python=3.12 pytest

Most of these dependencies seem unnecessary.

git must by definition already exist here, if this is running on a checkout of the repo.

conda activate pytest-entrypoint-tests

# The shared CPU workflow uploads this directory even when the script fails.
REPORT_DIR="${RAPIDS_ARTIFACTS_DIR:-${REPO}/artifacts}/pytest-entrypoint-tests"
mkdir -p "${REPORT_DIR}"
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
python -m pytest ci/tests --junitxml="${REPORT_DIR}/junit.xml"
6 changes: 4 additions & 2 deletions ci/test_python_dask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ set +e

# Keep both transport reports; the UCXX run must not overwrite the TCP run.
rapids-logger "pytest cuml-dask (No UCXX)"
timeout -v --signal=SIGINT --kill-after=60s 1h ./ci/run_cuml_dask_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 1h python -m pytest --cuml-suite=dask \
--cache-clear --durations=100 --durations-min=1 \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml-dask.xml"

rapids-logger "pytest cuml-dask (UCXX only)"
timeout -v --signal=SIGINT --kill-after=60s 10m ./ci/run_cuml_dask_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 10m python -m pytest --cuml-suite=dask \
--cache-clear --durations=100 --durations-min=1 \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml-dask-ucxx.xml" --run_ucx

rapids-logger "Test script exiting with value: $EXITCODE"
Expand Down
5 changes: 3 additions & 2 deletions ci/test_python_integration.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Support invoking test_python_singlegpu.sh outside the script directory
Expand All @@ -13,7 +13,8 @@ trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest cuml integration"
timeout -v --signal=SIGINT --kill-after=60s 1h ./ci/run_cuml_integration_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 1h python -m pytest --cuml-suite=cudf-pandas \
--cache-clear --durations=100 --durations-min=1 --quick_run \
--numprocesses=8 \
--dist=worksteal \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml.xml"
Expand Down
8 changes: 5 additions & 3 deletions ci/test_python_singlegpu.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Support invoking test_python_singlegpu.sh outside the script directory
Expand All @@ -21,13 +21,15 @@ trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest cuml single GPU"
timeout -v --signal=SIGINT --kill-after=60s 1h ./ci/run_cuml_singlegpu_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 1h python -m pytest --cuml-suite=standard \
--cache-clear --durations=100 --durations-min=1 \
--numprocesses=8 \
--dist=worksteal \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml.xml"

rapids-logger "pytest cuml accelerator"
timeout -v --signal=SIGINT --kill-after=60s 15m ./ci/run_cuml_singlegpu_accel_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 15m python -m pytest --cuml-suite=accel \
--cache-clear --durations=100 --durations-min=1 \
--numprocesses=8 \
--dist=worksteal \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml-accel.xml"
Expand Down
9 changes: 6 additions & 3 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,25 @@ rapids-logger "Testing libcuml linkage"
python -m pytest --cache-clear python/libcuml/tests/test_libcuml_linkage.py -v

rapids-logger "pytest cuml single GPU"
timeout -v --signal=SIGINT --kill-after=60s 1h ./ci/run_cuml_singlegpu_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 1h python -m pytest --cuml-suite=standard \
--cache-clear --durations=100 --durations-min=1 \
--numprocesses=8 \
--dist=worksteal \
-k 'not test_sparse_pca_inputs' \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml.xml"

if [[ "${RAPIDS_DEPENDENCIES:-}" == "nightly" ]]; then
rapids-logger "pytest cuml accelerator"
timeout -v --signal=SIGINT --kill-after=60s 15m ./ci/run_cuml_singlegpu_accel_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 15m python -m pytest --cuml-suite=accel \
--cache-clear --durations=100 --durations-min=1 \
--numprocesses=8 \
--dist=worksteal \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml-accel.xml"
fi

# Run test_sparse_pca_inputs separately
timeout -v --signal=SIGINT --kill-after=60s 10m ./ci/run_cuml_singlegpu_pytests.sh \
timeout -v --signal=SIGINT --kill-after=60s 10m python -m pytest --cuml-suite=standard \
--cache-clear --durations=100 --durations-min=1 \
-k 'test_sparse_pca_inputs' \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuml-sparse-pca.xml"

Expand Down
3 changes: 2 additions & 1 deletion ci/test_wheel_dask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest cuml dask"
timeout -v --signal=SIGINT --kill-after=60s 1h ./ci/run_cuml_dask_pytests.sh --junitxml="${RAPIDS_TESTS_DIR}/junit-cuml-dask.xml"
timeout -v --signal=SIGINT --kill-after=60s 1h python -m pytest --cuml-suite=dask \
--cache-clear --durations=100 --durations-min=1 --junitxml="${RAPIDS_TESTS_DIR}/junit-cuml-dask.xml"

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
5 changes: 5 additions & 0 deletions ci/tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

[pytest]
addopts = -ra

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a LOT of complexity... do we really need pytest tests on the custom pytest entrypoint that runs cuML's pytest tests?

If so I'd at least remove this file and just stick -ra in the script that runs test_pytest_entrypoint.py, to reduce the number of competing sources of configuration.

But IMO this whole ci/tests and the corresponding CI job should just be deleted.

Loading
Loading