Skip to content

Trouble with alive_bar in a mpi application #79

@alentner

Description

@alentner

I really enjoy using alive_progress in my projects; however, I am having trouble when used in a mpi environment.
Please see the following minimal example; works if executed as 'python3 test.py' and fails as 'mpirun -n 4 test.py':

##test.py
import time
from alive_progress import alive_bar
from mpi4py import MPI

def show_progress():                            
    with alive_bar(5000) as progress:                                
        for i in range(5000):                                
            time.sleep(0.001)                                
            progress()                                
                        
if __name__ == '__main__':                                
    if MPI.COMM_WORLD.Get_rank() == 0:                                
        show_progress()    ## This line does not output to the terminal
        show_bars()        ## This line works and outputs as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    get back toNeed more time or research

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions