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, typename = std::enable_if_t<hpx::is_async_execution_policy_v<ExPolicy>>>
decltype(auto) define_spmd_block(ExPolicy &&policy, std::size_t num_images, F &&f, Args&&... args)
template<typename ExPolicy, typename F, typename ...Args, typename = typename std::enable_if<!hpx::is_async_execution_policy<ExPolicy>::value>::type>
void define_spmd_block(ExPolicy &&policy, std::size_t num_images, F &&f, Args&&... args)
template<typename F, typename ...Args>
void define_spmd_block(std::size_t num_images, F &&f, Args&&... args)
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

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&&)
spmd_block(spmd_block const&)
spmd_block &operator=(spmd_block&&)
spmd_block &operator=(spmd_block const&)
std::size_t get_num_images() const
std::size_t this_image() const
void sync_all() const
void sync_images(std::set<std::size_t> const &images) const
void sync_images(std::vector<std::size_t> const &input_images) const
template<typename Iterator>
std::enable_if<traits::is_input_iterator<Iterator>::value>::type sync_images(Iterator begin, Iterator end) const
template<typename ...I>
std::enable_if<util::all_of<typename std::is_integral<I>::type...>::value>::type sync_images(I... i) const

Private Types

using barrier_type = hpx::barrier<>
using table_type = std::map<std::set<std::size_t>, std::shared_ptr<barrier_type>>
using mutex_type = hpx::mutex

Private Members

std::size_t num_images_
std::size_t image_id_
std::reference_wrapper<barrier_type> barrier_
std::reference_wrapper<table_type> barriers_
std::reference_wrapper<mutex_type> mtx_
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, typename = std::enable_if_t<hpx::is_async_execution_policy_v<ExPolicy>>>
decltype(auto) define_spmd_block(ExPolicy &&policy, std::size_t num_images, F &&f, Args&&... args)
template<typename ExPolicy, typename F, typename ...Args, typename = typename std::enable_if<!hpx::is_async_execution_policy<ExPolicy>::value>::type>
void define_spmd_block(ExPolicy &&policy, std::size_t num_images, F &&f, Args&&... args)
template<typename F, typename ...Args>
void define_spmd_block(std::size_t num_images, F &&f, Args&&... args)