Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright headers.
[simgrid.git] / src / smpi / colls / coll_tuned_topo.hpp
1 /* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 /*
7  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
8  *                         University Research and Technology
9  *                         Corporation.  All rights reserved.
10  * Copyright (c) 2004-2005 The University of Tennessee and The University
11  *                         of Tennessee Research Foundation.  All rights
12  *                         reserved.
13  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
14  *                         University of Stuttgart.  All rights reserved.
15  * Copyright (c) 2004-2005 The Regents of the University of California.
16  *                         All rights reserved.
17  *
18  * Additional copyrights may follow
19  */
20
21 #ifndef MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED
22 #define MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED
23
24 #include "colls_private.hpp"
25
26 #define MAXTREEFANOUT 32
27
28 #define COLL_TUNED_COMPUTED_SEGCOUNT(SEGSIZE, TYPELNG, SEGCOUNT)                                                       \
29   if (((SEGSIZE) >= (TYPELNG)) && ((SEGSIZE) < ((TYPELNG) * (SEGCOUNT)))) {                                            \
30     size_t residual;                                                                                                   \
31     (SEGCOUNT) = (int)((SEGSIZE) / (TYPELNG));                                                                         \
32     residual   = (SEGSIZE) - (SEGCOUNT) * (TYPELNG);                                                                   \
33     if (residual > ((TYPELNG) >> 1))                                                                                   \
34       (SEGCOUNT)++;                                                                                                    \
35   }
36
37 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 };
45
46 ompi_coll_tree_t* ompi_coll_tuned_topo_build_tree(int fanout, MPI_Comm com, int root);
47 ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bintree(MPI_Comm comm);
48
49 ompi_coll_tree_t* ompi_coll_tuned_topo_build_bmtree(MPI_Comm comm, int root);
50 ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int root);
51 ompi_coll_tree_t* ompi_coll_tuned_topo_build_chain(int fanout, MPI_Comm com, int root);
52
53 int ompi_coll_tuned_topo_destroy_tree(ompi_coll_tree_t** tree);
54
55 /* debugging stuff, will be removed later */
56 int ompi_coll_tuned_topo_dump_tree(ompi_coll_tree_t* tree, int rank);
57
58 #endif /* MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED */