pf_mpi_recv Subroutine

public subroutine pf_mpi_recv(pf, level, tag, blocking, ierror, direction)

Uses

  • proc~~pf_mpi_recv~~UsesGraph proc~pf_mpi_recv pf_mpi_recv module~pf_mod_mpi pf_mod_mpi proc~pf_mpi_recv->module~pf_mod_mpi

Subroutine to receive solutions Note when blocking == .false. this is actually a wait because the nonblocking receive should have already been posted

Arguments

Type IntentOptional AttributesName
type(pf_pfasst_t), intent(inout) :: pf

main pfasst structure

class(pf_level_t), intent(inout) :: level

level to recieve into

integer, intent(in) :: tag

message tag

logical, intent(in) :: blocking

true if receive is blocking

integer, intent(inout) :: ierror

error flag

integer, intent(in), optional :: direction

Calls

proc~~pf_mpi_recv~~CallsGraph proc~pf_mpi_recv pf_mpi_recv mpi_recv mpi_recv proc~pf_mpi_recv->mpi_recv mpi_wait mpi_wait proc~pf_mpi_recv->mpi_wait

Contents

Source Code


Source Code

  subroutine pf_mpi_recv(pf, level, tag, blocking, ierror, direction)
    use pf_mod_mpi, only:  MPI_STATUS_SIZE
    type(pf_pfasst_t), intent(inout) :: pf     !!  main pfasst structure
    class(pf_level_t), intent(inout) :: level  !!  level to recieve into
    integer,           intent(in   ) :: tag    !!  message tag
    logical,           intent(in   ) :: blocking  !!  true if receive is blocking
    integer,           intent(inout) :: ierror  !!  error flag
    integer, optional, intent(in)    :: direction
    integer                          :: source, dir
    integer ::  stat(MPI_STATUS_SIZE)

    dir = 1 ! default 1: send forward; set to 2 for send backwards
    if(present(direction)) dir = direction
    
    if(dir == 2) then
       source = modulo(pf%rank+1, pf%comm%nproc) 
    else
       source = modulo(pf%rank-1, pf%comm%nproc) 
    end if
    
    if (blocking) then
       call mpi_recv(level%recv, level%mpibuflen, myMPI_Datatype, &
                     source, tag, pf%comm%comm, stat, ierror)
    else
       call mpi_wait(pf%comm%recvreq(level%index), stat, ierror)
    end if
  end subroutine pf_mpi_recv