root/ompi/mca/pml/base/pml_base_recvreq.h

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

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2016 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 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      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2016      Los Alamos National Security, LLC. All rights
  15  *                         reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 /**
  23  * @file
  24  */
  25 #ifndef MCA_PML_BASE_RECV_REQUEST_H
  26 #define MCA_PML_BASE_RECV_REQUEST_H
  27 
  28 #include "ompi_config.h"
  29 #include "ompi/mca/pml/base/pml_base_request.h"
  30 #include "opal/datatype/opal_convertor.h"
  31 #include "ompi/peruse/peruse-internal.h"
  32 
  33 BEGIN_C_DECLS
  34 
  35 /**
  36  * Base type for receive requests.
  37  */
  38 struct mca_pml_base_recv_request_t {
  39    mca_pml_base_request_t req_base;  /**< base request */
  40    size_t req_bytes_packed;          /**< size of message being received */
  41 };
  42 typedef struct mca_pml_base_recv_request_t mca_pml_base_recv_request_t;
  43 
  44 OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_pml_base_recv_request_t);
  45 
  46 /**
  47  * Initialize a receive request with call parameters.
  48  *
  49  * @param request (IN)       Receive request.
  50  * @param addr (IN)          User buffer.
  51  * @param count (IN)         Number of elements of indicated datatype.
  52  * @param datatype (IN)      User defined datatype.
  53  * @param src (IN)           Source rank w/in the communicator.
  54  * @param tag (IN)           User defined tag.
  55  * @param comm (IN)          Communicator.
  56  * @param persistent (IN)    Is this a persistent request.
  57  */
  58 #define MCA_PML_BASE_RECV_REQUEST_INIT(                                  \
  59     request,                                                             \
  60     addr,                                                                \
  61     count,                                                               \
  62     datatype,                                                            \
  63     src,                                                                 \
  64     tag,                                                                 \
  65     comm,                                                                \
  66     persistent)                                                          \
  67 {                                                                        \
  68     /* increment reference count on communicator */                      \
  69     OBJ_RETAIN(comm);                                                    \
  70     OMPI_DATATYPE_RETAIN(datatype);                                      \
  71                                                                          \
  72     OMPI_REQUEST_INIT(&(request)->req_base.req_ompi, persistent);        \
  73     (request)->req_base.req_ompi.req_mpi_object.comm = comm;             \
  74     (request)->req_bytes_packed = 0;                                     \
  75     (request)->req_base.req_addr = addr;                                 \
  76     (request)->req_base.req_count = count;                               \
  77     (request)->req_base.req_peer = src;                                  \
  78     (request)->req_base.req_tag = tag;                                   \
  79     (request)->req_base.req_comm = comm;                                 \
  80     (request)->req_base.req_proc = NULL;                                 \
  81     (request)->req_base.req_sequence = 0;                                \
  82     (request)->req_base.req_datatype = datatype;                         \
  83     /* What about req_type ? */                                          \
  84     (request)->req_base.req_pml_complete = false;                        \
  85     (request)->req_base.req_free_called = false;                         \
  86 }
  87 /**
  88  *
  89  *
  90  */
  91 #define MCA_PML_BASE_RECV_START( request )                                      \
  92     do {                                                                        \
  93         (request)->req_bytes_packed = 0;                                        \
  94         (request)->req_base.req_pml_complete = false;                           \
  95                                                                                 \
  96         /* always set the req_status.MPI_TAG to ANY_TAG before starting the     \
  97          * request. This field is used if cancelled to find out if the request  \
  98          * has been matched or not.                                             \
  99          */                                                                     \
 100         (request)->req_base.req_ompi.req_status.MPI_SOURCE = OMPI_ANY_SOURCE;   \
 101         (request)->req_base.req_ompi.req_status.MPI_TAG = OMPI_ANY_TAG;         \
 102         (request)->req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS;       \
 103         (request)->req_base.req_ompi.req_status._ucount = 0;                    \
 104         (request)->req_base.req_ompi.req_status._cancelled = 0;                 \
 105                                                                                 \
 106         (request)->req_base.req_ompi.req_complete = REQUEST_PENDING;            \
 107         (request)->req_base.req_ompi.req_state = OMPI_REQUEST_ACTIVE;           \
 108     } while (0)
 109 
 110 /**
 111  *  Return a receive request. Handle the release of the communicator and the
 112  *  attached datatype.
 113  *
 114  *  @param request (IN)     Receive request.
 115  */
 116 #define MCA_PML_BASE_RECV_REQUEST_FINI( request )                       \
 117     do {                                                                \
 118         OMPI_REQUEST_FINI(&(request)->req_base.req_ompi);               \
 119         OBJ_RELEASE( (request)->req_base.req_comm);                     \
 120         OMPI_DATATYPE_RELEASE( (request)->req_base.req_datatype );      \
 121         opal_convertor_cleanup( &((request)->req_base.req_convertor) ); \
 122     } while (0)
 123 
 124 END_C_DECLS
 125 
 126 #endif
 127 

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