Skip to content

ci(test): experiment with -n 8 xdist workers#1500

Closed
ramakrishnap-nv wants to merge 7 commits into
mainfrom
feat/pytest-xdist-n8-test
Closed

ci(test): experiment with -n 8 xdist workers#1500
ramakrishnap-nv wants to merge 7 commits into
mainfrom
feat/pytest-xdist-n8-test

Conversation

@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator

Summary

Testing -n 8 for both run_cuopt_pytests.sh and run_cuopt_server_pytests.sh, per bdice's comment on #1486:

Generally we use -n 6 or -n 8 in most of RAPIDS. The safe maximum depends on the GPU memory usage of your tests, not the number of CPU cores! Try to design it to run safely on a 16GB GPU.

Base PR #1486 uses -n 2 (conservative). This PR tests whether -n 8 is stable across all GPU types in the matrix, including the V100 (16GB) and L4 (24GB).

What to watch

  • Any cudaErrorInvalidDevice or cudaErrorMemoryAllocation in routing/LP tests → GPU pressure too high
  • Any gRPC port conflicts in test_cpu_only_execution.py → port gap insufficient (gap is 100 units, safe for up to 99 workers)
  • Test timing vs -n 2 baseline (~3m 48s cuopt, ~5m 34s server)

🤖 Generated with Claude Code

ramakrishnap-nv and others added 7 commits June 26, 2026 17:01
Add pytest-xdist to test_python_common dependencies and pass -n auto
to the non-nightly cuopt pytest invocation to parallelize tests across
available CPUs. Server tests are excluded due to fixed-port binding
(localhost:18900). The run_cuopt_pytests.sh script already cd-s into
python/cuopt/cuopt where xdist+coverage is known to work.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
-n auto caused two failures:
- cudaErrorInvalidDevice: too many workers competing for the same GPU
- warmstart timeout: two workers starting gRPC servers on the same port

Switch to -n 2 to limit GPU contention. Fix the gRPC port conflict in
_start_grpc_server_fixture by adding the xdist worker ID (from
PYTEST_XDIST_WORKER) to the port, giving each worker a unique port
within the 100-unit gap between fixture classes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
-n 2 passed cleanly; try -n 4 for more parallelism. The CI GPUs
(L4/24GB, H100/80GB, RTX Pro 6000/48GB) have enough VRAM for 4
concurrent CUDA contexts without contention.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
-n 4 is untested across all GPU types; stay conservative at -n 2
which is known clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
Add -n 2 to run_cuopt_server_pytests.sh. Fix the port conflict by
introducing _worker_port() in utils.py, which offsets the base port
(5555) by the xdist worker ID (from PYTEST_XDIST_WORKER). Both the
cuoptproc fixture and RequestClient default port now use _worker_port()
so each worker gets its own server instance on a unique port. Falls
back to 5555 when not running under xdist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
bdice notes RAPIDS generally uses -n 6 or -n 8; safe max depends on
GPU memory (target: 16GB). Testing -n 8 for both cuopt and server
tests to measure speedup vs stability tradeoff.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ramakrishnap-nv
ramakrishnap-nv changed the base branch from feat/pytest-xdist-python-tests to main July 1, 2026 21:05
@ramakrishnap-nv
ramakrishnap-nv deleted the feat/pytest-xdist-n8-test branch July 9, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant