I am trying to create an MPI group using mpi4py. My current attempt looks like this:
from mpi4py import MPI
comm = MPI.COMM_WORLD
newGroup = comm.group.Excl([0, 1, 2])
print newGroup.size
newComm = comm.Create_group(newGroup)
print newComm
print newComm.Get_size()
The newGroup.size
call does return 2 (I started the application with 5 processes) and the newComm
variable indicates to be a communicator. But as soon as I try to call Get_size
an exception is thrown:
mpi4py.MPI.Exception: MPI_ERR_COMM: invalid communicator
How can I create a new communicator based on a predefined sequence of process IDs?