Repository navigation
fix(train): pass the total rank count to mpirun -np in the MPI driver - #6440
Open
AkshayShah03 wants to merge 1 commit into
Open
AkshayShah03 wants to merge 1 commit into
AkshayShah03 wants to merge 1 commit into
Conversation
mpi_driver.main() passed the per-host process count as num_processes, which get_mpirun_command emits as 'mpirun -np'. -np is the total number of ranks, and the hosts are listed with per-host slots (algo-1:8,algo-2:8), so Open MPI placed all ranks on the first host: a 2-node job with process_count_per_node=8 ran 8 ranks on algo-1 and none on algo-2, and with one process per node only a single rank ran in total. The sagemaker-training-toolkit this logic follows uses processes_per_host * len(hosts). Pass process_count * host_count, in the sagemaker-train and sagemaker-core copies of the driver.
AkshayShah03
requested a deployment
to
manual-approval
October 12, 2026 17:59 — with
GitHub Actions
Waiting
AkshayShah03
requested a deployment
to
manual-approval
October 12, 2026 17:59 — with
GitHub Actions
Waiting
AkshayShah03
requested a deployment
to
manual-approval
October 12, 2026 17:59 — with
GitHub Actions
Waiting
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: N/A
Description of changes:
mpi_driver.main()passes the per-host process count asnum_processes, andget_mpirun_commandemits it asmpirun -np.-npis the total number of ranks, and the hosts are listed with per-host slots:Open MPI fills slots in order, so a 2-node job with
process_count_per_node=8runs all 8 ranks onalgo-1and none onalgo-2. With one process per node, only one rank runs in total. The sagemaker-training-toolkit this logic follows usesprocesses_per_host * len(hosts)(MasterRunnerinmpi.py).This change passes
process_count * host_count, in both the sagemaker-train and the sagemaker-core copies of the driver. The remote-functionmpirunscript inremote_function/job.pyhas the same pattern but predates v3, so I left it out of this PR.Testing:
test_mpi_driver_masternow assertshost_list == ["algo-1:2", "algo-2:2"]andnum_processes == 4. It fails before this change withnum_processes == 2.mpirunlocally; the fix follows Open MPI's-npsemantics and the toolkit's behaviour.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.