Skip to content

fix 06-inter-node-reduce-scatter.py tutorial bug#130

Open
AkiRusProd wants to merge 1 commit intoByteDance-Seed:mainfrom
AkiRusProd:fix_rs_internode_tutorial
Open

fix 06-inter-node-reduce-scatter.py tutorial bug#130
AkiRusProd wants to merge 1 commit intoByteDance-Seed:mainfrom
AkiRusProd:fix_rs_internode_tutorial

Conversation

@AkiRusProd
Copy link
Copy Markdown

@AkiRusProd AkiRusProd commented Oct 10, 2025

Hello!

In the create_reduce_scater_2d_ctx method of 06-inter-node-reduce-scatter.py tutorial. the global process rank was used to index the signal_bufs list during the initialization of signal_buf.

This resulted in an IndexError on any node other than the first (i.e., when rank >= local_world_size).

What is the solution?
The indexing for the signal_bufs list has been corrected to use local_rank instead of the global rank:

- signal_buf = signal_bufs[rank]
+ signal_buf = signal_bufs[local_rank]

This change ensures that each process on a node correctly accesses its dedicated signal buffer from the list of local buffers. It resolves the crash and enables the proper initialization of the communication context for multi-node environments.

NOTE:
from nvshmem_create_tensors:

rank_on_same_node_start = rank - local_rank
rank_on_same_node_end = rank_on_same_node_start + local_world_size

so then
len(signal_bufs) = rank_on_same_node_end - rank_on_same_node_start = (rank_on_same_node_start + local_world_size) - rank_on_same_node_start = local_world_size

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 10, 2025

CLA assistant check
All committers have signed the CLA.

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.

2 participants