This source file includes following definitions.
- ompi_win_invalid
- ompi_win_peer_invalid
- ompi_win_rank
- ompi_win_allow_locks
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 #ifndef OMPI_WIN_H
26 #define OMPI_WIN_H
27
28 #include "ompi_config.h"
29 #include "mpi.h"
30
31 #include "opal/class/opal_object.h"
32 #include "opal/class/opal_hash_table.h"
33 #include "opal/util/info_subscriber.h"
34 #include "ompi/errhandler/errhandler.h"
35 #include "ompi/info/info.h"
36 #include "ompi/communicator/communicator.h"
37 #include "ompi/group/group.h"
38 #include "ompi/mca/osc/osc.h"
39
40 BEGIN_C_DECLS
41
42
43 #define OMPI_WIN_FREED 0x00000001
44 #define OMPI_WIN_INVALID 0x00000002
45 #define OMPI_WIN_NO_LOCKS 0x00000004
46 #define OMPI_WIN_SAME_DISP 0x00000008
47 #define OMPI_WIN_SAME_SIZE 0x00000010
48
49 enum ompi_win_accumulate_ops_t {
50 OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP,
51 OMPI_WIN_ACCUMULATE_OPS_SAME_OP,
52 };
53 typedef enum ompi_win_accumulate_ops_t ompi_win_accumulate_ops_t;
54
55
56
57
58
59 enum ompi_win_accumulate_order_flags_t {
60
61 OMPI_WIN_ACC_ORDER_NONE = 0x01,
62
63 OMPI_WIN_ACC_ORDER_RAR = 0x02,
64
65 OMPI_WIN_ACC_ORDER_WAR = 0x04,
66
67 OMPI_WIN_ACC_ORDER_RAW = 0x08,
68
69 OMPI_WIN_ACC_ORDER_WAW = 0x10,
70 };
71
72 OMPI_DECLSPEC extern mca_base_var_enum_t *ompi_win_accumulate_ops;
73 OMPI_DECLSPEC extern mca_base_var_enum_flag_t *ompi_win_accumulate_order;
74
75 OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_windows;
76
77 struct ompi_win_t {
78 opal_infosubscriber_t super;
79
80 opal_mutex_t w_lock;
81
82 char w_name[MPI_MAX_OBJECT_NAME];
83
84
85 ompi_group_t *w_group;
86
87
88 uint16_t w_flags;
89
90
91 uint16_t w_flavor;
92
93
94 ompi_win_accumulate_ops_t w_acc_ops;
95
96
97 opal_hash_table_t *w_keyhash;
98
99
100 int w_f_to_c_index;
101
102
103
104
105 ompi_errhandler_t *error_handler;
106 ompi_errhandler_type_t errhandler_type;
107
108
109 ompi_osc_base_module_t *w_osc_module;
110
111
112 int32_t w_acc_order;
113 };
114 typedef struct ompi_win_t ompi_win_t;
115 OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_win_t);
116
117
118
119
120
121
122 #define PREDEFINED_WIN_PAD 512
123
124 struct ompi_predefined_win_t {
125 struct ompi_win_t win;
126 char padding[PREDEFINED_WIN_PAD - sizeof(ompi_win_t)];
127 };
128 typedef struct ompi_predefined_win_t ompi_predefined_win_t;
129
130 OMPI_DECLSPEC extern ompi_predefined_win_t ompi_mpi_win_null;
131 OMPI_DECLSPEC extern ompi_predefined_win_t *ompi_mpi_win_null_addr;
132
133 int ompi_win_init(void);
134 int ompi_win_finalize(void);
135
136 int ompi_win_create(void *base, size_t size, int disp_unit,
137 ompi_communicator_t *comm, opal_info_t *info,
138 ompi_win_t **newwin);
139 int ompi_win_allocate(size_t size, int disp_unit, opal_info_t *info,
140 ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin);
141 int ompi_win_allocate_shared(size_t size, int disp_unit, opal_info_t *info,
142 ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin);
143 int ompi_win_create_dynamic(opal_info_t *info, ompi_communicator_t *comm, ompi_win_t **newwin);
144
145 int ompi_win_free(ompi_win_t *win);
146
147 OMPI_DECLSPEC int ompi_win_set_name(ompi_win_t *win, const char *win_name);
148 OMPI_DECLSPEC int ompi_win_get_name(ompi_win_t *win, char *win_name, int *length);
149
150 OMPI_DECLSPEC int ompi_win_group(ompi_win_t *win, ompi_group_t **group);
151
152
153
154
155 static inline int ompi_win_invalid(ompi_win_t *win) {
156 if (NULL == win ||
157 MPI_WIN_NULL == win ||
158 (OMPI_WIN_INVALID & win->w_flags) ||
159 (OMPI_WIN_FREED & win->w_flags)) {
160 return true;
161 } else {
162 return false;
163 }
164 }
165
166 static inline int ompi_win_peer_invalid(ompi_win_t *win, int peer) {
167 if (win->w_group->grp_proc_count <= peer || peer < 0) return true;
168 return false;
169 }
170
171 static inline int ompi_win_rank(ompi_win_t *win) {
172 return win->w_group->grp_my_rank;
173 }
174
175 static inline bool ompi_win_allow_locks(ompi_win_t *win) {
176 return (0 == (win->w_flags & OMPI_WIN_NO_LOCKS));
177 }
178
179 END_C_DECLS
180 #endif