1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef COLL_PORTALS4_REQUEST_H
14 #define COLL_PORTALS4_REQUEST_H
15
16 #include "ompi/request/request.h"
17 #include "coll_portals4.h"
18
19
20 enum ompi_coll_portals4_bcast_algo_t {
21 OMPI_COLL_PORTALS4_BCAST_KARY_TREE_ALGO,
22 OMPI_COLL_PORTALS4_BCAST_PIPELINE_ALGO,
23 };
24 typedef enum ompi_coll_portals4_bcast_algo_t ompi_coll_portals4_bcast_algo_t;
25
26
27 enum ompi_coll_portals4_request_type_t {
28 OMPI_COLL_PORTALS4_TYPE_BARRIER,
29 OMPI_COLL_PORTALS4_TYPE_BCAST,
30 OMPI_COLL_PORTALS4_TYPE_SCATTER,
31 OMPI_COLL_PORTALS4_TYPE_GATHER,
32 OMPI_COLL_PORTALS4_TYPE_REDUCE,
33 OMPI_COLL_PORTALS4_TYPE_ALLREDUCE,
34 };
35 typedef enum ompi_coll_portals4_request_type_t ompi_coll_portals4_request_type_t;
36
37
38 struct ompi_coll_portals4_request_t {
39 ompi_request_t super;
40 ompi_coll_portals4_request_type_t type;
41 bool is_sync;
42
43 ompi_request_t **fallback_request;
44 union {
45 struct {
46 ptl_handle_me_t data_me_h;
47 ptl_handle_ct_t rtr_ct_h;
48 } barrier;
49
50 struct {
51 bool needs_pack;
52 bool is_root;
53 opal_convertor_t convertor;
54 void *tmpbuf;
55 size_t tmpsize;
56
57 union {
58 ptl_rank_t child;
59 unsigned int child_nb;
60 } u;
61 ompi_coll_portals4_bcast_algo_t algo;
62 int segment_nb;
63 ptl_handle_ct_t rtr_ct_h;
64 ptl_handle_ct_t trig_ct_h;
65 ptl_handle_ct_t ack_ct_h;
66 } bcast;
67
68 struct {
69 bool is_optim;
70 bool use_ack_ct_h;
71 unsigned int child_nb;
72 void *free_buffer;
73 ptl_handle_me_t data_me_h;
74 ptl_handle_ct_t trig_ct_h;
75 ptl_handle_ct_t ack_ct_h;
76 } reduce;
77
78 struct {
79 bool is_optim;
80 unsigned int child_nb;
81 ptl_handle_me_t data_me_h;
82 ptl_handle_ct_t trig_ct_h;
83 ptl_handle_ct_t ack_ct_h;
84 } allreduce;
85
86 struct {
87 opal_convertor_t send_converter;
88 opal_convertor_t recv_converter;
89 size_t packed_size;
90 int8_t is_sync;
91 int8_t free_after;
92 size_t coll_count;
93 char *gather_buf;
94 uint64_t gather_bytes;
95 ptl_match_bits_t gather_match_bits;
96 ptl_handle_md_t gather_mdh;
97 ptl_size_t gather_offset;
98 ptl_handle_ct_t gather_cth;
99 ptl_handle_md_t gather_meh;
100 ptl_match_bits_t sync_match_bits;
101 ptl_handle_md_t sync_mdh;
102 ptl_handle_ct_t sync_cth;
103 ptl_handle_me_t sync_meh;
104 int my_rank;
105 int root_rank;
106 int size;
107 const void *sbuf;
108 void *rbuf;
109 const char *pack_src_buf;
110 int pack_src_count;
111 struct ompi_datatype_t *pack_src_dtype;
112 MPI_Aint pack_src_extent;
113 MPI_Aint pack_src_true_extent;
114 MPI_Aint pack_src_lb;
115 MPI_Aint pack_src_true_lb;
116 MPI_Aint pack_src_offset;
117 char *unpack_dst_buf;
118 int unpack_dst_count;
119 struct ompi_datatype_t *unpack_dst_dtype;
120 MPI_Aint unpack_dst_extent;
121 MPI_Aint unpack_dst_true_extent;
122 MPI_Aint unpack_dst_lb;
123 MPI_Aint unpack_dst_true_lb;
124 } gather;
125
126 struct {
127 opal_convertor_t send_converter;
128 opal_convertor_t recv_converter;
129 size_t packed_size;
130 int8_t is_sync;
131 int8_t free_after;
132 size_t coll_count;
133 char *scatter_buf;
134 uint64_t scatter_bytes;
135 ptl_match_bits_t scatter_match_bits;
136 ptl_handle_md_t scatter_mdh;
137 ptl_handle_ct_t scatter_cth;
138 ptl_handle_md_t scatter_meh;
139 ptl_match_bits_t sync_match_bits;
140 ptl_handle_md_t sync_mdh;
141 ptl_handle_ct_t sync_cth;
142 ptl_handle_me_t sync_meh;
143 int my_rank;
144 int root_rank;
145 int size;
146 const void *sbuf;
147 void *rbuf;
148 uint64_t pack_bytes;
149 const char *pack_src_buf;
150 int pack_src_count;
151 struct ompi_datatype_t *pack_src_dtype;
152 MPI_Aint pack_src_extent;
153 MPI_Aint pack_src_true_extent;
154 MPI_Aint pack_src_lb;
155 MPI_Aint pack_src_true_lb;
156 uint64_t unpack_bytes;
157 char *unpack_dst_buf;
158 int unpack_dst_count;
159 struct ompi_datatype_t *unpack_dst_dtype;
160 MPI_Aint unpack_dst_extent;
161 MPI_Aint unpack_dst_true_extent;
162 MPI_Aint unpack_dst_lb;
163 MPI_Aint unpack_dst_true_lb;
164 MPI_Aint unpack_dst_offset;
165 } scatter;
166 } u;
167 };
168 typedef struct ompi_coll_portals4_request_t ompi_coll_portals4_request_t;
169
170 OBJ_CLASS_DECLARATION(ompi_coll_portals4_request_t);
171
172 #define OMPI_COLL_PORTALS4_REQUEST_ALLOC(comm, req) \
173 do { \
174 opal_free_list_item_t *item; \
175 item = opal_free_list_get(&mca_coll_portals4_component.requests); \
176 req = (ompi_coll_portals4_request_t*) item; \
177 OMPI_REQUEST_INIT(&req->super, false); \
178 req->super.req_mpi_object.comm = comm; \
179 req->super.req_complete = false; \
180 req->super.req_state = OMPI_REQUEST_ACTIVE; \
181 } while (0)
182
183 #define OMPI_COLL_PORTALS4_REQUEST_RETURN(req) \
184 do { \
185 OMPI_REQUEST_FINI(&request->super); \
186 opal_free_list_return(&mca_coll_portals4_component.requests, \
187 (opal_free_list_item_t*) req); \
188 } while (0)
189
190
191 #endif