Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inclusive scan #1342

Merged
merged 13 commits into from Jan 6, 2015
4 changes: 4 additions & 0 deletions docs/CMakeLists.txt
Expand Up @@ -58,10 +58,12 @@ set(doxygen_dependencies
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/copy.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/count.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/equal.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/exclusive_scan.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/fill.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/find.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/for_each.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/generate.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/inclusive_scan.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/minmax.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/mismatch.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/move.hpp"
Expand All @@ -72,6 +74,8 @@ set(doxygen_dependencies
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/search.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/swap_ranges.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/transform.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/transform_exclusive_scan.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/transform_inclusive_scan.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/transform_reduce.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/uninitialized_copy.hpp"
"${hpx_SOURCE_DIR}/hpx/parallel/algorithms/uninitialized_fill.hpp"
Expand Down
14 changes: 13 additions & 1 deletion docs/hpx.idx
@@ -1,4 +1,4 @@
# Copyright (c) 2001-2014 Hartmut Kaiser
# Copyright (c) 2001-2015 Hartmut Kaiser
#
# Distributed under 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)
Expand Down Expand Up @@ -77,6 +77,9 @@ parallel::count_if "count_if" "hpx\.parallel\.v1\.count_if.*"
# hpx/parallel/algorithms/equal.hpp
parallel::equal "equal" "hpx\.parallel\.v1\.equal_id.*"

# hpx/parallel/algorithms/exclusive_scan.hpp
parallel::exclusive_scan "exclusive_scan" "hpx\.parallel\.v1\.exclusive_scan.*"

# hpx/parallel/algorithms/fill.hpp
parallel::fill "fill" "hpx\.parallel\.v1\.fill$"
parallel::fill_n "fill_n" "hpx\.parallel\.v1\.fill_n.*"
Expand All @@ -96,6 +99,9 @@ parallel::for_each_n "for_each_n" "hpx\.parallel\.v1\.for_each_
parallel::generate "generate" "hpx\.parallel\.v1\.generate$"
parallel::generate_n "generate_n" "hpx\.parallel\.v1\.generate_n.*"

# hpx/parallel/algorithms/inclusive_scan.hpp
parallel::inclusive_scan "inclusive_scan" "hpx\.parallel\.v1\.inclusive_scan.*"

# hpx/parallel/algorithms/minmax.hpp
parallel::max_element "max_element" "hpx\.parallel\.v1\.max_element.*"
parallel::min_element "min_element" "hpx\.parallel\.v1\.min_element.*"
Expand Down Expand Up @@ -140,6 +146,12 @@ parallel::task_canceled_exception "task_canceled_exception" "hpx\.parallel\.
# hpx/parallel/algorithms/transform.hpp
parallel::transform "transform" "hpx\.parallel\.v1\.transform.*"

# hpx/parallel/algorithms/transform_exclusive_scan.hpp
parallel::transform_exclusive_scan "transform_exclusive_scan" "hpx\.parallel\.v1\.transform_exclusive_scan.*"

# hpx/parallel/algorithms/transform_inclusive_scan.hpp
parallel::transform_inclusive_scan "transform_inclusive_scan" "hpx\.parallel\.v1\.transform_inclusive_scan.*"

# hpx/parallel/algorithms/transform_reduce.hpp
parallel::transform_reduce "transform_reduce" "hpx\.parallel\.v1\.transform_reduce.*"

Expand Down
1 change: 0 additions & 1 deletion hpx/include/parallel_algorithm.hpp
Expand Up @@ -6,7 +6,6 @@
#if !defined(HPX_ALGORITHM_MAY_27_2014_0905PM)
#define HPX_ALGORITHM_MAY_27_2014_0905PM

#include <hpx/hpx_fwd.hpp>
#include <hpx/parallel/algorithm.hpp>

#endif
Expand Down
1 change: 0 additions & 1 deletion hpx/include/parallel_numeric.hpp
Expand Up @@ -6,7 +6,6 @@
#if !defined(HPX_NUMERIC_JUN_02_2014_1153AM)
#define HPX_NUMERIC_JUN_02_2014_1153AM

#include <hpx/hpx_fwd.hpp>
#include <hpx/parallel/numeric.hpp>

#endif
Expand Down
13 changes: 13 additions & 0 deletions hpx/include/parallel_scan.hpp
@@ -0,0 +1,13 @@
// Copyright (c) 2007-2015 Hartmut Kaiser
//
// Distributed under 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)

#if !defined(HPX_PARALLEL_SCAN_DEC_30_2014_1257PM)
#define HPX_PARALLEL_SCAN_DEC_30_2014_1257PM

#include <hpx/parallel/algorithms/exclusive_scan.hpp>
#include <hpx/parallel/algorithms/inclusive_scan.hpp>

#endif

13 changes: 13 additions & 0 deletions hpx/include/parallel_transform_scan.hpp
@@ -0,0 +1,13 @@
// Copyright (c) 2007-2015 Hartmut Kaiser
//
// Distributed under 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)

#if !defined(HPX_PARALLEL_TRANSFORM_SCAN_JAN_04_2014_0413PM)
#define HPX_PARALLEL_TRANSFORM_SCAN_JAN_04_2014_0413PM

#include <hpx/parallel/algorithms/transform_exclusive_scan.hpp>
#include <hpx/parallel/algorithms/transform_inclusive_scan.hpp>

#endif

2 changes: 1 addition & 1 deletion hpx/parallel/algorithm.hpp
Expand Up @@ -9,7 +9,7 @@

#include <hpx/hpx_fwd.hpp>

/// See N4071: 1.3/3
/// See N4310: 1.3/3
#include <algorithm>

#include <hpx/parallel/algorithms/adjacent_find.hpp>
Expand Down
9 changes: 4 additions & 5 deletions hpx/parallel/algorithms/adjacent_find.hpp
Expand Up @@ -158,9 +158,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
typedef is_sequential_execution_policy<ExPolicy> is_seq;

return detail::adjacent_find<FwdIter>().call(
std::forward<ExPolicy>(policy),
first, last, detail::equal_to(),
is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, detail::equal_to());
}

/// Searches the range [first, last) for two consecutive identical elements.
Expand Down Expand Up @@ -244,8 +243,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
typedef is_sequential_execution_policy<ExPolicy> is_seq;

return detail::adjacent_find<FwdIter>().call(
std::forward<ExPolicy>(policy),
first, last, op, is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, op);
}
}}}

