annotate DEPENDENCIES/generic/include/boost/graph/parallel/algorithm.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 2004 The Trustees of Indiana University.
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 // Authors: Douglas Gregor
Chris@16 8 // Andrew Lumsdaine
Chris@16 9 #ifndef BOOST_PARALLEL_ALGORITHM_HPP
Chris@16 10 #define BOOST_PARALLEL_ALGORITHM_HPP
Chris@16 11
Chris@16 12 #ifndef BOOST_GRAPH_USE_MPI
Chris@16 13 #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
Chris@16 14 #endif
Chris@16 15
Chris@16 16 #include <boost/optional.hpp>
Chris@16 17 #include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
Chris@16 18 #include <vector>
Chris@16 19 #include <functional>
Chris@16 20
Chris@16 21 namespace boost { namespace parallel {
Chris@16 22 template<typename BinaryOp>
Chris@16 23 struct is_commutative
Chris@16 24 {
Chris@16 25 BOOST_STATIC_CONSTANT(bool, value = false);
Chris@16 26 };
Chris@16 27
Chris@16 28 template<typename T>
Chris@16 29 struct minimum : std::binary_function<T, T, T>
Chris@16 30 {
Chris@16 31 const T& operator()(const T& x, const T& y) const { return x < y? x : y; }
Chris@16 32 };
Chris@16 33
Chris@16 34 template<typename T>
Chris@16 35 struct maximum : std::binary_function<T, T, T>
Chris@16 36 {
Chris@16 37 const T& operator()(const T& x, const T& y) const { return x < y? y : x; }
Chris@16 38 };
Chris@16 39
Chris@16 40 template<typename T>
Chris@16 41 struct sum : std::binary_function<T, T, T>
Chris@16 42 {
Chris@16 43 const T operator()(const T& x, const T& y) const { return x + y; }
Chris@16 44 };
Chris@16 45
Chris@16 46 template<typename ProcessGroup, typename InputIterator,
Chris@16 47 typename OutputIterator, typename BinaryOperation>
Chris@16 48 OutputIterator
Chris@16 49 reduce(ProcessGroup pg, typename ProcessGroup::process_id_type root,
Chris@16 50 InputIterator first, InputIterator last, OutputIterator out,
Chris@16 51 BinaryOperation bin_op);
Chris@16 52
Chris@16 53 template<typename ProcessGroup, typename T, typename BinaryOperation>
Chris@16 54 inline T
Chris@16 55 all_reduce(ProcessGroup pg, const T& value, BinaryOperation bin_op)
Chris@16 56 {
Chris@16 57 T result;
Chris@16 58 all_reduce(pg,
Chris@16 59 const_cast<T*>(&value), const_cast<T*>(&value+1),
Chris@16 60 &result, bin_op);
Chris@16 61 return result;
Chris@16 62 }
Chris@16 63
Chris@16 64 template<typename ProcessGroup, typename T, typename BinaryOperation>
Chris@16 65 inline T
Chris@16 66 scan(ProcessGroup pg, const T& value, BinaryOperation bin_op)
Chris@16 67 {
Chris@16 68 T result;
Chris@16 69 scan(pg,
Chris@16 70 const_cast<T*>(&value), const_cast<T*>(&value+1),
Chris@16 71 &result, bin_op);
Chris@16 72 return result;
Chris@16 73 }
Chris@16 74
Chris@16 75
Chris@16 76 template<typename ProcessGroup, typename InputIterator, typename T>
Chris@16 77 void
Chris@16 78 all_gather(ProcessGroup pg, InputIterator first, InputIterator last,
Chris@16 79 std::vector<T>& out);
Chris@16 80 } } // end namespace boost::parallel
Chris@16 81
Chris@16 82 #include <boost/graph/parallel/detail/inplace_all_to_all.hpp>
Chris@16 83
Chris@16 84 #endif // BOOST_PARALLEL_ALGORITHM_HPP