root/ompi/mca/osc/sm/osc_sm.h

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

INCLUDED FROM


   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-2015 Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * Copyright (c) 2015-2017 Research Organization for Information Science
   7  *                         and Technology (RIST). All rights reserved.
   8  * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
   9  * $COPYRIGHT$
  10  *
  11  * Additional copyrights may follow
  12  *
  13  * $HEADER$
  14  */
  15 
  16 #ifndef OSC_SM_SM_H
  17 #define OSC_SM_SM_H
  18 
  19 #include "opal/mca/shmem/base/base.h"
  20 
  21 #if OPAL_HAVE_ATOMIC_MATH_64
  22 
  23 typedef uint64_t osc_sm_post_type_t;
  24 typedef opal_atomic_uint64_t osc_sm_post_atomic_type_t;
  25 #define OSC_SM_POST_BITS 6
  26 #define OSC_SM_POST_MASK 0x3f
  27 
  28 #else
  29 
  30 typedef uint32_t osc_sm_post_type_t;
  31 typedef opal_atomic_uint32_t osc_sm_post_atomic_type_t;
  32 #define OSC_SM_POST_BITS 5
  33 #define OSC_SM_POST_MASK 0x1f
  34 
  35 #endif
  36 
  37 /* data shared across all peers */
  38 struct ompi_osc_sm_global_state_t {
  39     int use_barrier_for_fence;
  40 
  41     pthread_mutex_t mtx;
  42     pthread_cond_t cond;
  43 
  44     int sense;
  45     int32_t count;
  46 };
  47 typedef struct ompi_osc_sm_global_state_t ompi_osc_sm_global_state_t;
  48 
  49 /* this is data exposed to remote nodes */
  50 struct ompi_osc_sm_lock_t {
  51     uint32_t counter;
  52     uint32_t write;
  53     uint32_t read;
  54 };
  55 typedef struct ompi_osc_sm_lock_t ompi_osc_sm_lock_t;
  56 
  57 struct ompi_osc_sm_node_state_t {
  58     opal_atomic_int32_t complete_count;
  59     ompi_osc_sm_lock_t lock;
  60     opal_atomic_lock_t accumulate_lock;
  61 };
  62 typedef struct ompi_osc_sm_node_state_t ompi_osc_sm_node_state_t;
  63 
  64 struct ompi_osc_sm_component_t {
  65     ompi_osc_base_component_t super;
  66 
  67     char *backing_directory;
  68 };
  69 typedef struct ompi_osc_sm_component_t ompi_osc_sm_component_t;
  70 OMPI_DECLSPEC extern ompi_osc_sm_component_t mca_osc_sm_component;
  71 
  72 enum ompi_osc_sm_locktype_t {
  73     lock_none = 0,
  74     lock_nocheck,
  75     lock_exclusive,
  76     lock_shared
  77 };
  78 
  79 struct ompi_osc_sm_module_t {
  80     ompi_osc_base_module_t super;
  81     struct ompi_communicator_t *comm;
  82     int flavor;
  83     opal_shmem_ds_t seg_ds;
  84     void *segment_base;
  85     bool noncontig;
  86 
  87     size_t *sizes;
  88     void **bases;
  89     int *disp_units;
  90 
  91     ompi_group_t *start_group;
  92     ompi_group_t *post_group;
  93 
  94     int my_sense;
  95 
  96     enum ompi_osc_sm_locktype_t *outstanding_locks;
  97 
  98     /* exposed data */
  99     ompi_osc_sm_global_state_t *global_state;
 100     ompi_osc_sm_node_state_t *my_node_state;
 101     ompi_osc_sm_node_state_t *node_states;
 102 
 103     osc_sm_post_atomic_type_t **posts;
 104 
 105     opal_mutex_t lock;
 106 };
 107 typedef struct ompi_osc_sm_module_t ompi_osc_sm_module_t;
 108 
 109 int ompi_osc_sm_shared_query(struct ompi_win_t *win, int rank, size_t *size, int *disp_unit, void *baseptr);
 110 
 111 int ompi_osc_sm_attach(struct ompi_win_t *win, void *base, size_t len);
 112 int ompi_osc_sm_detach(struct ompi_win_t *win, const void *base);
 113 
 114 int ompi_osc_sm_free(struct ompi_win_t *win);
 115 
 116 int ompi_osc_sm_put(const void *origin_addr,
 117                           int origin_count,
 118                           struct ompi_datatype_t *origin_dt,
 119                           int target,
 120                           ptrdiff_t target_disp,
 121                           int target_count,
 122                           struct ompi_datatype_t *target_dt,
 123                           struct ompi_win_t *win);
 124 
 125 int ompi_osc_sm_get(void *origin_addr,
 126                           int origin_count,
 127                           struct ompi_datatype_t *origin_dt,
 128                           int target,
 129                           ptrdiff_t target_disp,
 130                           int target_count,
 131                           struct ompi_datatype_t *target_dt,
 132                           struct ompi_win_t *win);
 133 
 134 int ompi_osc_sm_accumulate(const void *origin_addr,
 135                                  int origin_count,
 136                                  struct ompi_datatype_t *origin_dt,
 137                                  int target,
 138                                  ptrdiff_t target_disp,
 139                                  int target_count,
 140                                  struct ompi_datatype_t *target_dt,
 141                                  struct ompi_op_t *op,
 142                                  struct ompi_win_t *win);
 143 
 144 int ompi_osc_sm_compare_and_swap(const void *origin_addr,
 145                                        const void *compare_addr,
 146                                        void *result_addr,
 147                                        struct ompi_datatype_t *dt,
 148                                        int target,
 149                                        ptrdiff_t target_disp,
 150                                        struct ompi_win_t *win);
 151 
 152 int ompi_osc_sm_fetch_and_op(const void *origin_addr,
 153                                    void *result_addr,
 154                                    struct ompi_datatype_t *dt,
 155                                    int target,
 156                                    ptrdiff_t target_disp,
 157                                    struct ompi_op_t *op,
 158                                    struct ompi_win_t *win);
 159 
 160 int ompi_osc_sm_get_accumulate(const void *origin_addr,
 161                                      int origin_count,
 162                                      struct ompi_datatype_t *origin_datatype,
 163                                      void *result_addr,
 164                                      int result_count,
 165                                      struct ompi_datatype_t *result_datatype,
 166                                      int target_rank,
 167                                      MPI_Aint target_disp,
 168                                      int target_count,
 169                                      struct ompi_datatype_t *target_datatype,
 170                                      struct ompi_op_t *op,
 171                                      struct ompi_win_t *win);
 172 
 173 int ompi_osc_sm_rput(const void *origin_addr,
 174                            int origin_count,
 175                            struct ompi_datatype_t *origin_dt,
 176                            int target,
 177                            ptrdiff_t target_disp,
 178                            int target_count,
 179                            struct ompi_datatype_t *target_dt,
 180                            struct ompi_win_t *win,
 181                            struct ompi_request_t **request);
 182 
 183 int ompi_osc_sm_rget(void *origin_addr,
 184                            int origin_count,
 185                            struct ompi_datatype_t *origin_dt,
 186                            int target,
 187                            ptrdiff_t target_disp,
 188                            int target_count,
 189                            struct ompi_datatype_t *target_dt,
 190                            struct ompi_win_t *win,
 191                            struct ompi_request_t **request);
 192 
 193 int ompi_osc_sm_raccumulate(const void *origin_addr,
 194                                   int origin_count,
 195                                   struct ompi_datatype_t *origin_dt,
 196                                   int target,
 197                                   ptrdiff_t target_disp,
 198                                   int target_count,
 199                                   struct ompi_datatype_t *target_dt,
 200                                   struct ompi_op_t *op,
 201                                   struct ompi_win_t *win,
 202                                   struct ompi_request_t **request);
 203 
 204 int ompi_osc_sm_rget_accumulate(const void *origin_addr,
 205                                       int origin_count,
 206                                       struct ompi_datatype_t *origin_datatype,
 207                                       void *result_addr,
 208                                       int result_count,
 209                                       struct ompi_datatype_t *result_datatype,
 210                                       int target_rank,
 211                                       MPI_Aint target_disp,
 212                                       int target_count,
 213                                       struct ompi_datatype_t *target_datatype,
 214                                       struct ompi_op_t *op,
 215                                       struct ompi_win_t *win,
 216                                       struct ompi_request_t **request);
 217 
 218 int ompi_osc_sm_fence(int assert, struct ompi_win_t *win);
 219 
 220 int ompi_osc_sm_start(struct ompi_group_t *group,
 221                             int assert,
 222                             struct ompi_win_t *win);
 223 
 224 int ompi_osc_sm_complete(struct ompi_win_t *win);
 225 
 226 int ompi_osc_sm_post(struct ompi_group_t *group,
 227                            int assert,
 228                            struct ompi_win_t *win);
 229 
 230 int ompi_osc_sm_wait(struct ompi_win_t *win);
 231 
 232 int ompi_osc_sm_test(struct ompi_win_t *win,
 233                            int *flag);
 234 
 235 int ompi_osc_sm_lock(int lock_type,
 236                            int target,
 237                            int assert,
 238                            struct ompi_win_t *win);
 239 
 240 int ompi_osc_sm_unlock(int target,
 241                              struct ompi_win_t *win);
 242 
 243 
 244 int ompi_osc_sm_lock_all(int assert,
 245                                struct ompi_win_t *win);
 246 
 247 int ompi_osc_sm_unlock_all(struct ompi_win_t *win);
 248 
 249 int ompi_osc_sm_sync(struct ompi_win_t *win);
 250 
 251 int ompi_osc_sm_flush(int target,
 252                             struct ompi_win_t *win);
 253 int ompi_osc_sm_flush_all(struct ompi_win_t *win);
 254 int ompi_osc_sm_flush_local(int target,
 255                                   struct ompi_win_t *win);
 256 int ompi_osc_sm_flush_local_all(struct ompi_win_t *win);
 257 
 258 int ompi_osc_sm_set_info(struct ompi_win_t *win, struct opal_info_t *info);
 259 int ompi_osc_sm_get_info(struct ompi_win_t *win, struct opal_info_t **info_used);
 260 
 261 #endif

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