Skip to content

test(odc): add unit/integration tests for ODC (PR #864)#899

Open
botaohu001 wants to merge 2 commits into
mainfrom
test/odc-unit-tests
Open

test(odc): add unit/integration tests for ODC (PR #864)#899
botaohu001 wants to merge 2 commits into
mainfrom
test/odc-unit-tests

Conversation

@botaohu001

Copy link
Copy Markdown
Contributor

Added CPU-only test, covering ODC assembly logic; GPU/rocSHMEM-turbo parts are cleanly skipped.
tests/runner/test_odc_run_launcher.sh (registered into run_all_tests.sh): Tests the startup/configuration assembly of run_odc.sh—backend environment (mori vs rocshmem), pad|nopad no-op, PYTHONPATH can import odc, PRIMUS_TURBO_PATH is set to the front, KEY=VAL is passed through, EXP/exp-name/MASTER_PORT, and the ODC switch is now a configuration item instead of the environment.
tests/trainer/test_odc_megatron_trainer.py (+ YAML fixture):
TestOdcRuntimeConfig: Configures the driver's runtime config (default values, override/None/unknown keys for set_config, gda_pipe→PRIMUS_TURBO_ODC_GDA_PIPE bridging, odc package re-export).
TestOdcPatchWiring: Registers and gates three before_train patches (enable_odc/use_torch_fsdp2/enable_odc_lb_mini), LB-Mini alignment/decoupling, skips #856 device_id under ODC, config→runtime bridging (skips if no torch).
TestOdcConfigFixture: The fixture indeed declares the ODC FSDP2 path.
TestOdcMegatronTrainerE2E: FSDP2 training smoke test, cleanly skipped without GPU + turbo.

Add CPU-only tests that exercise the ODC feature wiring and gate the
GPU/rocSHMEM-turbo parts behind clean skips.

tests/runner/test_odc_run_launcher.sh (registered in run_all_tests.sh):
  Bash unit test for run_odc.sh launch/config wiring -- mori vs rocshmem
  backend env, the pad|nopad no-op arg, PYTHONPATH so `import odc` resolves,
  PRIMUS_TURBO_PATH prepend, extra KEY=VAL export, EXP/exp-name/MASTER_PORT
  plumbing, and that ODC feature switches are now config items, not env.

tests/trainer/test_odc_megatron_trainer.py (+ .yaml fixture):
  - TestOdcRuntimeConfig: stdlib-only unit tests for the config-driven ODC
    runtime config (defaults, set_config override/None/unknown handling, the
    gda_pipe -> PRIMUS_TURBO_ODC_GDA_PIPE bridge, odc package re-exports).
  - TestOdcPatchWiring: before_train patch registration + enable_odc /
    use_torch_fsdp2 / enable_odc_lb_mini gating, LB-Mini aligned-vs-decoupled
    mode, the #856 device_id patch skip under ODC, and the trainer-config ->
    runtime-config bridge. Skips where torch is unavailable.
  - TestOdcConfigFixture: asserts the fixture declares the ODC FSDP2 path.
  - TestOdcMegatronTrainerE2E: FSDP2 pretrain smoke test that skips cleanly
    without ROCm GPU + Primus-Turbo rocSHMEM ops.

Co-authored-by: Cursor <cursoragent@cursor.com>
gates exactly on the ODC config items. No training is run.
"""

def _import_patches(self, dotted: str):
…sence

The E2E smoke needs Primus-Turbo built WITH the rocSHMEM ops (a stock/pip
primus_turbo is compiled with -DDISABLE_ROCSHMEM and has neither op). Replace
the coarse find_spec("primus_turbo") guard with a hasattr check for the op this
single-node rocshmem fixture uses (odc_rocshmem_host), so a "GPU present but
turbo lacks ODC ops" host skips cleanly instead of crashing mid-run. Comment
points to building a host-capable Primus-Turbo per the repro guide (§6.3).

Co-authored-by: Cursor <cursoragent@cursor.com>
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