root/ompi/mpi/c/mrecv.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Mrecv

   1 /*
   2  * Copyright (c) 2011      Sandia National Laboratories. All rights reserved.
   3  * Copyright (c) 2012-2013 Cisco Systems, Inc.  All rights reserved.
   4  * Copyright (c) 2015      Research Organization for Information Science
   5  *                         and Technology (RIST). All rights reserved.
   6  * Copyright (c) 2018      The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * $COPYRIGHT$
  10  *
  11  * Additional copyrights may follow
  12  *
  13  * $HEADER$
  14  */
  15 
  16 #include "ompi_config.h"
  17 
  18 #include "ompi/mpi/c/bindings.h"
  19 #include "ompi/runtime/params.h"
  20 #include "ompi/mca/pml/pml.h"
  21 #include "ompi/memchecker.h"
  22 #include "ompi/request/request.h"
  23 #include "ompi/message/message.h"
  24 #include "ompi/runtime/ompi_spc.h"
  25 
  26 #if OMPI_BUILD_MPI_PROFILING
  27 #if OPAL_HAVE_WEAK_SYMBOLS
  28 #pragma weak MPI_Mrecv = PMPI_Mrecv
  29 #endif
  30 #define MPI_Mrecv PMPI_Mrecv
  31 #endif
  32 
  33 static const char FUNC_NAME[] = "MPI_Mrecv";
  34 
  35 
  36 int MPI_Mrecv(void *buf, int count, MPI_Datatype type,
  37               MPI_Message *message, MPI_Status *status)
  38 {
  39     int rc = MPI_SUCCESS;
  40     ompi_communicator_t *comm;
  41 
  42     SPC_RECORD(OMPI_SPC_MRECV, 1);
  43 
  44     MEMCHECKER(
  45         memchecker_datatype(type);
  46         memchecker_message(message);
  47         memchecker_call(&opal_memchecker_base_isaddressable, buf, count, type);
  48         memchecker_comm(comm);
  49     );
  50 
  51     if ( MPI_PARAM_CHECK ) {
  52         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  53         OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
  54         OMPI_CHECK_USER_BUFFER(rc, buf, type, count);
  55 
  56         if (NULL == message || MPI_MESSAGE_NULL == *message) {
  57             rc = MPI_ERR_REQUEST;
  58             comm = MPI_COMM_NULL;
  59         } else {
  60             comm = (*message)->comm;
  61         }
  62 
  63         OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
  64     } else {
  65         comm = (*message)->comm;
  66     }
  67 
  68     if (&ompi_message_no_proc.message == *message) {
  69         if (MPI_STATUS_IGNORE != status) {
  70             *status = ompi_request_empty.req_status;
  71         }
  72         *message = MPI_MESSAGE_NULL;
  73         return MPI_SUCCESS;
  74      }
  75 
  76     OPAL_CR_ENTER_LIBRARY();
  77 
  78     rc = MCA_PML_CALL(mrecv(buf, count, type, message, status));
  79     /* Per MPI-1, the MPI_ERROR field is not defined for
  80        single-completion calls */
  81     MEMCHECKER(
  82         opal_memchecker_base_mem_undefined(&status->MPI_ERROR, sizeof(int));
  83     );
  84 
  85     OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
  86 }

/* [<][>][^][v][top][bottom][index][help] */