root/ompi/mca/osc/pt2pt/osc_pt2pt_request.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ompi_osc_pt2pt_request_complete

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2012      Sandia National Laboratories.  All rights reserved.
   4  * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * Copyright (c) 2015      Research Organization for Information Science
   7  *                         and Technology (RIST). All rights reserved.
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  13  */
  14 
  15 #ifndef OMPI_OSC_PT2PT_REQUEST_H
  16 #define OMPI_OSC_PT2PT_REQUEST_H
  17 
  18 #include "osc_pt2pt.h"
  19 
  20 #include "ompi/request/request.h"
  21 #include "opal/util/output.h"
  22 
  23 struct ompi_osc_pt2pt_request_t {
  24     ompi_request_t super;
  25 
  26     int type;
  27     const void *origin_addr;
  28     int origin_count;
  29     struct ompi_datatype_t *origin_dt;
  30     ompi_osc_pt2pt_module_t* module;
  31     opal_atomic_int32_t outstanding_requests;
  32     bool internal;
  33 };
  34 typedef struct ompi_osc_pt2pt_request_t ompi_osc_pt2pt_request_t;
  35 OBJ_CLASS_DECLARATION(ompi_osc_pt2pt_request_t);
  36 
  37 /* REQUEST_ALLOC is only called from "top-level" functions (pt2pt_rput,
  38    pt2pt_rget, etc.), so it's ok to spin here... */
  39 #define OMPI_OSC_PT2PT_REQUEST_ALLOC(win, req)                          \
  40     do {                                                                \
  41         opal_free_list_item_t *item;                                    \
  42         do {                                                            \
  43             item = opal_free_list_get (&mca_osc_pt2pt_component.requests); \
  44             if (NULL == item) {                                         \
  45                 opal_progress();                                        \
  46             }                                                           \
  47         } while (NULL == item);                                         \
  48         req = (ompi_osc_pt2pt_request_t*) item;                         \
  49         OMPI_REQUEST_INIT(&req->super, false);                          \
  50         req->super.req_mpi_object.win = win;                            \
  51         req->super.req_complete = false;                                \
  52         req->super.req_state = OMPI_REQUEST_ACTIVE;                     \
  53         req->module = GET_MODULE(win);                                  \
  54         req->internal = false;                                          \
  55     } while (0)
  56 
  57 #define OMPI_OSC_PT2PT_REQUEST_RETURN(req)                              \
  58     do {                                                                \
  59         OMPI_REQUEST_FINI(&(req)->super);                               \
  60         (req)->outstanding_requests = 0;                                \
  61         opal_free_list_return (&mca_osc_pt2pt_component.requests,       \
  62                                  (opal_free_list_item_t *) (req));      \
  63     } while (0)
  64 
  65 static inline void ompi_osc_pt2pt_request_complete (ompi_osc_pt2pt_request_t *request, int mpi_error)
  66 {
  67     if (!request->internal) {
  68         request->super.req_status.MPI_ERROR = mpi_error;
  69 
  70         /* mark the request complete at the mpi level */
  71         ompi_request_complete (&request->super, true);
  72     } else {
  73         OMPI_OSC_PT2PT_REQUEST_RETURN (request);
  74     }
  75 }
  76 
  77 #endif /* OMPI_OSC_PT2PT_REQUEST_H */

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