This source file includes following definitions.
- get_displacement
- ompi_osc_portals4_complete_all
- ompi_osc_portals4_get_peer_group
- ompi_osc_portals4_get_peer
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 #ifndef OSC_PORTALS4_PORTALS4_H
  17 #define OSC_PORTALS4_PORTALS4_H
  18 
  19 #include <portals4.h>
  20 #include "ompi/group/group.h"
  21 #include "ompi/communicator/communicator.h"
  22 
  23 #include "ompi/mca/mtl/portals4/mtl_portals4.h"
  24 
  25 #define REQ_OSC_TABLE_ID     4
  26 
  27 #define OSC_PORTALS4_IOVEC_MAX 64
  28 
  29 #define OSC_PORTALS4_MB_DATA    0x0000000000000000ULL
  30 #define OSC_PORTALS4_MB_CONTROL 0x1000000000000000ULL
  31 
  32 
  33 
  34 
  35 
  36 
  37 
  38 
  39 
  40 
  41 
  42 
  43 
  44 
  45 
  46 
  47 
  48 
  49 
  50 struct ompi_osc_portals4_component_t {
  51     ompi_osc_base_component_t super;
  52 
  53     ptl_handle_ni_t matching_ni_h;
  54     ptl_handle_eq_t matching_eq_h;
  55     ptl_pt_index_t matching_pt_idx;
  56     ptl_size_t matching_atomic_max;
  57     ptl_size_t matching_fetch_atomic_max;
  58     ptl_size_t matching_atomic_ordered_size;
  59     ptl_size_t ptl_max_msg_size; 
  60     bool no_locks;
  61     ptl_uid_t uid;
  62     opal_mutex_t lock;
  63     opal_condition_t cond;
  64 
  65     opal_free_list_t requests; 
  66 };
  67 typedef struct ompi_osc_portals4_component_t ompi_osc_portals4_component_t;
  68 OMPI_DECLSPEC extern ompi_osc_portals4_component_t mca_osc_portals4_component;
  69 
  70 
  71 
  72 struct ompi_osc_portals4_node_state_t {
  73     volatile int32_t post_count;
  74     volatile int32_t complete_count;
  75     volatile uint64_t lock;
  76 };
  77 typedef struct ompi_osc_portals4_node_state_t ompi_osc_portals4_node_state_t;
  78 
  79 #define LOCK_ILLEGAL   (0x4000000000000000ULL)
  80 #define LOCK_UNLOCKED  (0x0000000000000000ULL)
  81 #define LOCK_EXCLUSIVE (0x0000000100000000ULL)
  82 
  83 
  84 struct ompi_osc_portals4_module_t {
  85     ompi_osc_base_module_t super;
  86     void *free_after; 
  87     struct ompi_communicator_t *comm; 
  88     int disp_unit; 
  89     int *disp_units; 
  90     ptl_handle_ni_t ni_h; 
  91     ptl_pt_index_t pt_idx; 
  92     ptl_handle_ct_t ct_h; 
  93     int ct_link; 
  94     ptl_handle_md_t md_h; 
  95     ptl_handle_md_t req_md_h; 
  96     ptl_handle_me_t data_me_h; 
  97     ptl_handle_me_t control_me_h; 
  98     opal_atomic_int64_t opcount;
  99     ptl_match_bits_t match_bits; 
 100 
 101     ptl_iovec_t     *origin_iovec_list; 
 102     ptl_handle_md_t  origin_iovec_md_h; 
 103     ptl_iovec_t     *result_iovec_list; 
 104     ptl_handle_md_t  result_iovec_md_h; 
 105 
 106     ptl_size_t atomic_max; 
 107     ptl_size_t fetch_atomic_max; 
 108 
 109     
 110 
 111     int32_t zero;
 112     int32_t one;
 113 
 114     ompi_group_t *start_group;
 115     ompi_group_t *post_group;
 116     opal_list_t outstanding_locks;
 117 
 118     bool passive_target_access_epoch; 
 119 
 120     
 121     ompi_osc_portals4_node_state_t state;
 122 };
 123 typedef struct ompi_osc_portals4_module_t ompi_osc_portals4_module_t;
 124 
 125 
 126 static inline size_t
 127 get_displacement(ompi_osc_portals4_module_t *module,
 128                  int target)
 129 {
 130     if (-1 == module->disp_unit) {
 131         return module->disp_units[target];
 132     } else {
 133         return module->disp_unit;
 134     }
 135 }
 136 
 137 
 138 int ompi_osc_portals4_attach(struct ompi_win_t *win, void *base, size_t len);
 139 int ompi_osc_portals4_detach(struct ompi_win_t *win, const void *base);
 140 
 141 int ompi_osc_portals4_free(struct ompi_win_t *win);
 142 
 143 int ompi_osc_portals4_put(const void *origin_addr,
 144                           int origin_count,
 145                           struct ompi_datatype_t *origin_dt,
 146                           int target,
 147                           ptrdiff_t target_disp,
 148                           int target_count,
 149                           struct ompi_datatype_t *target_dt,
 150                           struct ompi_win_t *win);
 151 
 152 int ompi_osc_portals4_get(void *origin_addr,
 153                           int origin_count,
 154                           struct ompi_datatype_t *origin_dt,
 155                           int target,
 156                           ptrdiff_t target_disp,
 157                           int target_count,
 158                           struct ompi_datatype_t *target_dt,
 159                           struct ompi_win_t *win);
 160 
 161 int ompi_osc_portals4_accumulate(const void *origin_addr,
 162                                  int origin_count,
 163                                  struct ompi_datatype_t *origin_dt,
 164                                  int target,
 165                                  ptrdiff_t target_disp,
 166                                  int target_count,
 167                                  struct ompi_datatype_t *target_dt,
 168                                  struct ompi_op_t *op,
 169                                  struct ompi_win_t *win);
 170 
 171 int ompi_osc_portals4_compare_and_swap(const void *origin_addr,
 172                                        const void *compare_addr,
 173                                        void *result_addr,
 174                                        struct ompi_datatype_t *dt,
 175                                        int target,
 176                                        ptrdiff_t target_disp,
 177                                        struct ompi_win_t *win);
 178 
 179 int ompi_osc_portals4_fetch_and_op(const void *origin_addr,
 180                                    void *result_addr,
 181                                    struct ompi_datatype_t *dt,
 182                                    int target,
 183                                    ptrdiff_t target_disp,
 184                                    struct ompi_op_t *op,
 185                                    struct ompi_win_t *win);
 186 
 187 int ompi_osc_portals4_get_accumulate(const void *origin_addr,
 188                                      int origin_count,
 189                                      struct ompi_datatype_t *origin_datatype,
 190                                      void *result_addr,
 191                                      int result_count,
 192                                      struct ompi_datatype_t *result_datatype,
 193                                      int target_rank,
 194                                      ptrdiff_t target_disp,
 195                                      int target_count,
 196                                      struct ompi_datatype_t *target_datatype,
 197                                      struct ompi_op_t *op,
 198                                      struct ompi_win_t *win);
 199 
 200 int ompi_osc_portals4_rput(const void *origin_addr,
 201                            int origin_count,
 202                            struct ompi_datatype_t *origin_dt,
 203                            int target,
 204                            ptrdiff_t target_disp,
 205                            int target_count,
 206                            struct ompi_datatype_t *target_dt,
 207                            struct ompi_win_t *win,
 208                            struct ompi_request_t **request);
 209 
 210 int ompi_osc_portals4_rget(void *origin_addr,
 211                            int origin_count,
 212                            struct ompi_datatype_t *origin_dt,
 213                            int target,
 214                            ptrdiff_t target_disp,
 215                            int target_count,
 216                            struct ompi_datatype_t *target_dt,
 217                            struct ompi_win_t *win,
 218                            struct ompi_request_t **request);
 219 
 220 int ompi_osc_portals4_raccumulate(const void *origin_addr,
 221                                   int origin_count,
 222                                   struct ompi_datatype_t *origin_dt,
 223                                   int target,
 224                                   ptrdiff_t target_disp,
 225                                   int target_count,
 226                                   struct ompi_datatype_t *target_dt,
 227                                   struct ompi_op_t *op,
 228                                   struct ompi_win_t *win,
 229                                   struct ompi_request_t **request);
 230 
 231 int ompi_osc_portals4_rget_accumulate(const void *origin_addr,
 232                                       int origin_count,
 233                                       struct ompi_datatype_t *origin_datatype,
 234                                       void *result_addr,
 235                                       int result_count,
 236                                       struct ompi_datatype_t *result_datatype,
 237                                       int target_rank,
 238                                       ptrdiff_t target_disp,
 239                                       int target_count,
 240                                       struct ompi_datatype_t *target_datatype,
 241                                       struct ompi_op_t *op,
 242                                       struct ompi_win_t *win,
 243                                       struct ompi_request_t **request);
 244 
 245 int ompi_osc_portals4_fence(int assert, struct ompi_win_t *win);
 246 
 247 int ompi_osc_portals4_start(struct ompi_group_t *group,
 248                             int assert,
 249                             struct ompi_win_t *win);
 250 
 251 int ompi_osc_portals4_complete(struct ompi_win_t *win);
 252 
 253 int ompi_osc_portals4_post(struct ompi_group_t *group,
 254                            int assert,
 255                            struct ompi_win_t *win);
 256 
 257 int ompi_osc_portals4_wait(struct ompi_win_t *win);
 258 
 259 int ompi_osc_portals4_test(struct ompi_win_t *win,
 260                            int *flag);
 261 
 262 int ompi_osc_portals4_lock(int lock_type,
 263                            int target,
 264                            int assert,
 265                            struct ompi_win_t *win);
 266 
 267 int ompi_osc_portals4_unlock(int target,
 268                              struct ompi_win_t *win);
 269 
 270 
 271 int ompi_osc_portals4_lock_all(int assert,
 272                                struct ompi_win_t *win);
 273 
 274 int ompi_osc_portals4_unlock_all(struct ompi_win_t *win);
 275 
 276 int ompi_osc_portals4_sync(struct ompi_win_t *win);
 277 
 278 int ompi_osc_portals4_flush(int target,
 279                             struct ompi_win_t *win);
 280 int ompi_osc_portals4_flush_all(struct ompi_win_t *win);
 281 int ompi_osc_portals4_flush_local(int target,
 282                                   struct ompi_win_t *win);
 283 int ompi_osc_portals4_flush_local_all(struct ompi_win_t *win);
 284 
 285 static inline int
 286 ompi_osc_portals4_complete_all(ompi_osc_portals4_module_t *module)
 287 {
 288     int ret;
 289     ptl_ct_event_t event;
 290 
 291     ret = PtlCTWait(module->ct_h, module->opcount, &event);
 292     if (PTL_OK != ret || 0 != event.failure) {
 293         opal_output_verbose(1, ompi_osc_base_framework.framework_output,
 294                             "%s:%d: flush_all ct failure: ret=%d, failure=%d\n",
 295                             __FILE__, __LINE__, ret, (int) event.failure);
 296         event.success = event.failure = 0;
 297         PtlCTSet(module->ct_h, event);
 298         module->opcount = 0;
 299     }
 300     assert(event.success == (size_t) module->opcount);
 301 
 302     PtlAtomicSync();
 303 
 304     return ret;
 305 }
 306 
 307 static inline ptl_process_t
 308 ompi_osc_portals4_get_peer_group(struct ompi_group_t *group, int rank)
 309 {
 310     return ompi_mtl_portals4_get_peer_group(group, rank);
 311 }
 312 
 313 static inline ptl_process_t
 314 ompi_osc_portals4_get_peer(ompi_osc_portals4_module_t *module, int rank)
 315 {
 316     return ompi_osc_portals4_get_peer_group(module->comm->c_remote_group, rank);
 317 }
 318 
 319 #endif