Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ee51cacf8285c2dbf861b0fff42ab9378cd9879e
[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 /*************
25  * ALLGATHER *
26  *************/
27 #define COLL_ALLGATHER_SIG allgather, int, \
28                           (void *send_buff, int send_count, MPI_Datatype send_type, \
29                            void *recv_buff, int recv_count, MPI_Datatype recv_type, \
30                            MPI_Comm comm)
31
32 #define COLL_ALLGATHERS(action, COLL_sep) \
33 COLL_APPLY(action, COLL_ALLGATHER_SIG, 2dmesh) COLL_sep \
34 COLL_APPLY(action, COLL_ALLGATHER_SIG, 3dmesh) COLL_sep \
35 COLL_APPLY(action, COLL_ALLGATHER_SIG, bruck) COLL_sep \
36 COLL_APPLY(action, COLL_ALLGATHER_SIG, GB) COLL_sep \
37 COLL_APPLY(action, COLL_ALLGATHER_SIG, loosely_lr) COLL_sep \
38 COLL_APPLY(action, COLL_ALLGATHER_SIG, lr) COLL_sep \
39 COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR) COLL_sep \
40 COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR_NB) COLL_sep \
41 COLL_APPLY(action, COLL_ALLGATHER_SIG, pair) COLL_sep \
42 COLL_APPLY(action, COLL_ALLGATHER_SIG, rdb) COLL_sep \
43 COLL_APPLY(action, COLL_ALLGATHER_SIG, rhv) COLL_sep \
44 COLL_APPLY(action, COLL_ALLGATHER_SIG, ring) COLL_sep \
45 COLL_APPLY(action, COLL_ALLGATHER_SIG, SMP_NTS) COLL_sep \
46 COLL_APPLY(action, COLL_ALLGATHER_SIG, smp_simple) COLL_sep \
47 COLL_APPLY(action, COLL_ALLGATHER_SIG, spreading_simple) COLL_sep \
48 COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi) COLL_sep \
49 COLL_APPLY(action, COLL_ALLGATHER_SIG, ompi_neighborexchange)
50
51 COLL_ALLGATHERS(COLL_PROTO, COLL_NOsep)
52
53 /**************
54  * ALLGATHERV *
55  **************/
56 #define COLL_ALLGATHERV_SIG allgatherv, int, \
57                           (void *send_buff, int send_count, MPI_Datatype send_type, \
58                            void *recv_buff, int *recv_count, int *recv_disps, \
59                            MPI_Datatype recv_type, MPI_Comm comm)
60
61 #define COLL_ALLGATHERVS(action, COLL_sep) \
62 COLL_APPLY(action, COLL_ALLGATHERV_SIG, GB) COLL_sep \
63 COLL_APPLY(action, COLL_ALLGATHERV_SIG, pair) COLL_sep \
64 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ring) COLL_sep \
65 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi) COLL_sep \
66 COLL_APPLY(action, COLL_ALLGATHERV_SIG, ompi_neighborexchange)
67
68 COLL_ALLGATHERVS(COLL_PROTO, COLL_NOsep)
69
70 /*************
71  * ALLREDUCE *
72  *************/
73 #define COLL_ALLREDUCE_SIG allreduce, int, \
74                           (void *sbuf, void *rbuf, int rcount, \
75                            MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
76
77 #define COLL_ALLREDUCES(action, COLL_sep) \
78 COLL_APPLY(action, COLL_ALLREDUCE_SIG, lr) COLL_sep \
79 COLL_APPLY(action, COLL_ALLREDUCE_SIG, NTS) COLL_sep \
80 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab1) COLL_sep \
81 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab2) COLL_sep \
82 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rdb) COLL_sep \
83 COLL_NOTHING(COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_reduce_scatter) COLL_sep) \
84 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rab_rsag) COLL_sep \
85 COLL_APPLY(action, COLL_ALLREDUCE_SIG, rdb) COLL_sep \
86 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial) COLL_sep \
87 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_binomial_pipeline) COLL_sep \
88 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rdb) COLL_sep \
89 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag) COLL_sep \
90 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_lr) COLL_sep \
91 COLL_APPLY(action, COLL_ALLREDUCE_SIG, smp_rsag_rab) COLL_sep \
92 COLL_APPLY(action, COLL_ALLREDUCE_SIG, redbcast) COLL_sep \
93 COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi) COLL_sep \
94 COLL_APPLY(action, COLL_ALLREDUCE_SIG, ompi_ring_segmented)
95
96 COLL_ALLREDUCES(COLL_PROTO, COLL_NOsep)
97
98
99 /************
100  * ALLTOALL *
101  ************/
102 #define COLL_ALLTOALL_SIG alltoall, int, \
103                          (void *send_buff, int send_count, MPI_Datatype send_type, \
104                           void *recv_buff, int recv_count, MPI_Datatype recv_type, \
105                           MPI_Comm com)
106
107 #define COLL_ALLTOALLS(action, COLL_sep) \
108 COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \
109 COLL_APPLY(action, COLL_ALLTOALL_SIG, 3dmesh) COLL_sep \
110 COLL_NOTHING(COLL_APPLY(action, COLL_ALLTOALL_SIG, bruck) COLL_sep) \
111 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair) COLL_sep \
112 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_light_barrier) COLL_sep \
113 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_mpi_barrier) COLL_sep \
114 COLL_APPLY(action, COLL_ALLTOALL_SIG, pair_one_barrier) COLL_sep \
115 COLL_APPLY(action, COLL_ALLTOALL_SIG, rdb) COLL_sep \
116 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring) COLL_sep \
117 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_light_barrier) COLL_sep \
118 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_mpi_barrier) COLL_sep \
119 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_one_barrier) COLL_sep \
120 COLL_APPLY(action, COLL_ALLTOALL_SIG, simple) COLL_sep \
121 COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi)
122
123 COLL_ALLTOALLS(COLL_PROTO, COLL_NOsep)
124
125 /*************
126  * ALLTOALLV *
127  *************/
128 #define COLL_ALLTOALLV_SIG alltoallv, int, \
129                          (void *send_buff, int *send_counts, int *send_disps, MPI_Datatype send_type, \
130                           void *recv_buff, int *recv_counts, int *recv_disps, MPI_Datatype recv_type, \
131                           MPI_Comm com)
132
133 #define COLL_ALLTOALLVS(action, COLL_sep) \
134 COLL_APPLY(action, COLL_ALLTOALLV_SIG, bruck) COLL_sep \
135 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair) COLL_sep \
136 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_light_barrier) COLL_sep \
137 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_mpi_barrier) COLL_sep \
138 COLL_APPLY(action, COLL_ALLTOALLV_SIG, pair_one_barrier) COLL_sep \
139 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring) COLL_sep \
140 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_light_barrier) COLL_sep \
141 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_mpi_barrier) COLL_sep \
142 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ring_one_barrier) COLL_sep \
143 COLL_APPLY(action, COLL_ALLTOALLV_SIG, ompi)
144
145 COLL_ALLTOALLVS(COLL_PROTO, COLL_NOsep)
146
147 /*********
148  * BCAST *
149  *********/
150 #define COLL_BCAST_SIG bcast, int, \
151                       (void *buf, int count, MPI_Datatype datatype, \
152                        int root, MPI_Comm comm)
153
154 #define COLL_BCASTS(action, COLL_sep) \
155 COLL_APPLY(action, COLL_BCAST_SIG, arrival_nb) COLL_sep \
156 COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware) COLL_sep \
157 COLL_APPLY(action, COLL_BCAST_SIG, arrival_pattern_aware_wait) COLL_sep \
158 COLL_APPLY(action, COLL_BCAST_SIG, arrival_scatter) COLL_sep \
159 COLL_APPLY(action, COLL_BCAST_SIG, binomial_tree) COLL_sep \
160 COLL_APPLY(action, COLL_BCAST_SIG, flattree) COLL_sep \
161 COLL_APPLY(action, COLL_BCAST_SIG, flattree_pipeline) COLL_sep \
162 COLL_APPLY(action, COLL_BCAST_SIG, NTSB) COLL_sep \
163 COLL_APPLY(action, COLL_BCAST_SIG, NTSL) COLL_sep \
164 COLL_APPLY(action, COLL_BCAST_SIG, NTSL_Isend) COLL_sep \
165 COLL_APPLY(action, COLL_BCAST_SIG, scatter_LR_allgather) COLL_sep \
166 COLL_APPLY(action, COLL_BCAST_SIG, scatter_rdb_allgather) COLL_sep \
167 COLL_APPLY(action, COLL_BCAST_SIG, SMP_binary) COLL_sep \
168 COLL_APPLY(action, COLL_BCAST_SIG, SMP_binomial) COLL_sep \
169 COLL_APPLY(action, COLL_BCAST_SIG, SMP_linear) COLL_sep \
170 COLL_APPLY(action, COLL_BCAST_SIG, ompi) COLL_sep \
171 COLL_APPLY(action, COLL_BCAST_SIG, ompi_split_bintree) COLL_sep \
172 COLL_APPLY(action, COLL_BCAST_SIG, ompi_pipeline)
173
174 COLL_BCASTS(COLL_PROTO, COLL_NOsep)
175
176
177 /**********
178  * REDUCE *
179  **********/
180 #define COLL_REDUCE_SIG reduce, int, \
181                        (void *buf, void *rbuf, int count, MPI_Datatype datatype, \
182                         MPI_Op op, int root, MPI_Comm comm)
183
184 #define COLL_REDUCES(action, COLL_sep) \
185 COLL_APPLY(action, COLL_REDUCE_SIG, arrival_pattern_aware) COLL_sep \
186 COLL_APPLY(action, COLL_REDUCE_SIG, binomial) COLL_sep \
187 COLL_APPLY(action, COLL_REDUCE_SIG, flat_tree) COLL_sep \
188 COLL_APPLY(action, COLL_REDUCE_SIG, NTSL) COLL_sep \
189 COLL_APPLY(action, COLL_REDUCE_SIG, scatter_gather) COLL_sep \
190 COLL_APPLY(action, COLL_REDUCE_SIG, ompi) COLL_sep \
191 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_chain) COLL_sep \
192 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_pipeline) COLL_sep \
193 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_basic_linear) COLL_sep \
194 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_in_order_binary) COLL_sep \
195 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binary) COLL_sep \
196 COLL_APPLY(action, COLL_REDUCE_SIG, ompi_binomial)
197
198 COLL_REDUCES(COLL_PROTO, COLL_NOsep)
199
200 #endif