mp_isendrecv_i Subroutine

private subroutine mp_isendrecv_i(msgin, dest, msgout, source, comm, send_request, recv_request, tag)

Non-blocking send and receive of a scalar

Implementation Calls mpi_isend and mpi_irecv.

Arguments

Type IntentOptional Attributes Name
integer(kind=int_4) :: msgin

Scalar data to send

integer, intent(in) :: dest

Which process to send to

integer(kind=int_4) :: msgout

Receive data into this pointer

integer, intent(in) :: source

Process to receive from

type(mp_comm_type), intent(in) :: comm

Message passing environment identifier

type(mp_request_type), intent(out) :: send_request

Request handle for the send Request handle for the receive

type(mp_request_type), intent(out) :: recv_request

Request handle for the send Request handle for the receive

integer, intent(in), optional :: tag

tag to differentiate requests


Source Code

      SUBROUTINE mp_isendrecv_i (msgin, dest, msgout, source, comm, send_request, &
                                             recv_request, tag)
      !! Non-blocking send and receive of a scalar
      !!
      !! Implementation
      !! Calls mpi_isend and mpi_irecv.

         INTEGER(KIND=int_4)                                :: msgin
         !! Scalar data to send
         INTEGER, INTENT(IN)                      :: dest
         !! Which process to send to
         INTEGER(KIND=int_4)                                :: msgout
         !! Receive data into this pointer
         INTEGER, INTENT(IN)                      :: source
         !! Process to receive from
         TYPE(mp_comm_type), INTENT(IN)           :: comm
         !! Message passing environment identifier
         TYPE(mp_request_type), INTENT(out)       :: send_request, recv_request
         !! Request handle for the send
         !! Request handle for the receive
         INTEGER, INTENT(in), OPTIONAL            :: tag
         !! tag to differentiate requests

         CHARACTER(LEN=*), PARAMETER :: routineN = 'mp_isendrecv_i'

         INTEGER                                  :: handle, ierr
#if defined(__parallel)
         INTEGER                                  :: my_tag
#endif

         ierr = 0
         CALL timeset(routineN, handle)

#if defined(__parallel)
         my_tag = 0
         IF (PRESENT(tag)) my_tag = tag

         CALL mpi_irecv(msgout, 1, MPI_INTEGER, source, my_tag, &
                        comm%handle, recv_request%handle, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_irecv @ "//routineN)

         CALL mpi_isend(msgin, 1, MPI_INTEGER, dest, my_tag, &
                        comm%handle, send_request%handle, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_isend @ "//routineN)

         CALL add_perf(perf_id=8, msg_size=2*int_4_size)
#else
         MARK_USED(dest)
         MARK_USED(source)
         MARK_USED(comm)
         MARK_USED(tag)
         send_request = mp_request_null
         recv_request = mp_request_null
         msgout = msgin
#endif
         CALL timestop(handle)
      END SUBROUTINE mp_isendrecv_i