Scrimbibete
Scrimbibete

Reputation: 182

python print statement issue when running with mpi

I have a parallel python code (based on mpi4py) that I run with mpirun -n ....

I have a print statement in this code that conditionally uses end="\r" during the unrolling of the code, or end="\n" at the last step of the code (so I can keep the last version of the line before printing new stuff). This line is only printed by process 0.

So basically:

for i in range(N):
 
 < some stuff >
 
 if (mpi.rank == 0):
  if (i < N-1): end = "\r"
  else: end = "\n"
  print("things, more things", end=end)

Thanks in advance for your suggestions, I'm out of ideas.

python 3.8.9
mpi4py 3.1.6
openmpi 5.0.3

Upvotes: 0

Views: 85

Answers (0)

Related Questions