Skip to content
This repository was archived by the owner on Aug 8, 2022. It is now read-only.

Commit c1b878d

Browse files
committed
Flush needed for "nice" printing
1 parent 16f1c57 commit c1b878d

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

demos/mpi-alltoall.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from mpi4py import MPI
22
import numpy as np
3+
import sys
34

45
comm = MPI.COMM_WORLD
56
rank = comm.Get_rank()
@@ -17,6 +18,7 @@
1718
for r in range(size):
1819
if rank == r:
1920
print("rank ", rank, data)
21+
sys.stdout.flush()
2022
comm.Barrier()
2123

2224
comm.Alltoall(data, recv_buf)
@@ -25,11 +27,13 @@
2527
if rank == 0:
2628
print()
2729
print("Final data")
30+
sys.stdout.flush()
2831
comm.Barrier()
2932

3033
for r in range(size):
3134
if rank == r:
3235
print("rank ", rank, recv_buf)
36+
sys.stdout.flush()
3337
comm.Barrier()
3438

3539

demos/mpi-bcast.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from mpi4py import MPI
22
import numpy as np
3+
import sys
34

45
comm = MPI.COMM_WORLD
56
rank = comm.Get_rank()
@@ -14,16 +15,19 @@
1415

1516
if rank == 0:
1617
print("Original data")
18+
sys.stdout.flush()
1719
comm.Barrier()
1820

1921
print("rank ", rank, data)
22+
sys.stdout.flush()
2023

2124
comm.Bcast(data, root=0)
2225

2326
comm.Barrier()
2427
if rank == 0:
2528
print()
2629
print("Final data")
30+
sys.stdout.flush()
2731
comm.Barrier()
2832

2933
print("rank ", rank, data)

demos/mpi-gather.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from mpi4py import MPI
22
import numpy as np
3+
import sys
34

45
comm = MPI.COMM_WORLD
56
rank = comm.Get_rank()
@@ -16,16 +17,19 @@
1617

1718
if rank == 0:
1819
print("Original data")
20+
sys.stdout.flush()
1921
comm.Barrier()
2022

2123
print("rank ", rank, data)
24+
sys.stdout.flush()
2225

2326
comm.Gather(data, recv_buf, root=0)
2427

2528
comm.Barrier()
2629
if rank == 0:
2730
print()
2831
print("Final data")
32+
sys.stdout.flush()
2933
comm.Barrier()
3034

3135
print("rank ", rank, recv_buf)

demos/mpi-scatter.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from mpi4py import MPI
22
import numpy as np
3+
import sys
34

45
comm = MPI.COMM_WORLD
56
rank = comm.Get_rank()
@@ -16,16 +17,19 @@
1617

1718
if rank == 0:
1819
print("Original data")
20+
sys.stdout.flush()
1921
comm.Barrier()
2022

2123
print("rank ", rank, data)
24+
sys.stdout.flush()
2225

2326
comm.Scatter(data, recv_buf, root=0)
2427

2528
comm.Barrier()
2629
if rank == 0:
2730
print()
2831
print("Final data")
32+
sys.stdout.flush()
2933
comm.Barrier()
3034

3135
print("rank ", rank, recv_buf)

0 commit comments

Comments
 (0)