Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add scatter algos from ompi
[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) \
36
37
38 COLL_GATHERS(COLL_PROTO, COLL_NOsep)
39
40 /*************
41  * ALLGATHER *
42  *************/
43 #define COLL_ALLGATHER_SIG allgather, int, \
44                           (void *send_buff, int send_count, MPI_Datatype send_type, \
45                            void *recv_buff, int recv_count, MPI_Datatype recv_type, \
46                            MPI_Comm comm)
47
48 #define COLL_ALLGATHERS(action, COLL_sep) \
49 COLL_APPLY(action, COLL_ALLGATHER_SIG, 2dmesh) COLL_sep \
50 COLL_APPLY(action, COLL_ALLGATHER_SIG, 3dmesh) COLL_sep \
51 COLL_APPLY(action, COLL_ALLGATHER_SIG, bruck) COLL_sep \
52 COLL_APPLY(action, COLL_ALLGATHER_SIG, GB) COLL_sep \
53 COLL_APPLY(action, COLL_ALLGATHER_SIG, loosely_lr) COLL_sep \
54 COLL_APPLY(action, COLL_ALLGATHER_SIG, lr) COLL_sep \
55 COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR) COLL_sep \
56 COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR_NB) COLL_sep \
57 COLL_APPLY(action, COLL_ALLGATHER_SIG, pair) COLL_sep \
58 COLL_APPLY(action, COLL_ALLGATHER_SIG, rdb) COLL_sep \
59 COLL_APPLY(action, COLL_ALLGATHER_SIG, rhv) COLL_sep \
60 COLL_APPLY(action, COLL_ALLGATHER_SIG, ring) COLL_sep \
61 COLL_APPLY(action, COLL_ALLGATHER_SIG, SMP_NTS) COLL_sep \
62 COLL_APPLY(action, COLL_ALLGATHER_SIG, smp_simple) COLL_sep \
63 COLL_APPLY(action, COLL_ALLGATHER_SIG, spreading_simple) COLL_sep \
64 COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi) COLL_sep \
65 COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi_neighborexchange)
66
67 COLL_ALLGATHERS(COLL_PROTO, COLL_NOsep)
68
69 /**************
70  * ALLGATHERV *
71  **************/
72 #define COLL_ALLGATHERV_SIG allgatherv, int, \
73                           (void *send_buff, int send_count, MPI_Datatype send_type, \
74                            void *recv_buff, int *recv_count, int *recv_disps, \
75                            MPI_Datatype recv_type, MPI_Comm comm)
76
77 #define COLL_ALLGATHERVS(action, COLL_sep) \
78 COLL_APPLY(action, COLL_ALLGATHERV_SIG, GB) COLL_sep \
79 COLL_APPLY(action, COLL_ALLGATHERV_SIG, pair) COLL_sep \
80 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ring) COLL_sep \
81 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi) COLL_sep \
82 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_neighborexchange)
83
84 COLL_ALLGATHERVS(COLL_PROTO, COLL_NOsep)
85
86 /*************
87  * ALLREDUCE *
88  *************/
89 #define COLL_ALLREDUCE_SIG allreduce, int, \
90                           (void *sbuf, void *rbuf, int rcount, \
91                            MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
92
93 #define COLL_ALLREDUCES(action, COLL_sep) \
94 COLL_APPLY(action, COLL_ALLREDUCE_SIG, lr) COLL_sep \
95 COLL_APPLY(action, COLL_ALLREDUCE_SIG, NTS) COLL_sep \
96 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab1) COLL_sep \
97 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab2) COLL_sep \
98 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rdb) COLL_sep \
99 COLL_NOTHING(COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_reduce_scatter) COLL_sep) \
100 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rsag) COLL_sep \
101 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rdb) COLL_sep \
102 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial) COLL_sep \
103 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial_pipeline) COLL_sep \
104 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rdb) COLL_sep \
105 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag) COLL_sep \
106 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_lr) COLL_sep \
107 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_rab) COLL_sep \
108 COLL_APPLY(action, COLL_ALLREDUCE_SIG, redbcast) COLL_sep \
109 COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi) COLL_sep \
110 COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi_ring_segmented)
111
112 COLL_ALLREDUCES(COLL_PROTO, COLL_NOsep)
113
114
115 /************
116  * ALLTOALL *
117  ************/
118 #define COLL_ALLTOALL_SIG alltoall, int, \
119                          (void *send_buff, int send_count, MPI_Datatype send_type, \
120                           void *recv_buff, int recv_count, MPI_Datatype recv_type, \
121                           MPI_Comm com)
122
123 #define COLL_ALLTOALLS(action, COLL_sep) \
124 COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \
125 COLL_APPLY(action, COLL_ALLTOALL_SIG, 3dmesh) COLL_sep \
126 COLL_NOTHING(COLL_APPLY(action, COLL_ALLTOALL_SIG, bruck) COLL_sep) \
127 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair) COLL_sep \
128 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_light_barrier) COLL_sep \
129 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_mpi_barrier) COLL_sep \
130 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_one_barrier) COLL_sep \
131 COLL_APPLY(action, COLL_ALLTOALL_SIG, rdb) COLL_sep \
132 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring) COLL_sep \
133 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_light_barrier) COLL_sep \
134 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_mpi_barrier) COLL_sep \
135 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_one_barrier) COLL_sep \
136 COLL_APPLY(action, COLL_ALLTOALL_SIG, simple) COLL_sep \
137 COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi)
138
139 COLL_ALLTOALLS(COLL_PROTO, COLL_NOsep)
140
141 /*************
142  * ALLTOALLV *
143  *************/
144 #define COLL_ALLTOALLV_SIG alltoallv, int, \
145                          (void *send_buff, int *send_counts, int *send_disps, MPI_Datatype send_type, \
146                           void *recv_buff, int *recv_counts, int *recv_disps, MPI_Datatype recv_type, \
147                           MPI_Comm com)
148
149 #define COLL_ALLTOALLVS(action, COLL_sep) \
150 COLL_APPLY(action, COLL_ALLTOALLV_SIG, bruck) COLL_sep \
151 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair) COLL_sep \
152 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_light_barrier) COLL_sep \
153 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_mpi_barrier) COLL_sep \
154 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_one_barrier) COLL_sep \
155 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring) COLL_sep \
156 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_light_barrier) COLL_sep \
157 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_mpi_barrier) COLL_sep \
158 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_one_barrier) COLL_sep \
159 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi)
160
161 COLL_ALLTOALLVS(COLL_PROTO, COLL_NOsep)
162
163 /*********
164  * BCAST *
165  *********/
166 #define COLL_BCAST_SIG bcast, int, \
167                       (void *buf, int count, MPI_Datatype datatype, \
168                        int root, MPI_Comm comm)
169
170 #define COLL_BCASTS(action, COLL_sep) \
171 COLL_APPLY(action, COLL_BCAST_SIG, arrival_nb) COLL_sep \
172 COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware) COLL_sep \
173 COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware_wait) COLL_sep \
174 COLL_APPLY(action, COLL_BCAST_SIG, arrival_scatter) COLL_sep \
175 COLL_APPLY(action, COLL_BCAST_SIG, binomial_tree) COLL_sep \
176 COLL_APPLY(action, COLL_BCAST_SIG, flattree) COLL_sep \
177 COLL_APPLY(action, COLL_BCAST_SIG, flattree_pipeline) COLL_sep \
178 COLL_APPLY(action, COLL_BCAST_SIG, NTSB) COLL_sep \
179 COLL_APPLY(action, COLL_BCAST_SIG, NTSL) COLL_sep \
180 COLL_APPLY(action, COLL_BCAST_SIG, NTSL_Isend) COLL_sep \
181 COLL_APPLY(action, COLL_BCAST_SIG, scatter_LR_allgather) COLL_sep \
182 COLL_APPLY(action, COLL_BCAST_SIG, scatter_rdb_allgather) COLL_sep \
183 COLL_APPLY(action, COLL_BCAST_SIG, SMP_binary) COLL_sep \
184 COLL_APPLY(action, COLL_BCAST_SIG, SMP_binomial) COLL_sep \
185 COLL_APPLY(action, COLL_BCAST_SIG, SMP_linear) COLL_sep \
186 COLL_APPLY(action, COLL_BCAST_SIG, ompi) COLL_sep \
187 COLL_APPLY(action, COLL_BCAST_SIG, ompi_split_bintree) COLL_sep \
188 COLL_APPLY(action, COLL_BCAST_SIG, ompi_pipeline)
189
190 COLL_BCASTS(COLL_PROTO, COLL_NOsep)
191
192
193 /**********
194  * REDUCE *
195  **********/
196 #define COLL_REDUCE_SIG reduce, int, \
197                        (void *buf, void *rbuf, int count, MPI_Datatype datatype, \
198                         MPI_Op op, int root, MPI_Comm comm)
199
200 #define COLL_REDUCES(action, COLL_sep) \
201 COLL_APPLY(action, COLL_REDUCE_SIG, arrival_pattern_aware) COLL_sep \
202 COLL_APPLY(action, COLL_REDUCE_SIG, binomial) COLL_sep \
203 COLL_APPLY(action, COLL_REDUCE_SIG, flat_tree) COLL_sep \
204 COLL_APPLY(action, COLL_REDUCE_SIG, NTSL) COLL_sep \
205 COLL_APPLY(action, COLL_REDUCE_SIG, scatter_gather) COLL_sep \
206 COLL_APPLY(action, COLL_REDUCE_SIG, ompi) COLL_sep \
207 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_chain) COLL_sep \
208 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_pipeline) COLL_sep \
209 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_basic_linear) COLL_sep \
210 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_in_order_binary) COLL_sep \
211 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binary) COLL_sep \
212 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binomial)
213
214 COLL_REDUCES(COLL_PROTO, COLL_NOsep)
215
216 /*************
217  * REDUCE_SCATTER *
218  *************/
219 #define COLL_REDUCE_SCATTER_SIG reduce_scatter, int, \
220                           (void *sbuf, void *rbuf, int *rcounts,\
221                     MPI_Datatype dtype,MPI_Op  op,MPI_Comm  comm)
222
223 #define COLL_REDUCE_SCATTERS(action, COLL_sep) \
224 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi) COLL_sep \
225 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_basic_recursivehalving) COLL_sep \
226 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, ompi_ring) 
227
228 COLL_REDUCE_SCATTERS(COLL_PROTO, COLL_NOsep)
229
230
231 /*************
232  * REDUCE_SCATTER *
233  *************/
234 #define COLL_SCATTER_SIG scatter, int, \
235                 (void *sendbuf, int sendcount, MPI_Datatype sendtype,\
236                 void *recvbuf, int recvcount, MPI_Datatype recvtype,\
237                 int root, MPI_Comm comm)
238
239 #define COLL_SCATTERS(action, COLL_sep) \
240 COLL_APPLY(action, COLL_SCATTER_SIG, ompi) COLL_sep \
241 COLL_APPLY(action, COLL_SCATTER_SIG, ompi_basic_linear) COLL_sep \
242 COLL_APPLY(action, COLL_SCATTER_SIG, ompi_binomial) 
243
244 COLL_SCATTERS(COLL_PROTO, COLL_NOsep)
245
246 #endif