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