Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add last collectives from mvapich selector : bcast reduce reduce_scatter scatter
[simgrid.git] / src / smpi / colls / smpi_mvapich2_selector_stampede.h
1 /* selector for collective algorithms based on mvapich decision logic */
2
3 /* Copyright (c) 2009-2010, 2013-2014. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This is the tuning used by MVAPICH for Stampede platform based on (MV2_ARCH_INTEL_XEON_E5_2680_16, MV2_HCA_MLX_CX_FDR) */
7
8 /* Indicates number of processes per node */
9 extern int *mv2_alltoall_table_ppn_conf;
10 /* Indicates total number of configurations */
11 extern int mv2_alltoall_num_ppn_conf;
12 #define MV2_MAX_NB_THRESHOLDS  32
13 typedef struct {
14     int min;
15     int max;
16     int (*MV2_pt_Alltoall_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype,
17                                      void *recvbuf, int recvcount, MPI_Datatype recvtype,
18                                      MPI_Comm comm_ptr );
19 } mv2_alltoall_tuning_element;
20
21 typedef struct {
22     int numproc;
23     int size_table;
24     mv2_alltoall_tuning_element algo_table[MV2_MAX_NB_THRESHOLDS];
25     mv2_alltoall_tuning_element in_place_algo_table[MV2_MAX_NB_THRESHOLDS];
26 } mv2_alltoall_tuning_table;
27
28 extern int *mv2_size_alltoall_tuning_table;
29 extern mv2_alltoall_tuning_table **mv2_alltoall_thresholds_table;
30 extern int mv2_use_old_alltoall;
31
32
33 int (*MV2_Alltoall_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype,
34                               void *recvbuf, int recvcount, MPI_Datatype recvtype,
35                               MPI_Comm comm_ptr)=NULL;
36                               
37                               
38 int *mv2_alltoall_table_ppn_conf = NULL;
39 int mv2_alltoall_num_ppn_conf = 1;
40 int *mv2_size_alltoall_tuning_table = NULL;
41 mv2_alltoall_tuning_table **mv2_alltoall_thresholds_table = NULL;
42
43
44
45
46 #define MPIR_Alltoall_bruck_MV2 smpi_coll_tuned_alltoall_bruck
47 #define MPIR_Alltoall_RD_MV2 smpi_coll_tuned_alltoall_rdb
48 #define MPIR_Alltoall_Scatter_dest_MV2 smpi_coll_tuned_alltoall_ring
49 #define MPIR_Alltoall_pairwise_MV2 smpi_coll_tuned_alltoall_pair
50 #define MPIR_Alltoall_inplace_MV2 smpi_coll_tuned_alltoall_ring 
51
52
53
54 /* Indicates number of processes per node */
55 extern int *mv2_allgather_table_ppn_conf;
56 /* Indicates total number of configurations */
57 extern int mv2_allgather_num_ppn_conf;
58
59 typedef struct {
60     int min;
61     int max;
62     int (*MV2_pt_Allgather_function)(void *sendbuf,
63                                  int sendcount,
64                                  MPI_Datatype sendtype,
65                                  void *recvbuf,
66                                  int recvcount,
67                                  MPI_Datatype recvtype, MPI_Comm comm_ptr);
68 } mv2_allgather_tuning_element;
69
70 typedef struct {
71     int numproc; 
72     int two_level[MV2_MAX_NB_THRESHOLDS];
73     int size_inter_table;
74     mv2_allgather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
75 } mv2_allgather_tuning_table;
76
77 extern int *mv2_size_allgather_tuning_table;
78 extern mv2_allgather_tuning_table **mv2_allgather_thresholds_table;
79 extern int mv2_use_old_allgather;
80
81 int (*MV2_Allgather_function)(void *sendbuf,
82                              int sendcount,
83                              MPI_Datatype sendtype,
84                              void *recvbuf,
85                              int recvcount,
86                              MPI_Datatype recvtype, MPI_Comm comm);
87
88 int *mv2_allgather_table_ppn_conf = NULL;
89 int mv2_allgather_num_ppn_conf = 1;
90 int *mv2_size_allgather_tuning_table = NULL;
91 mv2_allgather_tuning_table **mv2_allgather_thresholds_table = NULL;
92
93 #define MPIR_Allgather_Bruck_MV2 smpi_coll_tuned_allgather_bruck
94 #define MPIR_Allgather_RD_MV2 smpi_coll_tuned_allgather_rdb
95 #define MPIR_Allgather_RD_Allgather_Comm_MV2 smpi_coll_tuned_allgather_rdb
96 #define MPIR_Allgather_Ring_MV2 smpi_coll_tuned_allgather_ring
97
98
99 typedef struct {
100     int min;
101     int max;
102     int (*MV2_pt_Gather_function)(void *sendbuf, int sendcnt,
103                                   MPI_Datatype sendtype, void *recvbuf, int recvcnt,
104                                   MPI_Datatype recvtype, int root, MPI_Comm  comm_ptr);
105 } mv2_gather_tuning_element;
106
107
108 typedef struct {
109     int numproc;
110     int size_inter_table;
111     mv2_gather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
112     int size_intra_table;
113     mv2_gather_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
114 } mv2_gather_tuning_table;
115
116 extern int mv2_size_gather_tuning_table;
117 extern mv2_gather_tuning_table * mv2_gather_thresholds_table;
118
119 extern int mv2_user_gather_switch_point;
120 extern int mv2_use_two_level_gather;
121 extern int mv2_gather_direct_system_size_small;
122 extern int mv2_gather_direct_system_size_medium;
123 extern int mv2_use_direct_gather;
124
125 int mv2_size_gather_tuning_table=7;
126 mv2_gather_tuning_table * mv2_gather_thresholds_table=NULL; 
127
128 typedef int (*MV2_Gather_function_ptr) (void *sendbuf,
129                                         int sendcnt,
130                                         MPI_Datatype sendtype,
131                                         void *recvbuf,
132                                         int recvcnt,
133                                         MPI_Datatype recvtype,
134                                         int root, MPI_Comm comm);
135
136 MV2_Gather_function_ptr MV2_Gather_inter_leader_function = NULL;
137 MV2_Gather_function_ptr MV2_Gather_intra_node_function = NULL;
138
139
140 #define MPIR_Gather_MV2_Direct smpi_coll_tuned_gather_ompi_basic_linear
141 #define MPIR_Gather_MV2_two_level_Direct smpi_coll_tuned_gather_ompi_basic_linear
142 #define MPIR_Gather_intra smpi_coll_tuned_gather_mpich
143
144
145
146 typedef struct {
147     int min;
148     int max;
149     int (*MV2_pt_Allgatherv_function)(void *sendbuf,
150                                       int sendcount,
151                                       MPI_Datatype sendtype,
152                                       void *recvbuf,
153                                       int *recvcounts,
154                                       int *displs,
155                                       MPI_Datatype recvtype,
156                                       MPI_Comm commg);
157 } mv2_allgatherv_tuning_element;
158
159 typedef struct {
160     int numproc; 
161     int size_inter_table;
162     mv2_allgatherv_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
163 } mv2_allgatherv_tuning_table;
164
165 extern int mv2_size_allgatherv_tuning_table;
166 extern mv2_allgatherv_tuning_table *mv2_allgatherv_thresholds_table;
167
168 int (*MV2_Allgatherv_function)(void *sendbuf,
169                                int sendcount,
170                                MPI_Datatype sendtype,
171                                void *recvbuf,
172                                int *recvcounts,
173                                int *displs,
174                                MPI_Datatype recvtype,
175                                MPI_Comm comm);
176                                
177 int mv2_size_allgatherv_tuning_table = 0;
178 mv2_allgatherv_tuning_table *mv2_allgatherv_thresholds_table = NULL;
179
180 #define MPIR_Allgatherv_Rec_Doubling_MV2 smpi_coll_tuned_allgatherv_mpich_rdb
181 #define MPIR_Allgatherv_Bruck_MV2 smpi_coll_tuned_allgatherv_ompi_bruck
182 #define MPIR_Allgatherv_Ring_MV2 smpi_coll_tuned_allgatherv_mpich_ring
183
184
185 typedef struct {
186     int min;
187     int max;
188     int (*MV2_pt_Allreduce_function)(void *sendbuf,
189                                    void *recvbuf,
190                                    int count,
191                                    MPI_Datatype datatype,
192                                    MPI_Op op, MPI_Comm comm);
193 } mv2_allreduce_tuning_element;
194
195 typedef struct {
196     int numproc; 
197     int mcast_enabled;  
198     int is_two_level_allreduce[MV2_MAX_NB_THRESHOLDS];   
199     int size_inter_table;
200     mv2_allreduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
201     int size_intra_table;
202     mv2_allreduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
203 } mv2_allreduce_tuning_table;
204
205 extern int mv2_size_allreduce_tuning_table;
206 extern mv2_allreduce_tuning_table *mv2_allreduce_thresholds_table;
207 extern int mv2_use_old_allreduce;
208
209
210 int (*MV2_Allreduce_function)(void *sendbuf,
211                              void *recvbuf,
212                              int count,
213                              MPI_Datatype datatype,
214                              MPI_Op op, MPI_Comm comm)=NULL;
215
216
217 int (*MV2_Allreduce_intra_function)( void *sendbuf,
218                              void *recvbuf,
219                              int count,
220                              MPI_Datatype datatype,
221                              MPI_Op op, MPI_Comm comm)=NULL;
222
223 int mv2_size_allreduce_tuning_table = 0;
224 mv2_allreduce_tuning_table *mv2_allreduce_thresholds_table = NULL;
225
226
227
228
229
230 static int MPIR_Allreduce_mcst_reduce_two_level_helper_MV2( void *sendbuf,
231                              void *recvbuf,
232                              int count,
233                              MPI_Datatype datatype,
234                              MPI_Op op, MPI_Comm comm)
235
236     return 0;
237 }
238
239 static  int MPIR_Allreduce_mcst_reduce_redscat_gather_MV2( void *sendbuf,
240                              void *recvbuf,
241                              int count,
242                              MPI_Datatype datatype,
243                              MPI_Op op, MPI_Comm  comm)
244 {
245     return 0;
246 }
247
248 static  int MPIR_Allreduce_reduce_p2p_MV2( void *sendbuf,
249                              void *recvbuf,
250                              int count,
251                              MPI_Datatype datatype,
252                              MPI_Op op, MPI_Comm  comm)
253 {
254     mpi_coll_reduce_fun(sendbuf,recvbuf,count,datatype,op,0,comm);
255     return MPI_SUCCESS;
256 }
257
258 static  int MPIR_Allreduce_reduce_shmem_MV2( void *sendbuf,
259                              void *recvbuf,
260                              int count,
261                              MPI_Datatype datatype,
262                              MPI_Op op, MPI_Comm  comm)
263 {
264     mpi_coll_reduce_fun(sendbuf,recvbuf,count,datatype,op,0,comm);
265     return MPI_SUCCESS;
266 }
267
268 #define MPIR_Allreduce_pt2pt_rd_MV2 smpi_coll_tuned_allreduce_rdb
269 #define MPIR_Allreduce_pt2pt_rs_MV2 smpi_coll_tuned_allreduce_rab1
270
271
272
273 /*
274 Bcast deactivated for now, defaults to mpich one
275 typedef struct {
276     int min;
277     int max;
278     int (*MV2_pt_Bcast_function) (void *buf, int count, MPI_Datatype datatype,
279                                   int root, MPI_Comm comm_ptr);
280     int zcpy_pipelined_knomial_factor;
281 } mv2_bcast_tuning_element;
282
283 typedef struct {
284     int numproc;
285     int bcast_segment_size;
286     int intra_node_knomial_factor;
287     int inter_node_knomial_factor;
288     int is_two_level_bcast[MV2_MAX_NB_THRESHOLDS];
289     int size_inter_table;
290     mv2_bcast_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
291     int size_intra_table;
292     mv2_bcast_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
293 } mv2_bcast_tuning_table;
294
295 extern int mv2_use_pipelined_bcast;
296 extern int mv2_pipelined_knomial_factor; 
297 extern int mv2_pipelined_zcpy_knomial_factor; 
298 extern int zcpy_knomial_factor;
299 extern int bcast_segment_size;
300
301 extern int mv2_size_bcast_tuning_table;
302 extern mv2_bcast_tuning_table *mv2_bcast_thresholds_table;
303 extern int mv2_use_old_bcast;
304
305 int mv2_size_bcast_tuning_table = 0;
306 mv2_bcast_tuning_table *mv2_bcast_thresholds_table = NULL;
307
308
309 int (*MV2_Bcast_function) (void *buffer, int count, MPI_Datatype datatype,
310                            int root, MPI_Comm comm_ptr) = NULL;
311
312 int (*MV2_Bcast_intra_node_function) (void *buffer, int count, MPI_Datatype datatype,
313                                       int root, MPI_Comm comm_ptr) = NULL;
314                                       
315                                       
316 */
317
318 typedef struct {
319     int min;
320     int max;
321     int (*MV2_pt_Reduce_function)(void *sendbuf,
322                                  void *recvbuf,
323                                  int count,
324                                  MPI_Datatype datatype,
325                                  MPI_Op op,
326                                  int root,
327                                  MPI_Comm  comm_ptr);
328 } mv2_reduce_tuning_element;
329
330 typedef struct {
331     int numproc; 
332     int inter_k_degree;
333     int intra_k_degree;
334     int is_two_level_reduce[MV2_MAX_NB_THRESHOLDS];
335     int size_inter_table;
336     mv2_reduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
337     int size_intra_table;
338     mv2_reduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
339 } mv2_reduce_tuning_table;
340
341 extern int mv2_size_reduce_tuning_table;
342 extern mv2_reduce_tuning_table *mv2_reduce_thresholds_table;
343 extern int mv2_use_old_reduce;
344
345 int mv2_size_reduce_tuning_table = 0;
346 mv2_reduce_tuning_table *mv2_reduce_thresholds_table = NULL;
347
348
349 int mv2_reduce_intra_knomial_factor = -1;
350 int mv2_reduce_inter_knomial_factor = -1;
351
352 int (*MV2_Reduce_function)( void *sendbuf,
353                            void *recvbuf,
354                            int count,
355                            MPI_Datatype datatype,
356                            MPI_Op op,
357                            int root,
358                            MPI_Comm  comm_ptr)=NULL;
359
360 int (*MV2_Reduce_intra_function)( void *sendbuf,
361                                  void *recvbuf,
362                                  int count,
363                                  MPI_Datatype datatype,
364                                  MPI_Op op,
365                                  int root,
366                                  MPI_Comm  comm_ptr)=NULL;
367                                  
368                                  
369 #define MPIR_Reduce_inter_knomial_wrapper_MV2 smpi_coll_tuned_reduce_ompi_binomial
370 #define MPIR_Reduce_intra_knomial_wrapper_MV2 smpi_coll_tuned_reduce_ompi_binomial
371 #define MPIR_Reduce_binomial_MV2 smpi_coll_tuned_reduce_ompi_binomial
372 #define MPIR_Reduce_redscat_gather_MV2 smpi_coll_tuned_reduce_scatter_gather
373 #define MPIR_Reduce_shmem_MV2 smpi_coll_tuned_reduce_ompi_basic_linear
374
375 typedef struct {
376     int min;
377     int max;
378     int (*MV2_pt_Red_scat_function)(void *sendbuf,
379                                     void *recvbuf,
380                                     int *recvcnts,
381                                     MPI_Datatype datatype,
382                                     MPI_Op op,
383                                     MPI_Comm comm_ptr);
384 } mv2_red_scat_tuning_element;
385
386 typedef struct {
387     int numproc; 
388     int size_inter_table;
389     mv2_red_scat_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
390 } mv2_red_scat_tuning_table;
391
392 extern int mv2_size_red_scat_tuning_table;
393 extern mv2_red_scat_tuning_table *mv2_red_scat_thresholds_table;
394
395 int mv2_size_red_scat_tuning_table = 0;
396 mv2_red_scat_tuning_table *mv2_red_scat_thresholds_table = NULL;
397
398
399 int (*MV2_Red_scat_function)(void *sendbuf,
400                              void *recvbuf,
401                              int *recvcnts,
402                              MPI_Datatype datatype,
403                              MPI_Op op,
404                              MPI_Comm comm_ptr);
405
406 #define MPIR_Reduce_Scatter_Basic_MV2 smpi_coll_tuned_reduce_scatter_mpich_noncomm
407 #define MPIR_Reduce_scatter_non_comm_MV2 smpi_coll_tuned_reduce_scatter_mpich_noncomm
408 #define MPIR_Reduce_scatter_Rec_Halving_MV2 smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving
409 #define MPIR_Reduce_scatter_Pair_Wise_MV2 smpi_coll_tuned_reduce_scatter_mpich_pair
410
411
412
413 /* Indicates number of processes per node */
414 extern int *mv2_scatter_table_ppn_conf;
415 /* Indicates total number of configurations */
416 extern int mv2_scatter_num_ppn_conf;
417
418 typedef struct {
419     int min;
420     int max;
421     int (*MV2_pt_Scatter_function)(void *sendbuf,
422                                    int sendcnt,
423                                    MPI_Datatype sendtype,
424                                    void *recvbuf,
425                                    int recvcnt,
426                                    MPI_Datatype recvtype,
427                                    int root, MPI_Comm comm);
428 } mv2_scatter_tuning_element;
429
430 typedef struct {
431     int numproc;
432     int size_inter_table;
433     mv2_scatter_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
434     int size_intra_table;
435     mv2_scatter_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
436 } mv2_scatter_tuning_table;
437
438 extern int *mv2_size_scatter_tuning_table;
439 extern mv2_scatter_tuning_table **mv2_scatter_thresholds_table;
440
441
442 int *mv2_scatter_table_ppn_conf = NULL;
443 int mv2_scatter_num_ppn_conf = 1;
444 int *mv2_size_scatter_tuning_table = NULL;
445 mv2_scatter_tuning_table **mv2_scatter_thresholds_table = NULL;
446
447 int (*MV2_Scatter_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype,
448                              void *recvbuf, int recvcount, MPI_Datatype recvtype,
449                              int root, MPI_Comm comm)=NULL;
450
451 int (*MV2_Scatter_intra_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype,
452                              void *recvbuf, int recvcount, MPI_Datatype recvtype,
453                              int root, MPI_Comm comm)=NULL;
454 int MPIR_Scatter_mcst_wrap_MV2(void *sendbuf,
455                               int sendcnt,
456                               MPI_Datatype sendtype,
457                               void *recvbuf,
458                               int recvcnt,
459                               MPI_Datatype recvtype,
460                               int root, MPI_Comm comm_ptr);
461                               
462 int MPIR_Scatter_mcst_wrap_MV2(void *sendbuf,
463                               int sendcnt,
464                               MPI_Datatype sendtype,
465                               void *recvbuf,
466                               int recvcnt,
467                               MPI_Datatype recvtype,
468                               int root, MPI_Comm comm_ptr)
469 {
470     return 0;
471 }
472
473 #define MPIR_Scatter_MV2_Binomial smpi_coll_tuned_scatter_ompi_binomial
474 #define MPIR_Scatter_MV2_Direct smpi_coll_tuned_scatter_ompi_basic_linear
475 #define MPIR_Scatter_MV2_two_level_Binomial smpi_coll_tuned_scatter_ompi_binomial
476 #define MPIR_Scatter_MV2_two_level_Direct smpi_coll_tuned_scatter_ompi_basic_linear
477