1 // Copyright 2004 The Trustees of Indiana University.
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // Authors: Douglas Gregor
9 #ifndef BOOST_PARALLEL_ALGORITHM_HPP
10 #define BOOST_PARALLEL_ALGORITHM_HPP
12 #ifndef BOOST_GRAPH_USE_MPI
13 #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
16 #include <boost/optional.hpp>
17 #include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
20 namespace boost { namespace parallel {
21 template<typename BinaryOp>
24 BOOST_STATIC_CONSTANT(bool, value = false);
30 typedef T first_argument_type;
31 typedef T second_argument_type;
32 typedef T result_type;
33 const T& operator()(const T& x, const T& y) const { return x < y? x : y; }
39 typedef T first_argument_type;
40 typedef T second_argument_type;
41 typedef T result_type;
42 const T& operator()(const T& x, const T& y) const { return x < y? y : x; }
48 typedef T first_argument_type;
49 typedef T second_argument_type;
50 typedef T result_type;
51 const T operator()(const T& x, const T& y) const { return x + y; }
54 template<typename ProcessGroup, typename InputIterator,
55 typename OutputIterator, typename BinaryOperation>
57 reduce(ProcessGroup pg, typename ProcessGroup::process_id_type root,
58 InputIterator first, InputIterator last, OutputIterator out,
59 BinaryOperation bin_op);
61 template<typename ProcessGroup, typename T, typename BinaryOperation>
63 all_reduce(ProcessGroup pg, const T& value, BinaryOperation bin_op)
67 const_cast<T*>(&value), const_cast<T*>(&value+1),
72 template<typename ProcessGroup, typename T, typename BinaryOperation>
74 scan(ProcessGroup pg, const T& value, BinaryOperation bin_op)
78 const_cast<T*>(&value), const_cast<T*>(&value+1),
84 template<typename ProcessGroup, typename InputIterator, typename T>
86 all_gather(ProcessGroup pg, InputIterator first, InputIterator last,
88 } } // end namespace boost::parallel
90 #include <boost/graph/parallel/detail/inplace_all_to_all.hpp>
92 #endif // BOOST_PARALLEL_ALGORITHM_HPP