Skip to content

fix(#712): forward MLPS_/MLPSTORAGE_ env vars via mpirun -x#713

Merged
FileSystemGuy merged 2 commits into
mainfrom
fix/712
Jul 8, 2026
Merged

fix(#712): forward MLPS_/MLPSTORAGE_ env vars via mpirun -x#713
FileSystemGuy merged 2 commits into
mainfrom
fix/712

Conversation

@FileSystemGuy

Copy link
Copy Markdown
Contributor

Summary

Fixes #712 — object-store checkpoint writes drop the s3:// scheme for every model-parallel shard that lands on a remote host.

Root cause

CheckpointingBenchmark.add_checkpoint_params (mlpstorage_py/benchmarks/dlio.py:963-988) strips the URI scheme from checkpoint.checkpoint_folder to sidestep DLIO's ObjStoreLibStorage._preflight double-prepend (fix from #583) and stashes the scheme in os.environ['MLPSTORAGE_CHECKPOINT_URI_SCHEME']. StorageWriterFactory and StorageReaderFactory reconstruct the URI at dispatch time via _normalize_checkpoint_uri, which reads that env var.

OpenMPI does not propagate arbitrary env vars to remote ranks by default. generate_dlio_command's existing -x allowlist covered AWS_* / S3DLIO_* / STORAGE_LIBRARY / BUCKET (#592) but not MLPSTORAGE_*. Under multi-host runs with --map-by node (the default in generate_mpi_prefix_cmd for multi-host) and llama3-70b at 64 procs (TP=8, PP=1):

  • head-node ranks inherit env directly → scheme reconstruction works
  • remote-node ranks never see MLPSTORAGE_CHECKPOINT_URI_SCHEME_normalize_checkpoint_uri no-ops → S3DLIOStorageWriter raises Unsupported URI scheme

Under --map-by node, mp_rank = my_rank % 8 lines up with node index, so mp_rank_0 = my_rank ∈ {0, 8, 16, …} all live on the head node and succeed, while mp_rank_1..7 all live on remote nodes and fail. Matches the reporter's observation exactly. Single-node subset runs (8 procs, one host) are unaffected because env is inherited without -x.

Change

Extend the -x allowlist to also match MLPS_ and MLPSTORAGE_ prefixes. Covers the concrete #712 trigger (MLPSTORAGE_CHECKPOINT_URI_SCHEME) plus the latent sibling MLPS_CHECKPOINT_MP_START_METHOD (streaming_checkpoint.py:88) that would fail the same way if a user overrode it on the driver shell.

The HPE Cray PALS mpiexec branch (utils.py:580-601) propagates env by default and doesn't touch this allowlist, so no PALS-side change is needed.

Symmetric coverage — read + write

Reads and writes both run inside the same DLIO invocation under one mpirun, so one -x addition covers both. _normalize_checkpoint_uri is symmetrically wired into StorageReaderFactory (fix from #641 / #649). This PR closes the multi-host read-path latent bug at the same time as the write-path reported one.

Test plan

RED-first, following the convention from #641:

  • Commit 1 (test(#712): RED) — 2 forwarding assertions + 2 absent-case invariants in tests/unit/test_mpi_s3_env_forwarding.py. Verified failing against origin/main.
  • Commit 2 (fix(#712)) — 4-line allowlist extension in mlpstorage_py/benchmarks/dlio.py. Verified GREEN.
  • Full CI matrix locally on fix/712:
    • tests — 2740 passed, 1 skipped, 13 deselected
    • mlpstorage_py/tests — 828 passed
    • vdb_benchmark/tests — 174 passed
    • kv_cache_benchmark/tests — 238 passed, 2 deselected
    • Total: 3980 passed, 0 failed

…MPI ranks

Two RED tests + two invariants for the class of bug where
mlpstorage-side env vars set on the driver process don't reach remote
MPI ranks because generate_dlio_command's -x allowlist only covers
AWS_/S3DLIO_/STORAGE_LIBRARY/BUCKET.

Concrete trigger (#712): MLPSTORAGE_CHECKPOINT_URI_SCHEME is set by
CheckpointingBenchmark.add_checkpoint_params (see #583) so the writer
and reader factories can put the object-store scheme back on the URI
that mlpstorage stripped for DLIO's ObjStoreLibStorage._preflight.
Without -x forwarding, remote ranks never see the env var and
S3DLIOStorageWriter raises 'Unsupported URI scheme' on every
model-parallel shard that lands off the head node.

MLPS_CHECKPOINT_MP_START_METHOD (streaming_checkpoint.py) is the same
latent bug — user overrides on the driver don't reach remote ranks.

The two invariants (absent MLPS_/MLPSTORAGE_ vars must not appear as
-x flags) pass without the fix and guard against overzealous
forwarding regressions.
CheckpointingBenchmark.add_checkpoint_params (dlio.py:963-988) strips
the URI scheme from checkpoint.checkpoint_folder to work around DLIO's
ObjStoreLibStorage._preflight double-prepend (see #583) and stashes
the scheme in os.environ[MLPSTORAGE_CHECKPOINT_URI_SCHEME]. The
StorageWriterFactory and StorageReaderFactory reconstruct the URI
via _normalize_checkpoint_uri, which reads that env var.

OpenMPI does not propagate arbitrary env vars to remote ranks by
default; generate_dlio_command's existing -x allowlist covered
AWS_/S3DLIO_/STORAGE_LIBRARY/BUCKET (#592) but not MLPSTORAGE_.
Consequence on multi-host runs (llama3-70b at 64 procs with TP=8 and
--map-by node): the head node's ranks inherit the env directly and
their scheme reconstruction works; every remote rank no-ops
_normalize_checkpoint_uri and S3DLIOStorageWriter raises
'Unsupported URI scheme' on every mp_rank>0 shard. 56 of 64 writes
fail, surviving ranks hang in the next collective, whole job wedges.

Extend the allowlist to also match MLPS_ and MLPSTORAGE_ prefixes.
Covers the concrete #712 trigger (MLPSTORAGE_CHECKPOINT_URI_SCHEME)
plus the latent sibling MLPS_CHECKPOINT_MP_START_METHOD (writer start
method knob in streaming_checkpoint.py) that would fail the same way
if a user overrode it on the driver.

The HPE Cray PALS mpiexec branch in generate_mpi_prefix_cmd propagates
env by default and doesn't touch this allowlist, so no PALS-side
change is needed.
@FileSystemGuy FileSystemGuy requested a review from a team July 8, 2026 00:48
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@FileSystemGuy FileSystemGuy merged commit 0a6bb2f into main Jul 8, 2026
4 checks passed
@FileSystemGuy FileSystemGuy deleted the fix/712 branch July 8, 2026 00:57
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.

Object-store checkpoint write drops the s3:// scheme for model-parallel shards (mp_rank > 0)

1 participant