Skip to content

Commit

Permalink
if statement for comm.reduce is not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jussienko committed Jan 25, 2019
1 parent b6e4963 commit afa6b1c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions demos/mpi-reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@

data = arange(size * 10, dtype=float) * (rank + 1)
buffer = empty(size * 10, float)
if rank == 0:
n = comm.reduce(rank, op=MPI.SUM, root=0) # returns the value
else:
comm.reduce(rank, op=MPI.SUM, root=0)

n = comm.reduce(rank, op=MPI.MAX, root=0) # returns the value
comm.Reduce(data, buffer, op=MPI.SUM, root=0) # in-place modification

if rank == 0:
Expand Down

0 comments on commit afa6b1c

Please sign in to comment.