mp_isendrecv_d Subroutine

private subroutine mp_isendrecv_d(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
real(kind=real_8) :: msgin

Scalar data to send

integer, intent(in) :: dest

Which process to send to

real(kind=real_8) :: 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_d (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.

         REAL(kind=real_8)                                :: msgin
         !! Scalar data to send
         INTEGER, INTENT(IN)                      :: dest
         !! Which process to send to
         REAL(kind=real_8)                                :: 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_d'

         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_DOUBLE_PRECISION, 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_DOUBLE_PRECISION, 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*real_8_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_d