Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indexing in ReduceScatter in hierarchical collective #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions examples/mscclang/allreduce_a100_pcie_hierarchical.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ def allpairs_reduce_scatter(gpuIds, size, offset):
if gpuIds[r1] != gpuIds[r2]:
index = offset + r2 * size
c = chunk(gpuIds[r1], Buffer.input, index, size=size)
c.copy(gpuIds[r2], 'scratch', sendtb=gpuIds[r2], recvtb=gpuIds[r1])
c.copy(gpuIds[r2], 'scratch', index=r1*size, sendtb=gpuIds[r2], recvtb=gpuIds[r1])

# Each rank performs a local reduction on the nth chunk
# Utilize 8 threadblocks for this reduction for better parallelism
for r in range(ngpus):
for index in range(0, size * (ngpus-1)):
for index in range(0, size):
c = chunk(gpuIds[r], Buffer.input, offset + r*size + (index % size))
c.reduce(chunk(gpuIds[r], 'scratch', index), sendtb=(index % size))
for r2 in range(ngpus):
if gpuIds[r] != gpuIds[r2]:
c.reduce(chunk(gpuIds[r], 'scratch', (r2 * size) + index), sendtb=(index % size))


def allpairs_all_gather(gpuIds, size, offset):
Expand Down
Loading