Expand Down
12 changes: 6 additions & 6 deletions hpx/parallel/algorithms/all_any_none.hpp
Expand Up @@ -161,8 +161,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
>::type is_seq;

return detail::none_of().call(
std::forward<ExPolicy>(policy),
first, last, std::forward<F>(f), is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, std::forward<F>(f));
}

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -297,8 +297,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
>::type is_seq;

return detail::any_of().call(
std::forward<ExPolicy>(policy),
first, last, std::forward<F>(f), is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, std::forward<F>(f));
}

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -433,8 +433,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
>::type is_seq;

return detail::all_of().call(
std::forward<ExPolicy>(policy),
first, last, std::forward<F>(f), is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, std::forward<F>(f));
}
}}}

Expand Down
24 changes: 12 additions & 12 deletions hpx/parallel/algorithms/copy.hpp
Expand Up @@ -58,13 +58,13 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
result_type;

return get_iter<1, result_type>(
for_each_n<zip_iterator>().call(policy,
for_each_n<zip_iterator>().call(
policy, boost::mpl::false_(),
hpx::util::make_zip_iterator(first, dest),
std::distance(first, last),
[](reference t) {
hpx::util::get<1>(t) = hpx::util::get<0>(t); //-V573
},
boost::mpl::false_()));
}));
}
};
/// \endcond
Expand Down Expand Up @@ -147,8 +147,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
>::type is_seq;

return detail::copy<OutIter>().call(
std::forward<ExPolicy>(policy),
first, last, dest, is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, dest);
}

/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -183,13 +183,13 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
result_type;

return get_iter<1, result_type>(
for_each_n<zip_iterator>().call(policy,
for_each_n<zip_iterator>().call(
policy, boost::mpl::false_(),
hpx::util::make_zip_iterator(first, dest),
count,
[](reference t) {
hpx::util::get<1>(t) = hpx::util::get<0>(t); //-V573
},
boost::mpl::false_()));
}));
}
};
/// \endcond
Expand Down Expand Up @@ -283,8 +283,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
>::type is_seq;

return detail::copy_n<OutIter>().call(
std::forward<ExPolicy>(policy),
first, std::size_t(count), dest, is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, std::size_t(count), dest);
}

/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -530,8 +530,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
>::type is_seq;

return detail::copy_if<OutIter>().call(
std::forward<ExPolicy>(policy),
first, last, dest, std::forward<F>(f), is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, dest, std::forward<F>(f));
}
}}}

Expand Down
6 changes: 3 additions & 3 deletions hpx/parallel/algorithms/count.hpp
Expand Up @@ -100,7 +100,7 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
difference_type;

return detail::count<difference_type>().call(
std::forward<ExPolicy>(policy), first, last, value, is_seq());
std::forward<ExPolicy>(policy), is_seq(), first, last, value);
}

// forward declare the segmented version of this algorithm
Expand Down Expand Up @@ -252,8 +252,8 @@ namespace hpx { namespace parallel { HPX_INLINE_NAMESPACE(v1)
difference_type;

return detail::count_if<difference_type>().call(
std::forward<ExPolicy>(policy),
first, last, std::forward<F>(f), is_seq());
std::forward<ExPolicy>(policy), is_seq(),
first, last, std::forward<F>(f));
}

// forward declare the segmented version of this algorithm
Expand Down