Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ def _try_read_new_reqs_normal(self):
self.node_broadcast_tensor.fill_(1)
else:
self.node_broadcast_tensor.fill_(0)
dist.broadcast(self.node_broadcast_tensor, src=0, group=self.node_nccl_group, async_op=False)

src_rank_id = self.args.node_rank * self.node_world_size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The calculation for src_rank_id can be simplified by deriving it from the existing rank properties of the class. The global rank of the master process in the node can be calculated as self.global_rank - self.rank_in_node. This avoids a direct dependency on self.args and leverages the established distributed rank properties, which can improve code consistency and maintainability.

src_rank_id = self.global_rank - self.rank_in_node

dist.broadcast(self.node_broadcast_tensor, src=src_rank_id, group=self.node_nccl_group, async_op=False)
new_buffer_is_ready = self.node_broadcast_tensor.detach().item()
if new_buffer_is_ready:
self._read_reqs_buffer_and_init_reqs()
Expand Down