// Copyright 2004 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Douglas Gregor // Andrew Lumsdaine #ifndef BOOST_PARALLEL_ALGORITHM_HPP #define BOOST_PARALLEL_ALGORITHM_HPP #ifndef BOOST_GRAPH_USE_MPI #error "Parallel BGL files should not be included unless has been included" #endif #include #include // for BOOST_STATIC_CONSTANT #include #include namespace boost { namespace parallel { template struct is_commutative { BOOST_STATIC_CONSTANT(bool, value = false); }; template struct minimum : std::binary_function { const T& operator()(const T& x, const T& y) const { return x < y? x : y; } }; template struct maximum : std::binary_function { const T& operator()(const T& x, const T& y) const { return x < y? y : x; } }; template struct sum : std::binary_function { const T operator()(const T& x, const T& y) const { return x + y; } }; template OutputIterator reduce(ProcessGroup pg, typename ProcessGroup::process_id_type root, InputIterator first, InputIterator last, OutputIterator out, BinaryOperation bin_op); template inline T all_reduce(ProcessGroup pg, const T& value, BinaryOperation bin_op) { T result; all_reduce(pg, const_cast(&value), const_cast(&value+1), &result, bin_op); return result; } template inline T scan(ProcessGroup pg, const T& value, BinaryOperation bin_op) { T result; scan(pg, const_cast(&value), const_cast(&value+1), &result, bin_op); return result; } template void all_gather(ProcessGroup pg, InputIterator first, InputIterator last, std::vector& out); } } // end namespace boost::parallel #include #endif // BOOST_PARALLEL_ALGORITHM_HPP