from mpi4py import MPI comm = MPI.COMM_WORLD # communicator size = comm.Get_size() # world size, that is number of MPI workers are around rank = comm.Get_rank() # index of the process running this code print(f'comm = {comm}') print(f'size = {size}') print(f'rank = {rank}')