root/ompi/mca/osc/rdma/osc_rdma_sync.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ompi_osc_rdma_sync_get_count

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2015-2018 Los Alamos National Security, LLC.  All rights
   4  *                         reserved.
   5  * $COPYRIGHT$
   6  *
   7  * Additional copyrights may follow
   8  *
   9  * $HEADER$
  10  */
  11 
  12 #if !defined(OSC_RDMA_SYNC_H)
  13 #define OSC_RDMA_SYNC_H
  14 
  15 #include "osc_rdma_types.h"
  16 #include "opal/class/opal_object.h"
  17 #include "opal/threads/threads.h"
  18 
  19 /**
  20  * @brief synchronization types
  21  */
  22 enum ompi_osc_rdma_sync_type_t {
  23     /** default value */
  24     OMPI_OSC_RDMA_SYNC_TYPE_NONE,
  25     /** lock access epoch */
  26     OMPI_OSC_RDMA_SYNC_TYPE_LOCK,
  27     /** fence access epoch */
  28     OMPI_OSC_RDMA_SYNC_TYPE_FENCE,
  29     /* post-start-complete-wait access epoch */
  30     OMPI_OSC_RDMA_SYNC_TYPE_PSCW,
  31 };
  32 typedef enum ompi_osc_rdma_sync_type_t ompi_osc_rdma_sync_type_t;
  33 
  34 struct ompi_osc_rdma_module_t;
  35 
  36 struct ompi_osc_rdma_sync_aligned_counter_t {
  37     osc_rdma_atomic_counter_t counter;
  38     /* pad out to next cache line */
  39     uint64_t padding[7];
  40 };
  41 typedef struct ompi_osc_rdma_sync_aligned_counter_t ompi_osc_rdma_sync_aligned_counter_t;
  42 
  43 /**
  44  * @brief synchronization object
  45  *
  46  * This structure holds information about an access epoch.
  47  */
  48 struct ompi_osc_rdma_sync_t {
  49     opal_object_t super;
  50 
  51     /** osc rdma module */
  52     struct ompi_osc_rdma_module_t *module;
  53 
  54     /** synchronization type */
  55     ompi_osc_rdma_sync_type_t type;
  56 
  57     /** synchronization data */
  58     union {
  59         /** lock specific synchronization data */
  60         struct {
  61             /** lock target rank (-1 for all) */
  62             int target;
  63 
  64             /** lock type: MPI_LOCK_SHARED, MPI_LOCK_EXCLUSIVE */
  65             int16_t type;
  66 
  67             /** assert specified at lock acquire time. at this time Open MPI
  68              * only uses 5-bits for asserts. if this number goes over 16 this
  69              * will need to be changed to accomodate. */
  70             int16_t assert;
  71         } lock;
  72 
  73         /** post/start/complete/wait specific synchronization data */
  74         struct {
  75             /** group passed to ompi_osc_rdma_start */
  76             ompi_group_t *group;
  77         } pscw;
  78     } sync;
  79 
  80     /** array of peers for this sync */
  81     union {
  82         /** multiple peers (lock all, pscw, fence) */
  83         struct ompi_osc_rdma_peer_t **peers;
  84         /** single peer (targeted lock) */
  85         struct ompi_osc_rdma_peer_t *peer;
  86     } peer_list;
  87 
  88     /** demand locked peers (lock-all) */
  89     opal_list_t demand_locked_peers;
  90 
  91     /** number of peers */
  92     int num_peers;
  93 
  94     /** communication has started on this epoch */
  95     bool epoch_active;
  96 
  97     /** outstanding rdma operations on epoch */
  98     ompi_osc_rdma_sync_aligned_counter_t outstanding_rdma __opal_attribute_aligned__(64);
  99 
 100     /** lock to protect sync structure members */
 101     opal_mutex_t lock;
 102 };
 103 typedef struct ompi_osc_rdma_sync_t ompi_osc_rdma_sync_t;
 104 
 105 OBJ_CLASS_DECLARATION(ompi_osc_rdma_sync_t);
 106 
 107 /**
 108  * @brief allocate a new synchronization object
 109  *
 110  * @param[in] module   osc rdma module
 111  *
 112  * @returns NULL on failure
 113  * @returns a new synchronization object on success
 114  */
 115 ompi_osc_rdma_sync_t *ompi_osc_rdma_sync_allocate (struct ompi_osc_rdma_module_t *module);
 116 
 117 /**
 118  * @brief release a synchronization object
 119  *
 120  * @param[in] rdma_sync   synchronization object allocated by ompi_osc_rdma_sync_allocate()
 121  */
 122 void ompi_osc_rdma_sync_return (ompi_osc_rdma_sync_t *rdma_sync);
 123 
 124 /**
 125  * Check if the target is part of a PSCW access epoch
 126  *
 127  * @param[in] module   osc rdma module
 128  * @param[in] target   target rank
 129  * @param[out] peer    peer object
 130  *
 131  * @returns false if the window is not in a PSCW access epoch or the peer is not
 132  *          in the group passed to MPI_Win_start
 133  * @returns true otherwise
 134  *
 135  * This functions verifies the target is part of an active PSCW access epoch.
 136  */
 137 bool ompi_osc_rdma_sync_pscw_peer (struct ompi_osc_rdma_module_t *module, int target, struct ompi_osc_rdma_peer_t **peer);
 138 
 139 
 140 static inline int64_t ompi_osc_rdma_sync_get_count (ompi_osc_rdma_sync_t *rdma_sync)
 141 {
 142     return rdma_sync->outstanding_rdma.counter;
 143 }
 144 
 145 #endif /* OSC_RDMA_SYNC_H */

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