hpx::distributed::barrier#

Defined in header hpx/barrier.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx

Top level HPX namespace.

namespace distributed

Functions

explicit barrier(std::string const &base_name)#

Creates a barrier, rank is locality id, size is number of localities

A barrier base_name is created. It expects that hpx::get_num_localities() participate and the local rank is hpx::get_locality_id().

Parameters

base_name – The name of the barrier

barrier(std::string const &base_name, std::size_t num)#

Creates a barrier with a given size, rank is locality id

A barrier base_name is created. It expects that num participate and the local rank is hpx::get_locality_id().

Parameters
  • base_name – The name of the barrier

  • num – The number of participating threads

barrier(std::string const &base_name, std::size_t num, std::size_t rank)#

Creates a barrier with a given size and rank

A barrier base_name is created. It expects that num participate and the local rank is rank.

Parameters
  • base_name – The name of the barrier

  • num – The number of participating threads

  • rank – The rank of the calling site for this invocation

barrier(std::string const &base_name, std::vector<std::size_t> const &ranks, std::size_t rank)#

Creates a barrier with a vector of ranks

A barrier base_name is created. It expects that ranks.size() and the local rank is rank (must be contained in ranks).

Parameters
  • base_name – The name of the barrier

  • ranks – Gives a list of participating ranks (this could be derived from a list of locality ids

  • rank – The rank of the calling site for this invocation

void wait() const#

Wait until each participant entered the barrier. Must be called by all participants

If counter_ is 0, returns immediately. Otherwise, blocks the calling thread at the synchronization point until counter_ reaches 0.

Returns

This function returns once all participants have entered the barrier (have called wait).

Throws

Nothing.

hpx::future<void> wait(hpx::launch::async_policy) const#

Wait until each participant entered the barrier. Must be called by all participants

Returns

a future that becomes ready once all participants have entered the barrier (have called wait).

static void synchronize()#

Perform a global synchronization using the default global barrier The barrier is created once at startup and can be reused throughout the lifetime of an HPX application.

Note

This function currently does not support dynamic connection and disconnection of localities.