annotate DEPENDENCIES/generic/include/boost/mpi/detail/computation_tree.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (C) 2005 Douglas Gregor.
Chris@16 2
Chris@16 3 // Use, modification and distribution is subject to the Boost Software
Chris@16 4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 5 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 // Compute parents, children, levels, etc. to effect a parallel
Chris@16 8 // computation tree.
Chris@16 9 #ifndef BOOST_MPI_COMPUTATION_TREE_HPP
Chris@16 10 #define BOOST_MPI_COMPUTATION_TREE_HPP
Chris@16 11
Chris@16 12 namespace boost { namespace mpi { namespace detail {
Chris@16 13
Chris@16 14 /**
Chris@16 15 * @brief Aids tree-based parallel collective algorithms.
Chris@16 16 *
Chris@16 17 * Objects of this type
Chris@16 18 */
Chris@16 19 class computation_tree
Chris@16 20 {
Chris@16 21 public:
Chris@16 22 computation_tree(int rank, int size, int root, int branching_factor = -1);
Chris@16 23
Chris@16 24 /// Returns the branching factor of the tree.
Chris@16 25 int branching_factor() const { return branching_factor_; }
Chris@16 26
Chris@16 27 /// Returns the level in the tree on which this process resides.
Chris@16 28 int level() const { return level_; }
Chris@16 29
Chris@16 30 /**
Chris@16 31 * Returns the index corresponding to the n^th level of the tree.
Chris@16 32 *
Chris@16 33 * @param n The level in the tree whose index will be returned.
Chris@16 34 */
Chris@16 35 int level_index(int n) const;
Chris@16 36
Chris@16 37 /**
Chris@16 38 * @brief Returns the parent of this process.
Chris@16 39 *
Chris@16 40 * @returns If this process is the root, returns itself. Otherwise,
Chris@16 41 * returns the process number that is the parent in the computation
Chris@16 42 * tree.
Chris@16 43 */
Chris@16 44 int parent() const;
Chris@16 45
Chris@16 46 /// Returns the index for the first child of this process.
Chris@16 47 int child_begin() const;
Chris@16 48
Chris@16 49 /**
Chris@16 50 * @brief The default branching factor within the computation tree.
Chris@16 51 *
Chris@16 52 * This is the default branching factor for the computation tree, to
Chris@16 53 * be used by any computation tree that does not fix the branching
Chris@16 54 * factor itself. The default is initialized to 3, but may be
Chris@16 55 * changed by the application so long as all processes have the same
Chris@16 56 * branching factor.
Chris@16 57 */
Chris@16 58 static int default_branching_factor;
Chris@16 59
Chris@16 60 protected:
Chris@16 61 /// The rank of this process in the computation tree.
Chris@16 62 int rank;
Chris@16 63
Chris@16 64 /// The number of processes participating in the computation tree.
Chris@16 65 int size;
Chris@16 66
Chris@16 67 /// The process number that is acting as the root in the computation
Chris@16 68 /// tree.
Chris@16 69 int root;
Chris@16 70
Chris@16 71 /**
Chris@16 72 * @brief The branching factor within the computation tree.
Chris@16 73 *
Chris@16 74 * This is the default number of children that each node in a
Chris@16 75 * computation tree will have. This value will be used for
Chris@16 76 * collective operations that use tree-based algorithms.
Chris@16 77 */
Chris@16 78 int branching_factor_;
Chris@16 79
Chris@16 80 /// The level in the tree at which this process resides.
Chris@16 81 int level_;
Chris@16 82 };
Chris@16 83
Chris@16 84 } } } // end namespace boost::mpi::detail
Chris@16 85
Chris@16 86 #endif // BOOST_MPI_COMPUTATION_TREE_HPP