Skip to content

RFE: optimize FORM TEAM by removing extra barrier #630

@nathanweeks

Description

@nathanweeks

Execution of a FORM TEAM statement results in the following calls to MPI routines in mpi_caf.c:

void PREFIX(form_team) (...)
{
...
  MPI_Comm *current_comm = &CAF_COMM_WORLD;
...
  ierr = MPI_Barrier(CAF_COMM_WORLD); chk_err(ierr);
...
  ierr = MPI_Comm_split(*current_comm, team_id, caf_this_image, newcomm);
...
}

MPI_Comm_split() is effectively a barrier: no MPI processes in CAF_COMM_WORLD can return from MPI_Comm_split() until all MPI processes in CAF_COMM_WORLD have called it. It seems that the aforementioned MPI_Barrier could be removed while still maintaining the FORM TEAM synchronization semantics as specified in the Fortran 2018 (N2146 draft):

11.6.9 FORM TEAM statement
...
5 ...When a FORM TEAM statement is executed, there is an implicit synchronization of all active images in the current team. On those images, execution of the segment following the statement is delayed until all other active images in the current team have executed the same statement the same number of times in this team. The segments that executed before the FORM TEAM statement on an active image of this team precede the segments that execute after the FORM TEAM statement on another active image of this team...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions