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
21
namespace boost { namespace parallel {
22
template<typename BinaryOp>
25
BOOST_STATIC_CONSTANT(bool, value = false);
29
struct minimum : std::binary_function<T, T, T>
31
const T& operator()(const T& x, const T& y) const { return x < y? x : y; }
35
struct maximum : std::binary_function<T, T, T>
37
const T& operator()(const T& x, const T& y) const { return x < y? y : x; }
41
struct sum : std::binary_function<T, T, T>
43
const T operator()(const T& x, const T& y) const { return x + y; }
46
template<typename ProcessGroup, typename InputIterator,
47
typename OutputIterator, typename BinaryOperation>
49
reduce(ProcessGroup pg, typename ProcessGroup::process_id_type root,
50
InputIterator first, InputIterator last, OutputIterator out,
51
BinaryOperation bin_op);
53
template<typename ProcessGroup, typename T, typename BinaryOperation>
55
all_reduce(ProcessGroup pg, const T& value, BinaryOperation bin_op)
59
const_cast<T*>(&value), const_cast<T*>(&value+1),
64
template<typename ProcessGroup, typename T, typename BinaryOperation>
66
scan(ProcessGroup pg, const T& value, BinaryOperation bin_op)
70
const_cast<T*>(&value), const_cast<T*>(&value+1),
76
template<typename ProcessGroup, typename InputIterator, typename T>
78
all_gather(ProcessGroup pg, InputIterator first, InputIterator last,
80
} } // end namespace boost::parallel
82
#include <boost/graph/parallel/detail/inplace_all_to_all.hpp>
84
#endif // BOOST_PARALLEL_ALGORITHM_HPP