Copy construction of VariableSizeCommunicator leads to runtime errors.
VariableSizeCommunicator
does not have copy constructors (or assignment operator) implemented.
The default generated constructor copies the MPI_Comm communication_
member without using MPI_Comm_dup
.
Thus, when the copy constructed object and its source both have a communication_
member pointing to the same data, which is double freed (by MPI_Comm_free
) when the objects get destructed. This could be fixed by writing a suitable copy constructor.
I only had a quick glance, but it seems that BufferedCommunicator
uses neither MPI_Comm_dup
nor MPI_Comm_free
and thus does not assume any responsibility for its data. Maybe this would be a viable approach, too.