Logo AND Algorithmique Numérique Distribuée

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