Form.coefficients() and FormSum.coefficients() both use set to produce a unique collection of the coefficients. However, set does not have deterministic ordering. Form._analyze_form_arguments() uses sorted to make sure that the ordering is deterministic across MPI ranks and across multiple programme executions, but FormSum._analyze_form_arguments() doesn't.
This means that the ordering is sometimes different between different MPI ranks, which causes parallel hangs in MG code when a Function is sent to inject on one rank and a Cofunction is sent to restrict on another rank.
This PR just adds orders FormSum.coefficients() in the same way as Form.coefficients()
Form.coefficients()
andFormSum.coefficients()
both useset
to produce a unique collection of the coefficients. However,set
does not have deterministic ordering.Form._analyze_form_arguments()
usessorted
to make sure that the ordering is deterministic across MPI ranks and across multiple programme executions, butFormSum._analyze_form_arguments()
doesn't.This means that the ordering is sometimes different between different MPI ranks, which causes parallel hangs in MG code when a
Function
is sent toinject
on one rank and aCofunction
is sent torestrict
on another rank.This PR just adds orders
FormSum.coefficients()
in the same way asForm.coefficients()