1 /* Copyright (c) 2013-2023. The SimGrid Team. All rights reserved. */
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. */
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
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.
18 * Additional copyrights may follow
21 #ifndef MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED
22 #define MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED
24 #include "colls_private.hpp"
26 #define MAXTREEFANOUT 32
28 #define COLL_TUNED_COMPUTED_SEGCOUNT(SEGSIZE, TYPELNG, SEGCOUNT) \
29 if (((SEGSIZE) >= (TYPELNG)) && ((SEGSIZE) < ((TYPELNG) * (SEGCOUNT)))) { \
31 (SEGCOUNT) = (int)((SEGSIZE) / (TYPELNG)); \
32 residual = (SEGSIZE) - (SEGCOUNT) * (TYPELNG); \
33 if (residual > ((TYPELNG) >> 1)) \
37 struct ompi_coll_tree_t {
42 int32_t tree_next[MAXTREEFANOUT];
43 int32_t tree_nextsize;
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);
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);
53 int ompi_coll_tuned_topo_destroy_tree(ompi_coll_tree_t** tree);
55 /* debugging stuff, will be removed later */
56 int ompi_coll_tuned_topo_dump_tree(ompi_coll_tree_t* tree, int rank);
58 #endif /* MCA_COLL_TUNED_TOPO_H_HAS_BEEN_INCLUDED */