hpx/parallel/spmd_block.hpp#
Defined in header hpx/parallel/spmd_block.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
-
namespace lcos#
-
namespace local#
Functions
-
template<typename ExPolicy, typename F, typename ...Args>
decltype(auto) define_spmd_block(ExPolicy &&policy, std::size_t num_images, F &&f, Args&&... args)#
-
template<typename Scheduler, typename F, typename ...Args>
decltype(auto) define_spmd_block(Scheduler &&sched, std::size_t num_images, F &&f, Args&&... args)# Launch an SPMD block on a P2300 scheduler.
Creates num_images concurrent images of f, each receiving a unique spmd_block handle plus the forwarded args. All images receive the same arguments by lvalue reference. Every image is scheduled as an independent sender on sched and the results are joined with ex::when_all_vector.
- Parameters:
sched – The scheduler to use for execution. The provided scheduler must provide parallel forward-progress guarantees if the callable invokes sync_all() or sync_images(). Schedulers without this guarantee (e.g., inline schedulers) will cause deadlocks at the barrier.
num_images – Number of SPMD images to launch.
f – Callable whose first parameter is an spmd_block.
args – Extra arguments forwarded to every image. All images receive the same arguments by lvalue reference.
- Returns:
A lazy sender representing the SPMD block execution. The caller controls synchronization (e.g. via sync_wait).
-
struct spmd_block#
- #include <spmd_block.hpp>
The class spmd_block defines an interface for launching multiple images while giving handles to each image to interact with the remaining images. The define_spmd_block function templates create multiple images of a user-defined function (or lambda) and launches them in a possibly separate thread. A temporary spmd block object is created and diffused to each image. The constraint for the function (or lambda) given to the define_spmd_block function is to accept a spmd_block as first parameter.
Public Functions
-
inline explicit spmd_block(std::size_t num_images, std::size_t image_id, barrier_type &barrier, table_type &barriers, mutex_type &mtx)#
-
spmd_block(spmd_block&&) = default#
-
spmd_block(spmd_block const&) = delete#
-
spmd_block &operator=(spmd_block&&) = default#
-
spmd_block &operator=(spmd_block const&) = delete#
-
~spmd_block() = default#
-
inline void sync_all() const#
Private Types
Private Members
-
mutable std::reference_wrapper<barrier_type> barrier_#
-
mutable std::reference_wrapper<table_type> barriers_#
-
mutable std::reference_wrapper<mutex_type> mtx_#
-
inline explicit spmd_block(std::size_t num_images, std::size_t image_id, barrier_type &barrier, table_type &barriers, mutex_type &mtx)#
-
template<typename ExPolicy, typename F, typename ...Args>
-
namespace local#
-
namespace parallel
Typedefs
-
using spmd_block = hpx::lcos::local::spmd_block#
The class spmd_block defines an interface for launching multiple images while giving handles to each image to interact with the remaining images. The define_spmd_block function templates create multiple images of a user-defined function (or lambda) and launches them in a possibly separate thread. A temporary spmd block object is created and diffused to each image. The constraint for the function (or lambda) given to the define_spmd_block function is to accept a spmd_block as first parameter.
Functions
-
template<typename ExPolicy, typename F, typename ...Args>
decltype(auto) define_spmd_block(ExPolicy &&policy, std::size_t num_images, F &&f, Args&&... args)#
-
template<typename Scheduler, typename F, typename ...Args>
decltype(auto) define_spmd_block(Scheduler &&sched, std::size_t num_images, F &&f, Args&&... args)#
-
using spmd_block = hpx::lcos::local::spmd_block#
-
namespace lcos#