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


HPX_ACTION_USES_MEDIUM_STACK ( hpx::agas::server::primary_namespace::allocate_action) HPX_REGISTER_ACTION_DECLARATION( hpx typedef std::pair<hpx::id_type, hpx::naming::address> std_pair_address_id_type
namespace hpx
namespace agas


naming::gid_type bootstrap_primary_namespace_gid()
hpx::id_type bootstrap_primary_namespace_id()
namespace server

AGAS’s primary namespace maps 128-bit global identifiers (GIDs) to resolved addresses.

The following is the canonical description of the partitioning of AGAS’s primary namespace.


MSB        - Most significant bits (bit 64 to bit 127)
LSB        - Least significant bits (bit 0 to bit 63)
prefix     - Highest 32 bits (bit 96 to bit 127) of the MSB. Each
             locality is assigned a prefix. This creates a 96-bit
             address space for each locality.
RC         - Bit 88 to bit 92 of the MSB. This is the log2 of the number
             of reference counting credits on the GID.
             Bit 93 is used by the locking scheme for gid_types.
             Bit 94 is a flag which is set if the credit value is valid.
             Bit 95 is a flag that is set if a GID's credit count is
             ever split (e.g. if the GID is ever passed to another
           - Bit 87 marks the gid such that it will not be stored in
             any of the AGAS caches. This is used mainly for ids
             which represent 'one-shot' objects (like promises).
identifier - Bit 64 to bit 86 of the MSB, and the entire LSB. The
             content of these bits depends on the component type of
             the underlying object. For all user-defined components,
             these bits contain a unique 88-bit number which is
             assigned sequentially for each locality. For
             \a hpx#components#component_runtime_support the high 24
             bits are zeroed and the low 64 bits hold the LVA of the

The layout of the address space is implementation defined, and subject to change. Never write application code that relies on the internal layout of GIDs. AGAS only guarantees that all assigned GIDs will be unique.

The following address ranges are reserved. Some are either explicitly or implicitly protected by AGAS. The letter x represents a single-byte wild card.

    Historically unused address space reserved for future use.
    Address space for LVA-encoded GIDs.
    Prefix of the bootstrap AGAS locality.
    Address of the primary_namespace component on the bootstrap AGAS
    Address of the component_namespace component on the bootstrap AGAS
    Address of the symbol_namespace component on the bootstrap AGAS
    Address of the locality_namespace component on the bootstrap AGAS


constexpr char const *const primary_namespace_service_name = "primary/"
struct primary_namespace : public components::fixed_component_base<primary_namespace>

Public Types

using mutex_type = hpx::spinlock
using base_type = components::fixed_component_base<primary_namespace>
using component_type = std::int32_t
using gva_table_data_type = std::pair<gva, naming::gid_type>
using gva_table_type = std::map<naming::gid_type, gva_table_data_type>
using refcnt_table_type = std::map<naming::gid_type, std::int64_t>
using resolved_type = hpx::tuple<naming::gid_type, gva, naming::gid_type>

Public Functions

void finalize()
void set_local_locality(naming::gid_type const &g)
void register_server_instance(char const *servicename, std::uint32_t locality_id = naming::invalid_locality_id, error_code &ec = throws)
void unregister_server_instance(error_code &ec = throws)
bool bind_gid(gva const &g, naming::gid_type id, naming::gid_type const &locality)
std::pair<hpx::id_type, naming::address> begin_migration(naming::gid_type id)
bool end_migration(naming::gid_type const &id)
resolved_type resolve_gid(naming::gid_type const &id)
hpx::id_type colocate(naming::gid_type const &id)
naming::address unbind_gid(std::uint64_t count, naming::gid_type id)
std::int64_t increment_credit(std::int64_t credits, naming::gid_type lower, naming::gid_type upper)
std::vector<std::int64_t> decrement_credit(std::vector<hpx::tuple<std::int64_t, naming::gid_type, naming::gid_type>> const &requests)
std::pair<naming::gid_type, naming::gid_type> allocate(std::uint64_t count)

Public Members

counter_data counter_data_

Private Types

using migration_table_type = std::map<naming::gid_type, hpx::tuple<bool, std::size_t, lcos::local::detail::condition_variable>>
using free_entry_allocator_type = util::internal_allocator<free_entry>
using free_entry_list_type = std::list<free_entry, free_entry_allocator_type>

Private Functions

void wait_for_migration_locked(std::unique_lock<mutex_type> &l, naming::gid_type const &id, error_code &ec)
resolved_type resolve_gid_locked(std::unique_lock<mutex_type> &l, naming::gid_type const &gid, error_code &ec)
void increment(naming::gid_type const &lower, naming::gid_type const &upper, std::int64_t &credits, error_code &ec)
void resolve_free_list(std::unique_lock<mutex_type> &l, std::list<refcnt_table_type::iterator> const &free_list, free_entry_list_type &free_entry_list, naming::gid_type const &lower, naming::gid_type const &upper, error_code &ec)
void decrement_sweep(free_entry_list_type &free_list, naming::gid_type const &lower, naming::gid_type const &upper, std::int64_t credits, error_code &ec)
void free_components_sync(free_entry_list_type &free_list, naming::gid_type const &lower, naming::gid_type const &upper, error_code &ec)

Private Members

mutex_type mutex_
gva_table_type gvas_
refcnt_table_type refcnts_
std::string instance_name_
naming::gid_type next_id_
naming::gid_type locality_
migration_table_type migrating_objects_
struct counter_data

Public Functions

std::int64_t get_bind_gid_count(bool)
std::int64_t get_resolve_gid_count(bool)
std::int64_t get_unbind_gid_count(bool)
std::int64_t get_increment_credit_count(bool)
std::int64_t get_decrement_credit_count(bool)
std::int64_t get_allocate_count(bool)
std::int64_t get_begin_migration_count(bool)
std::int64_t get_end_migration_count(bool)
std::int64_t get_overall_count(bool)
std::int64_t get_bind_gid_time(bool)
std::int64_t get_resolve_gid_time(bool)
std::int64_t get_unbind_gid_time(bool)
std::int64_t get_increment_credit_time(bool)
std::int64_t get_decrement_credit_time(bool)
std::int64_t get_allocate_time(bool)
std::int64_t get_begin_migration_time(bool)
std::int64_t get_end_migration_time(bool)
std::int64_t get_overall_time(bool)
void increment_bind_gid_count()
void increment_resolve_gid_count()
void increment_unbind_gid_count()
void increment_increment_credit_count()
void increment_decrement_credit_count()
void increment_allocate_count()
void increment_begin_migration_count()
void increment_end_migration_count()
void enable_all()

Public Members

api_counter_data bind_gid_
api_counter_data resolve_gid_
api_counter_data unbind_gid_
api_counter_data increment_credit_
api_counter_data decrement_credit_
api_counter_data allocate_
api_counter_data begin_migration_
api_counter_data end_migration_
struct api_counter_data

Public Functions


Public Members

std::atomic<std::int64_t> count_
std::atomic<std::int64_t> time_
bool enabled_
struct free_entry

Public Functions

free_entry(agas::gva gva, naming::gid_type const &gid, naming::gid_type const &loc)

Public Members

agas::gva gva_
naming::gid_type gid_
naming::gid_type locality_