split_all Subroutine

public subroutine split_all(col)

A routine to split the global communicator into sub-groups based on each procs specific colour "col". mp_comm is then overwritten to be the new split communicator This is different to job fork, which has the group and global communicators. The global communicator is replaced. This action can be undone with unsplit_all If the old mp_comm is not mpi_comm_world, you should make sure you have saved its value somewhere before calling this so that its value can be saved.

Arguments

Type IntentOptional Attributes Name
integer, intent(inout) :: col

Processors colour


Contents

Source Code


Source Code

  subroutine split_all (col)
    implicit none
    integer, intent(inout) :: col !< Processors colour
#ifdef MPI
    integer :: ierror, new_comm
!    if (scope == subprocs) then
!      write (*,*) 'Can only call split_all with global scope'
!      call mpi_abort(comm_all, 1, ierror)
!    end if
!$OMP MASTER
    call time_message(.false., time_mp_other, ' MPI Overheads')
!$OMP END MASTER
    !Split the comm group, note we use a constant key of 0 across all procs
    !meaning that the rank order is the same in the old and new communicators
    call mpi_comm_split(comm_all,col,aproc,new_comm,ierror)
    comm_all = new_comm
    call mpi_comm_size (comm_all, ntot_proc, ierror)
    call mpi_comm_rank (comm_all, aproc, ierror)
!$OMP MASTER
    call time_message(.false., time_mp_other, ' MPI Overheads')
!$OMP END MASTER
    aproc0 = aproc == 0
    call scope (allprocs)
#else
    UNUSED_DUMMY(col)
#endif
  end subroutine split_all