ompi icon indicating copy to clipboard operation
ompi copied to clipboard

MPI-4: Singleton init and MPI_Comm_create_from_group()

Open dalcinl opened this issue 3 years ago • 0 comments

Reproducer

from mpi4py import MPI

SELF  = MPI.COMM_SELF
group = SELF.Get_group()
comm = MPI.Intracomm.Create_from_group(group)
print(f"{(comm == SELF) = }")
print(f"{MPI.Comm.Compare(comm, SELF) = }")
comm.Free()
group.Free()

print()

WORLD = MPI.COMM_WORLD
group = WORLD.Get_group()
comm = MPI.Intracomm.Create_from_group(group)
print(f"{(comm == WORLD) = }")
print(f"{MPI.Comm.Compare(comm, WORLD) = }")
comm.Free()
group.Free()

Output

Running under mpiexec with 1 MPI process produces the expected output:

$ mpiexec -n 1 python tmp4.py 
(comm == SELF) = False
MPI.Comm.Compare(comm, SELF) = 1

(comm == WORLD) = False
MPI.Comm.Compare(comm, WORLD) = 1

However, running in singleton mode, the output is different (and incorrect) for COMM_WORLD:

$ python test.py 
(comm == SELF) = False
MPI.Comm.Compare(comm, SELF) = 1

(comm == WORLD) = False
MPI.Comm.Compare(comm, WORLD) = 0

as the communicator handles are not equal, the last line should print 1 (the value of MPI_CONGRUENT) and not 0 (MPI_IDENT).

@jjhursey @hppritcha One of you guys should figure out quickly what's going on.

dalcinl avatar Aug 31 '22 12:08 dalcinl