Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a2091b10e2e61a037eb611d8f03a1bea40b31e1d
[simgrid.git] / src / smpi / colls / colls.h
1 #ifndef SMPI_COLLS_H
2 #define SMPI_COLLS_H
3
4 #include <math.h>
5 #include "smpi/mpi.h"
6 #include "smpi/private.h"
7 #include "xbt.h"
8
9 #define COLL_DESCRIPTION(cat, ret, args, name) \
10   {# name,\
11    # cat " " # name " collective",\
12    smpi_coll_tuned_ ## cat ## _ ## name}
13
14 #define COLL_PROTO(cat, ret, args, name) \
15   ret smpi_coll_tuned_ ## cat ## _ ## name(COLL_UNPAREN args);
16 #define COLL_UNPAREN(...)  __VA_ARGS__
17
18 #define COLL_APPLY(action, sig, name) action(sig, name)
19 #define COLL_COMMA ,
20 #define COLL_NOsep 
21 #define COLL_NOTHING(...) 
22
23 /*************
24  * GATHER *
25  *************/
26 #define COLL_GATHER_SIG gather, int, \
27                           (void *send_buff, int send_count, MPI_Datatype send_type, \
28                            void *recv_buff, int recv_count, MPI_Datatype recv_type, \
29                            int root, MPI_Comm comm)
30
31 #define COLL_GATHERS(action, COLL_sep) \
32 COLL_APPLY(action, COLL_GATHER_SIG, ompi) COLL_sep \
33 COLL_APPLY(action, COLL_GATHER_SIG, ompi_basic_linear) COLL_sep \
34 COLL_APPLY(action, COLL_GATHER_SIG, ompi_binomial) COLL_sep \
35 COLL_APPLY(action, COLL_GATHER_SIG, ompi_linear_sync) COLL_sep \
36 COLL_APPLY(action, COLL_GATHER_SIG, mpich) COLL_sep \
37 COLL_APPLY(action, COLL_GATHER_SIG, automatic)
38
39
40
41 COLL_GATHERS(COLL_PROTO, COLL_NOsep)
42
43 /*************
44  * ALLGATHER *
45  *************/
46 #define COLL_ALLGATHER_SIG allgather, int, \
47                           (void *send_buff, int send_count, MPI_Datatype send_type, \
48                            void *recv_buff, int recv_count, MPI_Datatype recv_type, \
49                            MPI_Comm comm)
50
51 #define COLL_ALLGATHERS(action, COLL_sep) \
52 COLL_APPLY(action, COLL_ALLGATHER_SIG, 2dmesh) COLL_sep \
53 COLL_APPLY(action, COLL_ALLGATHER_SIG, 3dmesh) COLL_sep \
54 COLL_APPLY(action, COLL_ALLGATHER_SIG, bruck) COLL_sep \
55 COLL_APPLY(action, COLL_ALLGATHER_SIG, GB) COLL_sep \
56 COLL_APPLY(action, COLL_ALLGATHER_SIG, loosely_lr) COLL_sep \
57 COLL_APPLY(action, COLL_ALLGATHER_SIG, lr) COLL_sep \
58 COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR) COLL_sep \
59 COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR_NB) COLL_sep \
60 COLL_APPLY(action, COLL_ALLGATHER_SIG, pair) COLL_sep \
61 COLL_APPLY(action, COLL_ALLGATHER_SIG, rdb) COLL_sep \
62 COLL_APPLY(action, COLL_ALLGATHER_SIG, rhv) COLL_sep \
63 COLL_APPLY(action, COLL_ALLGATHER_SIG, ring) COLL_sep \
64 COLL_APPLY(action, COLL_ALLGATHER_SIG, SMP_NTS) COLL_sep \
65 COLL_APPLY(action, COLL_ALLGATHER_SIG, smp_simple) COLL_sep \
66 COLL_APPLY(action, COLL_ALLGATHER_SIG, spreading_simple) COLL_sep \
67 COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi) COLL_sep \
68 COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi_neighborexchange) COLL_sep \
69 COLL_APPLY(action, COLL_ALLGATHER_SIG, mpich) COLL_sep \
70 COLL_APPLY(action, COLL_ALLGATHER_SIG, automatic)
71
72
73 COLL_ALLGATHERS(COLL_PROTO, COLL_NOsep)
74
75 /**************
76  * ALLGATHERV *
77  **************/
78 #define COLL_ALLGATHERV_SIG allgatherv, int, \
79                           (void *send_buff, int send_count, MPI_Datatype send_type, \
80                            void *recv_buff, int *recv_count, int *recv_disps, \
81                            MPI_Datatype recv_type, MPI_Comm comm)
82
83 #define COLL_ALLGATHERVS(action, COLL_sep) \
84 COLL_APPLY(action, COLL_ALLGATHERV_SIG, GB) COLL_sep \
85 COLL_APPLY(action, COLL_ALLGATHERV_SIG, pair) COLL_sep \
86 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ring) COLL_sep \
87 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi) COLL_sep \
88 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_neighborexchange) COLL_sep \
89 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_bruck) COLL_sep \
90 COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich) COLL_sep \
91 COLL_APPLY(action, COLL_ALLGATHERV_SIG, mpich_rdb) COLL_sep \
92 COLL_APPLY(action, COLL_ALLGATHERV_SIG, automatic)
93
94 COLL_ALLGATHERVS(COLL_PROTO, COLL_NOsep)
95
96 /*************
97  * ALLREDUCE *
98  *************/
99 #define COLL_ALLREDUCE_SIG allreduce, int, \
100                           (void *sbuf, void *rbuf, int rcount, \
101                            MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
102
103 #define COLL_ALLREDUCES(action, COLL_sep) \
104 COLL_APPLY(action, COLL_ALLREDUCE_SIG, lr) COLL_sep \
105 COLL_APPLY(action, COLL_ALLREDUCE_SIG, NTS) COLL_sep \
106 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab1) COLL_sep \
107 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab2) COLL_sep \
108 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rdb) COLL_sep \
109 COLL_NOTHING(COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_reduce_scatter) COLL_sep) \
110 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rsag) COLL_sep \
111 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rdb) COLL_sep \
112 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial) COLL_sep \
113 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial_pipeline) COLL_sep \
114 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rdb) COLL_sep \
115 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag) COLL_sep \
116 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_lr) COLL_sep \
117 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_rab) COLL_sep \
118 COLL_APPLY(action, COLL_ALLREDUCE_SIG, redbcast) COLL_sep \
119 COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi) COLL_sep \
120 COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi_ring_segmented) COLL_sep \
121 COLL_APPLY(action, COLL_ALLREDUCE_SIG, mpich) COLL_sep \
122 COLL_APPLY(action, COLL_ALLREDUCE_SIG, automatic)
123
124 COLL_ALLREDUCES(COLL_PROTO, COLL_NOsep)
125
126
127 /************
128  * ALLTOALL *
129  ************/
130 #define COLL_ALLTOALL_SIG alltoall, int, \
131                          (void *send_buff, int send_count, MPI_Datatype send_type, \
132                           void *recv_buff, int recv_count, MPI_Datatype recv_type, \
133                           MPI_Comm comm)
134
135 #define COLL_ALLTOALLS(action, COLL_sep) \
136 COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \
137 COLL_APPLY(action, COLL_ALLTOALL_SIG, 3dmesh) COLL_sep \
138 COLL_NOTHING(COLL_APPLY(action, COLL_ALLTOALL_SIG, bruck) COLL_sep) \
139 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair) COLL_sep \
140 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_light_barrier) COLL_sep \
141 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_mpi_barrier) COLL_sep \
142 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_one_barrier) COLL_sep \
143 COLL_APPLY(action, COLL_ALLTOALL_SIG, rdb) COLL_sep \
144 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring) COLL_sep \
145 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_light_barrier) COLL_sep \
146 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_mpi_barrier) COLL_sep \
147 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_one_barrier) COLL_sep \
148 COLL_APPLY(action, COLL_ALLTOALL_SIG, simple) COLL_sep \
149 COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi) COLL_sep \
150 COLL_APPLY(action, COLL_ALLTOALL_SIG, mpich) COLL_sep \
151 COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi_pairwise) COLL_sep \
152 COLL_APPLY(action, COLL_ALLTOALL_SIG, automatic)
153
154 COLL_ALLTOALLS(COLL_PROTO, COLL_NOsep)
155
156 /*************
157  * ALLTOALLV *
158  *************/
159 #define COLL_ALLTOALLV_SIG alltoallv, int, \
160                          (void *send_buff, int *send_counts, int *send_disps, MPI_Datatype send_type, \
161                           void *recv_buff, int *recv_counts, int *recv_disps, MPI_Datatype recv_type, \
162                           MPI_Comm comm)
163
164 #define COLL_ALLTOALLVS(action, COLL_sep) \
165 COLL_APPLY(action, COLL_ALLTOALLV_SIG, bruck) COLL_sep \
166 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair) COLL_sep \
167 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_light_barrier) COLL_sep \
168 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_mpi_barrier) COLL_sep \
169 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_one_barrier) COLL_sep \
170 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring) COLL_sep \
171 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_light_barrier) COLL_sep \
172 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_mpi_barrier) COLL_sep \
173 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_one_barrier) COLL_sep \
174 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi) COLL_sep \
175 COLL_APPLY(action, COLL_ALLTOALLV_SIG, mpich) COLL_sep \
176 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi_basic_linear) COLL_sep \
177 COLL_APPLY(action, COLL_ALLTOALLV_SIG, automatic)
178
179 COLL_ALLTOALLVS(COLL_PROTO, COLL_NOsep)
180
181 /*********
182  * BCAST *
183  *********/
184 #define COLL_BCAST_SIG bcast, int, \
185                       (void *buf, int count, MPI_Datatype datatype, \
186                        int root, MPI_Comm comm)
187
188 #define COLL_BCASTS(action, COLL_sep) \
189 COLL_APPLY(action, COLL_BCAST_SIG, arrival_nb) COLL_sep \
190 COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware) COLL_sep \
191 COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware_wait) COLL_sep \
192 COLL_APPLY(action, COLL_BCAST_SIG, arrival_scatter) COLL_sep \
193 COLL_APPLY(action, COLL_BCAST_SIG, binomial_tree) COLL_sep \
194 COLL_APPLY(action, COLL_BCAST_SIG, flattree) COLL_sep \
195 COLL_APPLY(action, COLL_BCAST_SIG, flattree_pipeline) COLL_sep \
196 COLL_APPLY(action, COLL_BCAST_SIG, NTSB) COLL_sep \
197 COLL_APPLY(action, COLL_BCAST_SIG, NTSL) COLL_sep \
198 COLL_APPLY(action, COLL_BCAST_SIG, NTSL_Isend) COLL_sep \
199 COLL_APPLY(action, COLL_BCAST_SIG, scatter_LR_allgather) COLL_sep \
200 COLL_APPLY(action, COLL_BCAST_SIG, scatter_rdb_allgather) COLL_sep \
201 COLL_APPLY(action, COLL_BCAST_SIG, SMP_binary) COLL_sep \
202 COLL_APPLY(action, COLL_BCAST_SIG, SMP_binomial) COLL_sep \
203 COLL_APPLY(action, COLL_BCAST_SIG, SMP_linear) COLL_sep \
204 COLL_APPLY(action, COLL_BCAST_SIG, ompi) COLL_sep \
205 COLL_APPLY(action, COLL_BCAST_SIG, ompi_split_bintree) COLL_sep \
206 COLL_APPLY(action, COLL_BCAST_SIG, ompi_pipeline) COLL_sep \
207 COLL_APPLY(action, COLL_BCAST_SIG, mpich) COLL_sep \
208 COLL_APPLY(action, COLL_BCAST_SIG, automatic)
209
210 COLL_BCASTS(COLL_PROTO, COLL_NOsep)
211
212
213 /**********
214  * REDUCE *
215  **********/
216 #define COLL_REDUCE_SIG reduce, int, \
217                        (void *buf, void *rbuf, int count, MPI_Datatype datatype, \
218                         MPI_Op op, int root, MPI_Comm comm)
219
220 #define COLL_REDUCES(action, COLL_sep) \
221 COLL_APPLY(action, COLL_REDUCE_SIG, arrival_pattern_aware) COLL_sep \
222 COLL_APPLY(action, COLL_REDUCE_SIG, binomial) COLL_sep \
223 COLL_APPLY(action, COLL_REDUCE_SIG, flat_tree) COLL_sep \
224 COLL_APPLY(action, COLL_REDUCE_SIG, NTSL) COLL_sep \
225 COLL_APPLY(action, COLL_REDUCE_SIG, scatter_gather) COLL_sep \
226 COLL_APPLY(action, COLL_REDUCE_SIG, ompi) COLL_sep \
227 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_chain) COLL_sep \
228 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_pipeline) COLL_sep \
229 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_basic_linear) COLL_sep \
230 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_in_order_binary) COLL_sep \
231 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binary) COLL_sep \
232 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binomial) COLL_sep \
233 COLL_APPLY(action, COLL_REDUCE_SIG, mpich) COLL_sep \
234 COLL_APPLY(action, COLL_REDUCE_SIG, automatic)
235
236 COLL_REDUCES(COLL_PROTO, COLL_NOsep)
237
238 /*************
239  * REDUCE_SCATTER *
240  *************/
241 #define COLL_REDUCE_SCATTER_SIG reduce_scatter, int, \
242                           (void *sbuf, void *rbuf, int *rcounts,\
243                     MPI_Datatype dtype,MPI_Op  op,MPI_Comm  comm)
244
245 #define COLL_REDUCE_SCATTERS(action, COLL_sep) \
246 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi) COLL_sep \
247 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_basic_recursivehalving) COLL_sep \
248 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_ring)  COLL_sep \
249 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich) COLL_sep \
250 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_pair) COLL_sep \
251 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_rdb) COLL_sep \
252 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mpich_noncomm) COLL_sep \
253 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, automatic)
254
255
256
257 COLL_REDUCE_SCATTERS(COLL_PROTO, COLL_NOsep)
258
259
260 /*************
261  * SCATTER *
262  *************/
263 #define COLL_SCATTER_SIG scatter, int, \
264                 (void *sendbuf, int sendcount, MPI_Datatype sendtype,\
265                 void *recvbuf, int recvcount, MPI_Datatype recvtype,\
266                 int root, MPI_Comm comm)
267
268 #define COLL_SCATTERS(action, COLL_sep) \
269 COLL_APPLY(action, COLL_SCATTER_SIG, ompi) COLL_sep \
270 COLL_APPLY(action, COLL_SCATTER_SIG, ompi_basic_linear) COLL_sep \
271 COLL_APPLY(action, COLL_SCATTER_SIG, ompi_binomial)  COLL_sep \
272 COLL_APPLY(action, COLL_SCATTER_SIG, mpich)   COLL_sep \
273 COLL_APPLY(action, COLL_SCATTER_SIG, automatic)
274
275 COLL_SCATTERS(COLL_PROTO, COLL_NOsep)
276
277 /*************
278  * SCATTER *
279  *************/
280 #define COLL_BARRIER_SIG barrier, int, \
281                 (MPI_Comm comm)
282
283 #define COLL_BARRIERS(action, COLL_sep) \
284 COLL_APPLY(action, COLL_BARRIER_SIG, ompi) COLL_sep \
285 COLL_APPLY(action, COLL_BARRIER_SIG, ompi_basic_linear) COLL_sep \
286 COLL_APPLY(action, COLL_BARRIER_SIG, ompi_two_procs)  COLL_sep \
287 COLL_APPLY(action, COLL_BARRIER_SIG, ompi_tree)  COLL_sep \
288 COLL_APPLY(action, COLL_BARRIER_SIG, ompi_bruck)  COLL_sep \
289 COLL_APPLY(action, COLL_BARRIER_SIG, ompi_recursivedoubling) COLL_sep \
290 COLL_APPLY(action, COLL_BARRIER_SIG, ompi_doublering) COLL_sep \
291 COLL_APPLY(action, COLL_BARRIER_SIG, mpich)   COLL_sep \
292 COLL_APPLY(action, COLL_BARRIER_SIG, automatic)
293
294 COLL_BARRIERS(COLL_PROTO, COLL_NOsep)
295
296
297 #endif