Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
msimberg committed Oct 18, 2018
2 parents 186005a + d4a820b commit 38ecfb0
Show file tree
Hide file tree
Showing 91 changed files with 155 additions and 8,724 deletions.
40 changes: 5 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,12 @@ if(HPX_WITH_CUDA)
string(APPEND HPX_CUDA_CLANG_FLAGS " --cuda-gpu-arch=${arch}")
endforeach()
string(REGEX REPLACE ";" " " HPX_WITH_CUDA_ARCH_INFO "${HPX_WITH_CUDA_ARCH}")
else()
set(HPX_TLL_PUBLIC "PUBLIC") # keywords for target_link_libraries
set(HPX_TLL_PRIVATE "PRIVATE")
# keywords for target_link_libraries (cuda)
set(CUDA_LINK_LIBRARIES_KEYWORD "PRIVATE")
endif()
# keywords for target_link_libraries (hpx)
set(HPX_TLL_PUBLIC "PUBLIC")
set(HPX_TLL_PRIVATE "PRIVATE")
if(HPX_WITH_CUDA_CLANG AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
hpx_error("To use Cuda Clang, please select Clang as your default C++ compiler")
endif()
Expand Down Expand Up @@ -956,38 +958,6 @@ if(HPX_WITH_TUPLE_RVALUE_SWAP)
hpx_add_config_define(HPX_HAVE_TUPLE_RVALUE_SWAP)
endif()

# HPX_WITH_BOOST_CHRONO_COMPATIBILITY: introduced in V1.0.0
hpx_option(HPX_WITH_BOOST_CHRONO_COMPATIBILITY BOOL
"Enable support for boost::chrono (default: OFF)"
OFF ADVANCED)
if(HPX_WITH_BOOST_CHRONO_COMPATIBILITY)
hpx_add_config_define(HPX_HAVE_BOOST_CHRONO_COMPATIBILITY)
endif()

# HPX_WITH_EXECUTOR_COMPATIBILITY: introduced in V1.0.0
hpx_option(HPX_WITH_EXECUTOR_COMPATIBILITY BOOL
"Enable old (pre-concurrency TS) executor API (default: OFF)"
OFF ADVANCED)
if(HPX_WITH_EXECUTOR_COMPATIBILITY)
hpx_add_config_define(HPX_HAVE_EXECUTOR_COMPATIBILITY)
endif()

# HPX_WITH_EXECUTION_POLICY_COMPATIBILITY: introduced in V1.0.0
hpx_option(HPX_WITH_EXECUTION_POLICY_COMPATIBILITY BOOL
"Enable old execution policy names in API (default: OFF)"
OFF ADVANCED)
if(HPX_WITH_EXECUTION_POLICY_COMPATIBILITY)
hpx_add_config_define(HPX_HAVE_EXECUTION_POLICY_COMPATIBILITY)
endif()

# HPX_WITH_TRANSFORM_REDUCE_COMPATIBILITY: introduced in V1.0.0
hpx_option(HPX_WITH_TRANSFORM_REDUCE_COMPATIBILITY BOOL
"Enable old overloads for transform_reduce and inner_product (default: OFF)"
OFF ADVANCED)
if(HPX_WITH_TRANSFORM_REDUCE_COMPATIBILITY)
hpx_add_config_define(HPX_HAVE_TRANSFORM_REDUCE_COMPATIBILITY)
endif()

# HPX_WITH_INCLUSIVE_SCAN_COMPATIBILITY: introduced in V1.1.0
hpx_option(HPX_WITH_INCLUSIVE_SCAN_COMPATIBILITY BOOL
"Enable old overloads for inclusive_scan (default: ON)"
Expand Down
2 changes: 1 addition & 1 deletion cmake/HPX_SetupBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(HPX_WITH_THREAD_COMPATIBILITY OR NOT(HPX_WITH_CXX11_THREAD))
set(__boost_need_thread ON)
endif()

if(HPX_WITH_BOOST_CHRONO_COMPATIBILITY OR __boost_need_thread)
if(__boost_need_thread)
set(__boost_libraries ${__boost_libraries} chrono)
endif()

Expand Down
1 change: 0 additions & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ set(doxygen_dependencies
"${PROJECT_SOURCE_DIR}/hpx/parallel/executors/service_executors.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/executors/static_chunk_size.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/executors/thread_pool_executors.hpp"
"${PROJECT_SOURCE_DIR}/hpx/parallel/executors/v1/timed_executor_traits.hpp"
"${PROJECT_SOURCE_DIR}/hpx/performance_counters/manage_counter_type.hpp"
"${PROJECT_SOURCE_DIR}/hpx/runtime_fwd.hpp"
"${PROJECT_SOURCE_DIR}/hpx/runtime/applier_fwd.hpp"
Expand Down
113 changes: 4 additions & 109 deletions docs/sphinx/manual/writing_single_node_hpx_applications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -790,120 +790,15 @@ Parallel algorithms
* Implements loop functionality over a range specified by integral or iterator bounds.
* ``<hpx/include/parallel_for_loop.hpp>``

.. _executors:

Executors and executor traits
=============================

The existing Version 1 of the Parallelism TS (|cpp11_n4104|_) exposes parallel
execution to the programmer in the form of standard algorithms that accept
execution policies. A companion executor facility both provides a suitable
substrate for implementing these algorithms in a standard way and provide a
mechanism for exercising programmatic control over where parallel work should be
executed.

The algorithms and execution policies specified by the Parallelism TS are
designed to permit implementation on the broadest range of platforms. In
addition to preemptive thread pools common on some platforms, implementations of
these algorithms may want to take advantage of a number of mechanisms for
parallel execution, including cooperative fibers, GPU threads, and SIMD vector
units, among others. This diversity of possible execution resources strongly
suggests that a suitable abstraction encapsulating the details of how work is
created across diverse platforms would be of significant value to parallel
algorithm implementations. Suitably defined executors provide just such a
facility.

An executor is an object responsible for creating execution agents on which work
is performed, thus abstracting the (potentially platform-specific) mechanisms
for launching work. To accommodate the goals of the Parallelism TS, whose
algorithms aim to support the broadest range of possible platforms, the
requirements that all executors are expected to fulfill are small. They are also
consistent with a broad range of execution semantics, including preemptive
threads, cooperative fibers, GPU threads, and SIMD vector units, among others.

The executors implemented by |hpx| are aligned with the interfaces proposed by
|cpp11_n4406|_ (Parallel Algorithms Need Executors).

Executors are modular components for requisitioning execution agents. During
parallel algorithm execution, execution policies generate execution agents by
requesting their creation from an associated executor. Rather than focusing on
asynchronous task queuing, our complementary treatment of executors casts them
as modular components for invoking functions over the points of an index space.
We believe that executors may be conceived of as allocators for execution agents
and our interface's design reflects this analogy. The process of requesting
agents from an executor is mediated via the
:cpp:class:`hpx::parallel::executor_traits` API, which is analogous to the
interaction between containers and allocator_traits.

With ``executor_traits`` clients manipulate all types of executors uniformly::

executor_traits<my_executor_t>::execute(my_executor,
[](size_t i){ // perform task i },
range(0, n));

This call synchronously creates a group of invocations of the given function,
where each individual invocation within the group is identified by a unique
integer ``i`` in ``[0, n)`` Other functions in the interface exist to create
groups of invocations asynchronously and support the special case of creating a
singleton group, resulting in four different combinations.

Though this interface appears to require executor authors to implement four
different basic operations, there is really only one requirement:
``async_execute()``. In practice, the other operations may be defined in terms
of this single basic primitive. However, some executors will naturally
specialize all four operations for maximum efficiency.

For maximum implementation flexibility, ``executor_traits`` does not require
executors to implement a particular exception reporting mechanism. Executors may
choose whether or not to report exceptions, and if so, in what manner they are
communicated back to the caller. However, all executors in |hpx| report
exceptions in a manner consistent with the behavior of execution policies
described by the Parallelism TS, where multiple exceptions are collected into an
__exception_list__. This list is reported through ``async_execute()`` s returned
future, or thrown directly by ``execute()``.

.. note::

Please note that the executor interface as described above has now been
deprecated. It has been replaced by separate executor customization points,
one for each of the exposed functions. Please see __cpp20_p0443__ for more
details. The old interface based on ``executor_traits`` will be supported for
some time, you might have to enable the ``HPX_WITH_EXECUTOR_COMPATIBILITY``
configuration setting, however.

In |hpx| we have implemented the following executor types:

* :cpp:class:`hpx::parallel::execution::sequenced_executor`: creates groups of
sequential execution agents which execute in the calling thread. The
sequential order is given by the lexicographical order of indices in the index
space.
* :cpp:class:`hpx::parallel::execution::parallel_executor`: creates groups of
parallel execution agents which execute in threads implicitly created by the
executor. This executor uses a given launch policy.
* :cpp:class:`hpx::parallel::execution::service_executor`: creates groups of
parallel execution agents which execute in one of the kernel threads
associated with a given pool category (I/O, :term:`parcel`, or timer pool, or
on the main thread of the application).
* :cpp:class:`hpx::parallel::execution::local_priority_queue_executor`,
:cpp:class:`hpx::parallel::execution::local_queue_executor`,
:cpp:class:`hpx::parallel::execution::static_priority_queue_executor` create
executors on top of the corresponding |hpx| schedulers.
* :cpp:class:`hpx::parallel::execution::distribution_policy_executor` creates
executors using any of the existing distribution policies (like
:cpp:class:`hpx::components::colocating_distribution_policy` et.al.).

.. _executor_parameters:

Executor parameters and executor parameter traits
-------------------------------------------------

Executors as described in the previous section add a powerful customization
capability to any facility which exposes management of parallel execution.
However, sometimes it is necessary to be able to customize certain parameters of
the execution as well. In |hpx| we introduce the notion of execution parameters
and execution parameter traits. At this point, the only parameter which can be
customized is the size of the chunks of work executed on a single |hpx|-thread
(such as the number of loop iterations combined to run as a single task).
In |hpx| we introduce the notion of execution parameters and execution parameter
traits. At this point, the only parameter which can be customized is the size of
the chunks of work executed on a single |hpx|-thread (such as the number of loop
iterations combined to run as a single task).

An executor parameter object is responsible for exposing the calculation of the
size of the chunks scheduled. It abstracts the (potential platform-specific)
Expand Down
27 changes: 0 additions & 27 deletions hpx/apply.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
#include <hpx/util/deferred_call.hpp>
#include <hpx/util/thread_description.hpp>

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
#include <hpx/traits/v1/is_executor.hpp>
#include <hpx/parallel/executors/v1/executor_traits.hpp>
#endif
#include <hpx/parallel/executors/execution.hpp>
#include <hpx/parallel/executors/parallel_executor.hpp>

Expand Down Expand Up @@ -55,29 +51,6 @@ namespace hpx { namespace detail
}
};

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
// parallel::executor
template <typename Executor>
struct apply_dispatch<Executor,
typename std::enable_if<
traits::is_executor<Executor>::value
>::type>
{
template <typename F, typename ...Ts>
HPX_FORCEINLINE static
typename std::enable_if<
traits::detail::is_deferred_invocable<F, Ts...>::value,
bool
>::type
call(Executor& exec, F&& f, Ts&&... ts)
{
parallel::executor_traits<Executor>::apply_execute(exec,
std::forward<F>(f), std::forward<Ts>(ts)...);
return false;
}
};
#endif

// The overload for hpx::apply taking an executor simply forwards to the
// corresponding executor customization point.
//
Expand Down
28 changes: 0 additions & 28 deletions hpx/async.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include <hpx/util/bind_action.hpp>
#include <hpx/util/deferred_call.hpp>

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
#include <hpx/traits/v1/is_executor.hpp>
#include <hpx/parallel/executors/v1/executor_traits.hpp>
#endif
#include <hpx/parallel/executors/execution.hpp>
#include <hpx/parallel/executors/parallel_executor.hpp>

Expand Down Expand Up @@ -55,30 +51,6 @@ namespace hpx { namespace detail
}
};

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
// parallel::executor
template <typename Executor>
struct async_dispatch<Executor,
typename std::enable_if<
traits::is_executor<Executor>::value
>::type>
{
template <typename F, typename ...Ts>
HPX_FORCEINLINE static
typename std::enable_if<
traits::detail::is_deferred_invocable<F, Ts...>::value,
hpx::future<
typename util::detail::invoke_deferred_result<F, Ts...>::type
>
>::type
call(Executor& exec, F && f, Ts &&... ts)
{
return parallel::executor_traits<Executor>::async_execute(
exec, std::forward<F>(f), std::forward<Ts>(ts)...);
}
};
#endif

// The overload for hpx::async taking an executor simply forwards to the
// corresponding executor customization point.
//
Expand Down
3 changes: 0 additions & 3 deletions hpx/include/parallel_executor_information.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include <hpx/config.hpp>

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
#include <hpx/parallel/executors/v1/executor_information_traits.hpp>
#endif
#include <hpx/parallel/executors/execution_information.hpp>
#include <hpx/parallel/executors/thread_execution_information.hpp>

Expand Down
15 changes: 0 additions & 15 deletions hpx/include/parallel_inner_product.hpp

This file was deleted.

4 changes: 0 additions & 4 deletions hpx/include/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
#include <hpx/traits/is_component.hpp>
#include <hpx/traits/is_continuation.hpp>
#include <hpx/traits/is_distribution_policy.hpp>
#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
#include <hpx/traits/v1/is_executor.hpp>
#include <hpx/traits/v1/is_executor_parameters.hpp>
#endif
#include <hpx/traits/is_executor.hpp>
#include <hpx/traits/is_executor_parameters.hpp>
#include <hpx/traits/is_future.hpp>
Expand Down
25 changes: 0 additions & 25 deletions hpx/lcos/dataflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
#include <hpx/util/thread_description.hpp>
#include <hpx/util/tuple.hpp>

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
#include <hpx/traits/v1/is_executor.hpp>
#include <hpx/parallel/executors/v1/executor_traits.hpp>
#endif
#include <hpx/parallel/executors/execution.hpp>
#include <hpx/parallel/executors/parallel_executor.hpp>

Expand Down Expand Up @@ -267,21 +263,6 @@ namespace hpx { namespace lcos { namespace detail
}
}

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
// handle executors through their executor_traits
template <typename Executor>
HPX_DEPRECATED(HPX_DEPRECATED_MSG) HPX_FORCEINLINE
typename std::enable_if<
traits::is_executor<Executor>::value
>::type
finalize(Executor& exec, Futures&& futures)
{
boost::intrusive_ptr<dataflow_frame> this_(this);
parallel::executor_traits<Executor>::apply_execute(exec,
&dataflow_frame::done, std::move(this_), std::move(futures));
}
#endif

// The overload for hpx::dataflow taking an executor simply forwards
// to the corresponding executor customization point.
//
Expand Down Expand Up @@ -441,9 +422,6 @@ namespace hpx { namespace lcos { namespace detail
// threads::executor
template <typename Executor>
struct dataflow_dispatch<Executor, typename std::enable_if<
#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
traits::is_executor<Executor>::value ||
#endif
traits::is_one_way_executor<Executor>::value ||
traits::is_two_way_executor<Executor>::value ||
traits::is_threads_executor<Executor>::value
Expand Down Expand Up @@ -472,9 +450,6 @@ namespace hpx { namespace lcos { namespace detail
struct dataflow_dispatch<FD, typename std::enable_if<
!traits::is_launch_policy<FD>::value &&
!(
#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
traits::is_executor<FD>::value ||
#endif
traits::is_one_way_executor<FD>::value ||
traits::is_two_way_executor<FD>::value ||
traits::is_threads_executor<FD>::value)
Expand Down
Loading

0 comments on commit 38ecfb0

Please sign in to comment.