I am trying to understand how Fenics works with mpirun. I execute the following in a terminal
mpirun -n 2 python3 check.py
where the contents of check.py are as follows
import dolfin as df
comm = df.MPI.comm_world
print('comm.size =', comm.size)
if comm.rank == 0:
for i in range(5):
print('Rank =', comm.rank, 'i =', i)
I get following output:
comm.size = 1
Rank = 0 i = 0
Rank = 0 i = 1
Rank = 0 i = 2
Rank = 0 i = 3
Rank = 0 i = 4
comm.size = 1
Rank = 0 i = 0
Rank = 0 i = 1
Rank = 0 i = 2
Rank = 0 i = 3
Rank = 0 i = 4
I can guess that I am getting 5 lines of output for each of the two processes. But why is the rank always printed as 0 and why is comm.size = 1?
Thank you very much for confirming. I am running Fenics 2019.1.0 inside docker container. But I made my own docker container based on the original Dockerfile because I needed to install scipy inside it. I will try to use the original docker container and cross-check.