hpx/collectives/barrier.hpp#

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

namespace hpx
namespace distributed
class barrier#
#include <barrier.hpp>

The barrier is an implementation performing a barrier over a number of participating threads. The different threads don’t have to be on the same locality. This barrier can be invoked in a distributed application.

For a local only barrier

See also

hpx::barrier.

Public Functions

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()#

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

Returns

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

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

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).

Public Static Functions

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.