  Collective communications, namely the patterns allgatherv, reduce_scatter,
and allreduce in message-passing systems are optimised based on measurements at
the installation time of the library. The algorithms used are set up in an
initialisation phase of the communication, similar to the method used in
so-called persistent collective communication introduced in the literature. For
allgatherv and reduce_scatter the existing algorithms, recursive
multiply/divide and cyclic shift (Bruck's algorithm) are applied with a
flexible number of communication ports per node. The algorithms for equal
message sizes are used with non-equal message sizes together with a heuristic
for rank reordering. The two communication patterns are applied in a plasma
physics application that uses a specialised matrix-vector multiplication. For
the allreduce pattern the cyclic shift algorithm is applied with a prefix
operation. The data is gathered and scattered by the cores within the node and
the communication algorithms are applied across the nodes. In general our
routines outperform the non-persistent counterparts in established MPI
libraries by up to one order of magnitude or show equal performance, with a few
exceptions of number of nodes and message sizes.
