Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add scatter algos from ompi
[simgrid.git] / src / smpi / colls / coll_tuned_topo.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  *                         University Research and Technology
4  *                         Corporation.  All rights reserved.
5  * Copyright (c) 2004-2005 The University of Tennessee and The University
6  *                         of Tennessee Research Foundation.  All rights
7  *                         reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 
9  *                         University of Stuttgart.  All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  *                         All rights reserved.
12  * $COPYRIGHT$
13  * 
14  * Additional copyrights may follow
15  * 
16  * $HEADER$
17  */
18
19 #ifndef MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED
20 #define MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED
21
22 #include "colls_private.h"
23
24 #define MAXTREEFANOUT 32
25
26 #define COLL_TUNED_COMPUTED_SEGCOUNT(SEGSIZE, TYPELNG, SEGCOUNT)        \
27     if( ((SEGSIZE) >= (TYPELNG)) &&                                     \
28         ((SEGSIZE) < ((TYPELNG) * (SEGCOUNT))) ) {                      \
29         size_t residual;                                                \
30         (SEGCOUNT) = (int)((SEGSIZE) / (TYPELNG));                      \
31         residual = (SEGSIZE) - (SEGCOUNT) * (TYPELNG);                  \
32         if( residual > ((TYPELNG) >> 1) )                               \
33             (SEGCOUNT)++;                                               \
34     }                                                                   \
35
36
37     typedef struct ompi_coll_tree_t {
38         int32_t tree_root;
39         int32_t tree_fanout;
40         int32_t tree_bmtree;
41         int32_t tree_prev;
42         int32_t tree_next[MAXTREEFANOUT];
43         int32_t tree_nextsize;
44     } ompi_coll_tree_t;
45
46     ompi_coll_tree_t*
47     ompi_coll_tuned_topo_build_tree( int fanout,
48                                      MPI_Comm com,
49                                      int root );
50     ompi_coll_tree_t*
51     ompi_coll_tuned_topo_build_in_order_bintree( MPI_Comm comm );
52
53     ompi_coll_tree_t*
54     ompi_coll_tuned_topo_build_bmtree( MPI_Comm comm,
55                                        int root );
56     ompi_coll_tree_t*
57     ompi_coll_tuned_topo_build_in_order_bmtree( MPI_Comm comm,
58                                                 int root );
59     ompi_coll_tree_t*
60     ompi_coll_tuned_topo_build_chain( int fanout,
61                                       MPI_Comm com,
62                                       int root );
63
64     int ompi_coll_tuned_topo_destroy_tree( ompi_coll_tree_t** tree );
65
66     /* debugging stuff, will be removed later */
67     int ompi_coll_tuned_topo_dump_tree (ompi_coll_tree_t* tree, int rank);
68
69 #endif  /* MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED */
70