Skip to content

Commit 3233042

Browse files
committed
added an allgather example because I couldn't find one online for some reason
1 parent 56c0a93 commit 3233042

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

allgather_example.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from mpi4py import MPI
2+
3+
rank = MPI.COMM_WORLD.Get_rank()
4+
print("I am rank {} of {}".format(rank, MPI.COMM_WORLD.Get_size()))
5+
6+
ranks = MPI.COMM_WORLD.allgather(rank)
7+
8+
print(ranks)

0 commit comments

Comments
 (0)