I'm developing a cluster using mpi4py and when i run a basic script to test the cluster the result is weird:
the result should be this (script executed in c):
My code:
from mpi4py import MPI
world_comm = MPI.COMM_WORLD
world_size = world_comm.Get_size()
name = MPI.Get_processor_name()
my_rank = world_comm.Get_rank()
print('World Size: {0} | Name: {1} | Rank: {2}'.format(world_size,name,my_rank))
And the hostfile:
no02 slots=3
no01 slots=5
How could I get around this problem?
I managed to solve it as follows: I reinstalled mpi4py, but this time I passed the MPICC env before installation:
env MPICC=/usr/bin/mpicc pip3 install mpi4py --no-cache-dir
But you need to make sure the libopenmpi-dev
library is installed and then run the which mpicc
command and put it as a path in the env
in the above command