Change using_mpi test
I've run into a new bug with the current bilby implementation of pymultinest. There is a new environment variable that comes up by default called VT_MPI
, which triggers this clause to always set using_mpi
to True
. I've changed this clause to instead check that MPI.COMM_WORLD.Get_size()>1
. I've tested this with a simple Hello World script as follows:
from mpi4py import MPI
import sys
import os
size = MPI.COMM_WORLD.Get_size()
rank = MPI.COMM_WORLD.Get_rank()
name = MPI.Get_processor_name()
using_mpi = (MPI.COMM_WORLD.Get_size()>1)
print(using_mpi)
sys.stdout.write(
"Hello, World! I am process %d of %d on %s.\n"
% (rank, size, name))
which produces the following output
> python test_mpi.py
False
Hello, World! I am process 0 of 1 on ldas-pcdev3.
> mpiexec -n 4 python test_mpi.py
True
Hello, World! I am process 1 of 4 on ldas-pcdev3.
True
Hello, World! I am process 3 of 4 on ldas-pcdev3.
True
Hello, World! I am process 2 of 4 on ldas-pcdev3.
True
Hello, World! I am process 0 of 4 on ldas-pcdev3.