root/ompi/mpi/c/isend.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Isend

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2018 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006-2007 Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2013      Los Alamos National Security, LLC.  All rights
  15  *                         reserved.
  16  * Copyright (c) 2015-2017 Research Organization for Information Science
  17  *                         and Technology (RIST). All rights reserved.
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 
  25 #include "ompi_config.h"
  26 
  27 #include "ompi/mpi/c/bindings.h"
  28 #include "ompi/runtime/params.h"
  29 #include "ompi/communicator/communicator.h"
  30 #include "ompi/errhandler/errhandler.h"
  31 #include "ompi/mca/pml/pml.h"
  32 #include "ompi/request/request.h"
  33 #include "ompi/memchecker.h"
  34 #include "ompi/runtime/ompi_spc.h"
  35 
  36 #if OMPI_BUILD_MPI_PROFILING
  37 #if OPAL_HAVE_WEAK_SYMBOLS
  38 #pragma weak MPI_Isend = PMPI_Isend
  39 #endif
  40 #define MPI_Isend PMPI_Isend
  41 #endif
  42 
  43 static const char FUNC_NAME[] = "MPI_Isend";
  44 
  45 
  46 int MPI_Isend(const void *buf, int count, MPI_Datatype type, int dest,
  47               int tag, MPI_Comm comm, MPI_Request *request)
  48 {
  49     int rc = MPI_SUCCESS;
  50 
  51     SPC_RECORD(OMPI_SPC_ISEND, 1);
  52 
  53     MEMCHECKER(
  54         memchecker_datatype(type);
  55         memchecker_call(&opal_memchecker_base_isdefined, buf, count, type);
  56         memchecker_comm(comm);
  57     );
  58 
  59     if ( MPI_PARAM_CHECK ) {
  60         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  61         if (ompi_comm_invalid(comm)) {
  62             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
  63         } else if (count < 0) {
  64             rc = MPI_ERR_COUNT;
  65         } else if (MPI_DATATYPE_NULL == type || NULL == type) {
  66             rc = MPI_ERR_TYPE;
  67         } else if (tag < 0 || tag > mca_pml.pml_max_tag) {
  68             rc = MPI_ERR_TAG;
  69         } else if (ompi_comm_peer_invalid(comm, dest) &&
  70                    (MPI_PROC_NULL != dest)) {
  71             rc = MPI_ERR_RANK;
  72         } else if (request == NULL) {
  73             rc = MPI_ERR_REQUEST;
  74         } else {
  75             OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count);
  76             OMPI_CHECK_USER_BUFFER(rc, buf, type, count);
  77         }
  78         OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
  79     }
  80 
  81     if (MPI_PROC_NULL == dest) {
  82         *request = &ompi_request_empty;
  83         return MPI_SUCCESS;
  84     }
  85 
  86     OPAL_CR_ENTER_LIBRARY();
  87 
  88     /*
  89      * today's MPI standard mandates the send buffer remains accessible during the send operation
  90      * hence memchecker cannot mark buf as non accessible, but it might mark buf as read-only in
  91      * order to trap end user errors. Unfortunatly valgrind does not support marking buffers as read-only,
  92      * so there is pretty much nothing we can do here.
  93      */
  94      
  95     rc = MCA_PML_CALL(isend(buf, count, type, dest, tag,
  96                             MCA_PML_BASE_SEND_STANDARD, comm, request));
  97     OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
  98 }
  99 
 100 

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