Skip to content

Commit

Permalink
Log rank information (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbalioglu authored Feb 27, 2025
1 parent 8b85568 commit 4fc4c80
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/fairseq2/recipes/common/_gang.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,23 @@ def setup_gangs(context: RuntimeContext, recipe_config: object) -> Gangs:
log.info("Parallel gangs initialized.")

try:
return _maybe_setup_fsdp_gangs(context, recipe_config, gangs)
gangs = _maybe_setup_fsdp_gangs(context, recipe_config, gangs)
except GangError as ex:
raise ProgramError(
"The hybrid sharded data parallel gangs cannot set up. See the nested exception for details."
) from ex

s = (
f"Data: {gangs.dp.rank} | "
f"Data/Replicated: {gangs.rdp.rank} | "
f"Data/Sharded: {gangs.sdp.rank} | "
f"Tensor: {gangs.tp.rank}"
)

log.info("Process Ranks - {}", s)

return gangs


def _maybe_setup_fsdp_gangs(
context: RuntimeContext, recipe_config: object, gangs: Gangs
Expand Down

0 comments on commit 4fc4c80

Please sign in to comment.