Output under MPI
See original GitHub issueIf I try to use rich output under MPI, I get blank lines. Here’s an example:
# test.py
from mpi4py import MPI
rank = MPI.COMM_WORLD.Get_rank()
from rich import print
print(rank)
mpirun -n 2 python3 test.py
Produces four blank lines.
Even if I wrap the output to only run on rank 0, i.e.,
if rank == 0:
from rich import print
print(rank)
I still get only blank lines (this time two of them).
What’s causing this, and how can I fix it?
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
Ordering Output in MPI - stdout - Stack Overflow
in a simple MPI program I have used a column wise division of a large matrix. How can I order the output so...
Read more >How to print out the output from each process in MPI programing
Hello everyone, I have a 2d dynamic array and I broadcasted it to all processors. I was wondering how I can print the...
Read more >8.2 MPI Basics
Figure 8.1: Basic MPI. These six functions suffice to write a wide range of parallel programs. The arguments are characterized as having mode...
Read more >MPI & output to file - Google Groups
I am currently using MPI parralelism to run Basilisk on the dutch national supercomputer. This works fine apart from one of the output...
Read more >Marginal Propensity to Invest (MPI): Definition and Calculation
The MPI is calculated as MPI = ΔI/ΔY, meaning the change in value of the investment function (I) with respect to the change...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, great. Thanks for figuring it out. I think this qualifies as a bug I should report upstream to OpenMPI. And the workaround is great, too.
I’ve figure out what is going on. When run with MPI, the
shutil.get_terminal_size
function reports a terminal size of (0, 0). Rich wraps text to the column width, and when you wrap to a width of 0 all you are left with is blank lines.I think this must be a bug in how MPI sets the environment for processes.
A workaround would be to define a
COLUMNS
environment var with your desired terminal width. Or construct Console with an explicit width.