Skip to content

Commit

Permalink
Merge pull request #1922 from STEllAR-GROUP/container_algorithms
Browse files Browse the repository at this point in the history
Container algorithms
  • Loading branch information
hkaiser committed Dec 27, 2015
2 parents b8f42c8 + e189be8 commit fa421b5
Show file tree
Hide file tree
Showing 62 changed files with 5,901 additions and 492 deletions.
4 changes: 4 additions & 0 deletions docs/CMakeLists.txt
Expand Up @@ -98,6 +98,10 @@ set(doxygen_dependencies
"${PROJECT_SOURCE_DIR}/hpx/parallel/algorithms/uninitialized_fill.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/copy.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/for_each.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/remove_copy.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/replace.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/reverse.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/rotate.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/sort.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/container_algorithms/transform.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/executors/auto_chunk_size.hpp"
Expand Down
1 change: 1 addition & 0 deletions docs/hpx.qbk
Expand Up @@ -141,6 +141,7 @@
[def __cpp11_n4107__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4313.html N4313]]
[def __cpp11_n4406__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4406.pdf N4406]]
[def __cpp17_n4399__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4399.html N4399]]
[def __cpp17_n4560__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4560.pdf N4560]]


[def __ini_file_format__ [@http://en.wikipedia.org/wiki/INI_file Windows INI file format]]
Expand Down
10 changes: 8 additions & 2 deletions docs/manual/build_system/cmake_variables.qbk
Expand Up @@ -28,18 +28,21 @@ The options are split into these categories:
[#build_system.cmake_variables.Generic][h3 Generic Options]
* [link build_system.cmake_variables.HPX_WITH_AUTOMATIC_SERIALIZATION_REGISTRATION HPX_WITH_AUTOMATIC_SERIALIZATION_REGISTRATION]
* [link build_system.cmake_variables.HPX_WITH_BENCHMARK_SCRIPTS_PATH HPX_WITH_BENCHMARK_SCRIPTS_PATH]
* [link build_system.cmake_variables.HPX_WITH_BOOST_ALL_DYNAMIC_LINK HPX_WITH_BOOST_ALL_DYNAMIC_LINK]
* [link build_system.cmake_variables.HPX_WITH_COLOCATED_BACKWARDS_COMPATIBILITY HPX_WITH_COLOCATED_BACKWARDS_COMPATIBILITY]
* [link build_system.cmake_variables.HPX_WITH_COMPILER_WARNINGS HPX_WITH_COMPILER_WARNINGS]
* [link build_system.cmake_variables.HPX_WITH_COMPONENT_GET_GID_COMPATIBILITY HPX_WITH_COMPONENT_GET_GID_COMPATIBILITY]
* [link build_system.cmake_variables.HPX_WITH_COMPRESSION_BZIP2 HPX_WITH_COMPRESSION_BZIP2]
* [link build_system.cmake_variables.HPX_WITH_COMPRESSION_SNAPPY HPX_WITH_COMPRESSION_SNAPPY]
* [link build_system.cmake_variables.HPX_WITH_COMPRESSION_ZLIB HPX_WITH_COMPRESSION_ZLIB]
* [link build_system.cmake_variables.HPX_WITH_FORTRAN HPX_WITH_FORTRAN]
* [link build_system.cmake_variables.HPX_WITH_FPGA_QUEUES HPX_WITH_FPGA_QUEUES]
* [link build_system.cmake_variables.HPX_WITH_FULL_RPATH HPX_WITH_FULL_RPATH]
* [link build_system.cmake_variables.HPX_WITH_GCC_VERSION_CHECK HPX_WITH_GCC_VERSION_CHECK]
* [link build_system.cmake_variables.HPX_WITH_GENERIC_CONTEXT_COROUTINES HPX_WITH_GENERIC_CONTEXT_COROUTINES]
* [link build_system.cmake_variables.HPX_WITH_HIDDEN_VISIBILITY HPX_WITH_HIDDEN_VISIBILITY]
* [link build_system.cmake_variables.HPX_WITH_HWLOC HPX_WITH_HWLOC]
* [link build_system.cmake_variables.HPX_WITH_LOCAL_DATAFLOW_COMPATIBILITY HPX_WITH_LOCAL_DATAFLOW_COMPATIBILITY]
* [link build_system.cmake_variables.HPX_WITH_LOGGING HPX_WITH_LOGGING]
* [link build_system.cmake_variables.HPX_WITH_MALLOC HPX_WITH_MALLOC]
* [link build_system.cmake_variables.HPX_WITH_NATIVE_TLS HPX_WITH_NATIVE_TLS]
Expand All @@ -50,18 +53,21 @@ The options are split into these categories:
[variablelist
[[[#build_system.cmake_variables.HPX_WITH_AUTOMATIC_SERIALIZATION_REGISTRATION] `HPX_WITH_AUTOMATIC_SERIALIZATION_REGISTRATION:BOOL`][Use automatic serialization registration for actions and functions. This affects compatibility between HPX applications compiled with different compilers (default ON)]]
[[[#build_system.cmake_variables.HPX_WITH_BENCHMARK_SCRIPTS_PATH] `HPX_WITH_BENCHMARK_SCRIPTS_PATH:PATH`][Directory to place batch scripts in]]
[[[#build_system.cmake_variables.HPX_WITH_BOOST_ALL_DYNAMIC_LINK] `HPX_WITH_BOOST_ALL_DYNAMIC_LINK:BOOL`][Add BOOST_ALL_DYN_LINK to compile flags]]
[[[#build_system.cmake_variables.HPX_WITH_COLOCATED_BACKWARDS_COMPATIBILITY] `HPX_WITH_COLOCATED_BACKWARDS_COMPATIBILITY:BOOL`][Enable backwards compatibility for apply_colocated, async_colocated and friends]]
[[[#build_system.cmake_variables.HPX_WITH_COMPILER_WARNINGS] `HPX_WITH_COMPILER_WARNINGS:BOOL`][Enable compiler warnings (default: ON)]]
[[[#build_system.cmake_variables.HPX_WITH_COMPONENT_GET_GID_COMPATIBILITY] `HPX_WITH_COMPONENT_GET_GID_COMPATIBILITY:BOOL`][Enable backwards compatibility for component::get_gid() functions]]
[[[#build_system.cmake_variables.HPX_WITH_COMPRESSION_BZIP2] `HPX_WITH_COMPRESSION_BZIP2:BOOL`][Enable bzip2 compression for parcel data (default: OFF).]]
[[[#build_system.cmake_variables.HPX_WITH_COMPRESSION_SNAPPY] `HPX_WITH_COMPRESSION_SNAPPY:BOOL`][Enable snappy compression for parcel data (default: OFF).]]
[[[#build_system.cmake_variables.HPX_WITH_COMPRESSION_ZLIB] `HPX_WITH_COMPRESSION_ZLIB:BOOL`][Enable zlib compression for parcel data (default: OFF).]]
[[[#build_system.cmake_variables.HPX_WITH_FORTRAN] `HPX_WITH_FORTRAN:BOOL`][Enable or disable the compilation of Fortran examples using HPX]]
[[[#build_system.cmake_variables.HPX_WITH_FPGA_QUEUES] `HPX_WITH_FPGA_QUEUES:BOOL`][Enable special FPGA based queues and schedulers (default: OFF)]]
[[[#build_system.cmake_variables.HPX_WITH_FULL_RPATH] `HPX_WITH_FULL_RPATH:BOOL`][Build and link HPX libraries and executables with full RPATHs (default: ON)]]
[[[#build_system.cmake_variables.HPX_WITH_GCC_VERSION_CHECK] `HPX_WITH_GCC_VERSION_CHECK:BOOL`][Don't ignore version reported by gcc (default: ON)]]
[[[#build_system.cmake_variables.HPX_WITH_GENERIC_CONTEXT_COROUTINES] `HPX_WITH_GENERIC_CONTEXT_COROUTINES:BOOL`][Use Boost.Context as the underlying coroutines context switch implementation.]]
[[[#build_system.cmake_variables.HPX_WITH_HIDDEN_VISIBILITY] `HPX_WITH_HIDDEN_VISIBILITY:BOOL`][Use -fvisibility=hidden for builds on platforms which support it (default ON)]]
[[[#build_system.cmake_variables.HPX_WITH_HWLOC] `HPX_WITH_HWLOC:BOOL`][Use Hwloc for hardware topolgy information and thread pinning. If disabled, performance might be reduced.]]
[[[#build_system.cmake_variables.HPX_WITH_LOCAL_DATAFLOW_COMPATIBILITY] `HPX_WITH_LOCAL_DATAFLOW_COMPATIBILITY:BOOL`][Enable backwards compatibility for hpx::lcos::local::dataflow() functions]]
[[[#build_system.cmake_variables.HPX_WITH_LOGGING] `HPX_WITH_LOGGING:BOOL`][Build HPX with logging enabled (default: ON).]]
[[[#build_system.cmake_variables.HPX_WITH_MALLOC] `HPX_WITH_MALLOC:STRING`][Define which allocator should be linked in. Options are: system, tcmalloc, jemalloc, tbbmalloc, and custom (default is: tcmalloc)]]
[[[#build_system.cmake_variables.HPX_WITH_NATIVE_TLS] `HPX_WITH_NATIVE_TLS:BOOL`][Use native TLS support if available (default: ON)]]
Expand Down Expand Up @@ -93,8 +99,8 @@ The options are split into these categories:
[[[#build_system.cmake_variables.HPX_WITH_DOCUMENTATION] `HPX_WITH_DOCUMENTATION:BOOL`][Build the HPX documentation (default OFF).]]
[[[#build_system.cmake_variables.HPX_WITH_DOCUMENTATION_SINGLEPAGE] `HPX_WITH_DOCUMENTATION_SINGLEPAGE:BOOL`][The HPX documentation should be build as a single page HTML (default OFF).]]
[[[#build_system.cmake_variables.HPX_WITH_EXAMPLES] `HPX_WITH_EXAMPLES:BOOL`][Build the HPX examples (default ON)]]
[[[#build_system.cmake_variables.HPX_WITH_IO_COUNTERS] `HPX_WITH_IO_COUNTERS:BOOL`][Build HPX runtime (default: ON)]]
[[[#build_system.cmake_variables.HPX_WITH_PSEUDO_DEPENDENCIES] `HPX_WITH_PSEUDO_DEPENDENCIES:BOOL`][Force creating pseudo targets and pseudo dependencies (default ON).]]
[[[#build_system.cmake_variables.HPX_WITH_IO_COUNTERS] `HPX_WITH_IO_COUNTERS:BOOL`][Build HPX runtime (default: OFF)]]
[[[#build_system.cmake_variables.HPX_WITH_PSEUDO_DEPENDENCIES] `HPX_WITH_PSEUDO_DEPENDENCIES:BOOL`][Force creating pseudo targets and pseudo dependencies (default OFF).]]
[[[#build_system.cmake_variables.HPX_WITH_RUNTIME] `HPX_WITH_RUNTIME:BOOL`][Build HPX runtime (default: ON)]]
[[[#build_system.cmake_variables.HPX_WITH_TESTS] `HPX_WITH_TESTS:BOOL`][Build the HPX tests (default ON)]]
[[[#build_system.cmake_variables.HPX_WITH_TESTS_BENCHMARKS] `HPX_WITH_TESTS_BENCHMARKS:BOOL`][Build HPX benchmark tests (default: ON)]]
Expand Down
15 changes: 13 additions & 2 deletions docs/whats_new.qbk
Expand Up @@ -11,6 +11,11 @@

[heading General Changes]

- We have started to add parallel algorithm overloads based on the C++
Extensions for Ranges (__cpp17_n4560__) proposal. This also includes the
addition of projections to the existing algorithms. Please see [issue 1668]
for a list of algorithms which have been adapted to __cpp17_n4560__.

[heading Breaking Changes]

- In order to move the dataflow facility to `namespace hpx` we added a
Expand All @@ -20,15 +25,21 @@
`HPX_WITH_LOCAL_DATAFLOW_COMPATIBILITY` is defined at configuration time.
Please explicitly qualify all uses of the dataflow facility if you enable
this compatibility setting and encounter ambiguities.

- The adaptation of the C++ Extensions for Ranges (__cpp17_n4560__) proposal
imposes some breaking changes related to the return types of some of the
parallel algorithms. Here is the list of algorithms we have changed so far:
`parallel::for_each`, `parallel::copy`, `parallel::rotate`,
`parallel::reverse` and `parallel::reverse_copy`, `parallel::remove` and
`parallel::remove_copy`.

[heading Bug Fixes (Closed Tickets)]

Here is a list of the important tickets we closed for this release.

* [pr 1910] - Keep cmake_module_path
* [pr 1909] - Fix mpirun with pbs
* [pr 1908] - Changing parallel::sort to return the last iterator as proposed by N4560
* [pr 1908] - Changing parallel::sort to return the last iterator as proposed by
N4560
* [pr 1907] - Adding minimum version for Open MPI

[endsect]
Expand Down
1 change: 1 addition & 0 deletions hpx/include/parallel_remove_copy.hpp
Expand Up @@ -7,5 +7,6 @@
#define HPX_PARALLEL_REMOVE_COPY_FEB_25_2015_2131PM

#include <hpx/parallel/algorithms/remove_copy.hpp>
#include <hpx/parallel/container_algorithms/remove_copy.hpp>

#endif
1 change: 1 addition & 0 deletions hpx/include/parallel_replace.hpp
Expand Up @@ -8,6 +8,7 @@
#define HPX_PARALLEL_REPLACE_AUG_18_2014_0148PM

#include <hpx/parallel/algorithms/replace.hpp>
#include <hpx/parallel/container_algorithms/replace.hpp>

#endif

3 changes: 2 additions & 1 deletion hpx/include/parallel_reverse.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2014 Hartmut Kaiser
// Copyright (c) 2007-2015 Hartmut Kaiser
// Copyright (c) 2014 Grant Mercer
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -8,5 +8,6 @@
#define HPX_PARALLEL_REVERSE_COPY_JUL_29_2014_0348PM

#include <hpx/parallel/algorithms/reverse.hpp>
#include <hpx/parallel/container_algorithms/reverse.hpp>

#endif
3 changes: 2 additions & 1 deletion hpx/include/parallel_rotate.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2014 Hartmut Kaiser
// 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)
Expand All @@ -7,6 +7,7 @@
#define HPX_PARALLEL_ROTATE_AUG_05_2014_0136PM

#include <hpx/parallel/algorithms/rotate.hpp>
#include <hpx/parallel/container_algorithms/rotate.hpp>

#endif

41 changes: 40 additions & 1 deletion hpx/lcos/future.hpp
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2013 Hartmut Kaiser
// Copyright (c) 2007-2015 Hartmut Kaiser
// Copyright (c) 2013 Agustin Berge
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -11,16 +11,19 @@
#include <hpx/lcos_fwd.hpp>
#include <hpx/config/forceinline.hpp>
#include <hpx/traits/acquire_shared_state.hpp>
#include <hpx/traits/is_callable.hpp>
#include <hpx/traits/is_future.hpp>
#include <hpx/traits/future_access.hpp>
#include <hpx/traits/future_traits.hpp>
#include <hpx/traits/is_launch_policy.hpp>
#include <hpx/traits/is_executor.hpp>
#include <hpx/traits/concepts.hpp>
#include <hpx/lcos/detail/future_data.hpp>
#include <hpx/util/always_void.hpp>
#include <hpx/util/bind.hpp>
#include <hpx/util/date_time_chrono.hpp>
#include <hpx/util/decay.hpp>
#include <hpx/util/invoke.hpp>
#include <hpx/util/move.hpp>
#include <hpx/util/result_of.hpp>
#include <hpx/runtime/actions/continuation.hpp>
Expand All @@ -30,6 +33,7 @@
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_void.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/declval.hpp>
#include <boost/utility/enable_if.hpp>

Expand Down Expand Up @@ -1116,6 +1120,41 @@ namespace hpx { namespace lcos
{
return f;
}

// Allow to convert any future<U> into any other future<T> based on an
// existing conversion path U --> T.
template <typename T, typename U,
HPX_CONCEPT_REQUIRES_(
boost::is_convertible<U, T>::value)>
hpx::future<T> make_future(hpx::future<U> && f)
{
return f.then(
[](hpx::future<U> && f) -> T
{
return f.get();
});
}

template <typename T>
hpx::future<T> make_future(hpx::future<T> && f)
{
return f;
}

// Allow to convert any future<U> into any other future<T> based on a given
// conversion function: T f(U).
template <typename R, typename U, typename Conv,
HPX_CONCEPT_REQUIRES_(
hpx::traits::is_callable<Conv(U)>::value)>
hpx::future<R>
make_future(hpx::future<U> && f, Conv && conv)
{
return f.then(
[conv](hpx::future<U> && f) -> R
{
return hpx::util::invoke(conv, f.get());
});
}
}}

HPX_REGISTER_TYPED_CONTINUATION_DECLARATION(
Expand Down

0 comments on commit fa421b5

Please sign in to comment.