Skip to content

Make GPU tests safe to collect on CPU-only hosts - #98

Draft
ZhiyaoWen999 wants to merge 1 commit into
MoonshotAI:mainfrom
ZhiyaoWen999:fix/cpu-only-test-collection
Draft

Make GPU tests safe to collect on CPU-only hosts#98
ZhiyaoWen999 wants to merge 1 commit into
MoonshotAI:mainfrom
ZhiyaoWen999:fix/cpu-only-test-collection

Conversation

@ZhiyaoWen999

Copy link
Copy Markdown

Summary

  • Defer accelerator discovery for GPU-marked tests to a pytest fixture.
  • Build device-dependent rank cases at test runtime instead of collection time.
  • Initialize device managers inside worker processes.
  • Skip GPU/NPU tests cleanly when the required accelerator is unavailable.

Root cause

GPU/NPU test modules initialized DeviceManager and evaluated device counts during module import and parameter collection. On CPU-only hosts, this could fail before pytest applied the -m "not gpu" filter.

Validation

  • pytest -v -m "not gpu" tests — 55 passed, 1 skipped, 6 deselected
  • pytest -q tests — 55 passed, 7 skipped
  • ruff check .
  • ruff format --check .

Closes #95

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.

Make GPU/NPU test collection safe on CPU-only hosts

1 participant