STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Classes | Public Member Functions | Static Public Member Functions | Public Types | Related Functions
stapl::runtime::gang_md Class Reference

Gang metadata that is shared by the locations that are on the same process. More...

Classes

class  fence_md
 Fence metadata for intergang requests. More...
 

Public Member Functions

 gang_md (gang_description desc, const size_type nlocs)
 Creates the global gang metadata with id 0 for processes with nlocs locally managed location. More...
 
 gang_md (const id parent_id, common_gang_md &c_md)
 Creates gang metadata for a single location gang. More...
 
 gang_md (const id parent_id, const size_type nlocs)
 Creates gang metadata for a shared memory only gang. More...
 
 gang_md (const id gid, const id parent_id, gang_description desc)
 Creates gang metadata with a known id. More...
 
 gang_md (const id parent_id, gang_description desc)
 Creates gang metadata with an automatically generated id. More...
 
 gang_md (const deferred_t, const id parent_id, gang_description desc)
 Creates gang metadata with an unknown id. More...
 
template<typename Range >
 gang_md (const id gid, const id parent_id, gang_description desc, Range &&r)
 Creates gang metadata with a known id. More...
 
template<typename Range >
 gang_md (const id parent_id, gang_description desc, Range &&r)
 Creates gang metadata with an automatically generated id. More...
 
 gang_md (const id gid, const id parent_id, gang_md const &other)
 Creates gang metadata that is identical to other with a known id. More...
 
 gang_md (const id parent_id, gang_md const &other)
 Creates gang metadata that is identical to other with an automatically generated id. More...
 
void set_id (const id gid)
 Sets the gang id and automatically registers *this to the gang_md_registry. More...
 
id get_id (void) const noexcept
 
id get_parent_id (void) const noexcept
 
gang_description const & get_description (void) const noexcept
 
topology const & get_topology (void) const noexcept
 
runqueue_type const & get_runqueue (void) const noexcept
 
runqueue_typeget_runqueue (void) noexcept
 
fence_md const & get_fence_md (void) const noexcept
 
fence_mdget_fence_md (void) noexcept
 
size_type size (void) const noexcept
 
size_type local_size (void) const noexcept
 Returns the number of locally managed locations.
 
bool exists (const location_id lid) const noexcept
 Returns if the location id exists in this gang.
 
process_id get_process_id (const location_id lid) const noexcept
 
bool conforms_with (gang_md const &g) const noexcept
 
template<typename T , typename Handle , typename... Args>
std::shared_ptr< T > get_shared_object (Handle const &h, Args &&... args)
 Returns an object that is shared among all the locally managed locations. More...
 
void add_ref (long count=1, std::memory_order order=std::memory_order_relaxed) noexcept
 Increases the reference count by count.
 
long remove_ref (long count=1, std::memory_order order=std::memory_order_relaxed) noexcept
 Decreases the reference count by count. More...
 
bool release (std::memory_order order=std::memory_order_relaxed) noexcept
 Decreases the reference count, destroying the object if it reached 0. More...
 
long use_count (std::memory_order order=std::memory_order_relaxed) const noexcept
 
bool unique (std::memory_order order=std::memory_order_relaxed) const noexcept
 

Static Public Member Functions

static void update_fence_md (const gang_md::id gid, fence_md::container_type const &c)
 Updates counts for sent and processed intergang requests.
 

Public Types

using id = gang_id
 
using size_type = common_gang_md::size_type
 
using runqueue_type = shared_runqueue
 

Related Functions

(Note that these are not member functions.)

constexpr bool operator== (gang_md const &x, gang_md const &y) noexcept
 Returns if x is equal to y. More...
 

Detailed Description

Gang metadata that is shared by the locations that are on the same process.

gang_md contains fence metadata for intergang requests (see also context). It acts as a proxy to the contained gang_description to return information on which process each location exists.

It also contains a topology object that describes the topology of the processes that the gang consists of.

Finally, it is used by the locations on the same process to create objects that can be shared between them.

A gang_md object is reference counted. It is destroyed when all the locally managed locations, their associated location_md objects as well as the gang_md objects in the children processes have been destroyed.

Constructor & Destructor Documentation

◆ gang_md() [1/10]

stapl::runtime::gang_md::gang_md ( gang_description  desc,
const size_type  nlocs 
)

Creates the global gang metadata with id 0 for processes with nlocs locally managed location.

The object will be automatically registered to the gang_md_registry.

Parameters
descgang_description object associated with this gang.
nlocsNumber of locally managed locations.

◆ gang_md() [2/10]

stapl::runtime::gang_md::gang_md ( const id  parent_id,
common_gang_md c_md 
)

Creates gang metadata for a single location gang.

The object will be automatically registered to the gang_md_registry.

Parameters
parent_idId of the gang that created this one.
c_mdShared gang metadata.

◆ gang_md() [3/10]

stapl::runtime::gang_md::gang_md ( const id  parent_id,
const size_type  nlocs 
)

Creates gang metadata for a shared memory only gang.

The object will be automatically registered to the gang_md_registry.

Parameters
parent_idId of the gang that created this one.
nlocsNumber of locally managed locations.

◆ gang_md() [4/10]

stapl::runtime::gang_md::gang_md ( const id  gid,
const id  parent_id,
gang_description  desc 
)

Creates gang metadata with a known id.

The object will be automatically registered to the gang_md_registry.

Parameters
gidGang id.
parent_idParent gang id.
descgang_description object associated with this gang.

◆ gang_md() [5/10]

stapl::runtime::gang_md::gang_md ( const id  parent_id,
gang_description  desc 
)

Creates gang metadata with an automatically generated id.

The object will be automatically registered to the gang_md_registry.

Parameters
parent_idParent gang id.
descgang_description object associated with the gang.

◆ gang_md() [6/10]

stapl::runtime::gang_md::gang_md ( const deferred_t  ,
const id  parent_id,
gang_description  desc 
)

Creates gang metadata with an unknown id.

The object will be registered by set_id().

Parameters
parent_idParent gang id.
descgang_description object associated with the gang.

◆ gang_md() [7/10]

template<typename Range >
stapl::runtime::gang_md::gang_md ( const id  gid,
const id  parent_id,
gang_description  desc,
Range &&  r 
)

Creates gang metadata with a known id.

The object will be automatically registered to the gang_md_registry.

Parameters
gidGang id.
parent_idParent gang id.
descgang_description object associated with this gang.
rLocally managed location id range.

◆ gang_md() [8/10]

template<typename Range >
stapl::runtime::gang_md::gang_md ( const id  parent_id,
gang_description  desc,
Range &&  r 
)

Creates gang metadata with an automatically generated id.

The object will be automatically registered to the gang_md_registry.

Parameters
parent_idParent gang id.
descgang_description object associated with the gang.
rLocally managed location id range.

◆ gang_md() [9/10]

stapl::runtime::gang_md::gang_md ( const id  gid,
const id  parent_id,
gang_md const &  other 
)

Creates gang metadata that is identical to other with a known id.

The object will be automatically registered to the gang_md_registry.

Parameters
gidGang id.
parent_idParent gang id.
otherGang to clone.

◆ gang_md() [10/10]

stapl::runtime::gang_md::gang_md ( const id  parent_id,
gang_md const &  other 
)

Creates gang metadata that is identical to other with an automatically generated id.

The object will be automatically registered to the gang_md_registry.

Parameters
parent_idParent gang id.
otherGang to clone.

Member Function Documentation

◆ set_id()

void stapl::runtime::gang_md::set_id ( const id  gid)

Sets the gang id and automatically registers *this to the gang_md_registry.

Warning
This function is only valid if the gang_md was constructed without an id.
Parameters
gidId to register the gang metadata with.

◆ get_shared_object()

template<typename T , typename Handle , typename... Args>
std::shared_ptr<T> stapl::runtime::gang_md::get_shared_object ( Handle const &  h,
Args &&...  args 
)

Returns an object that is shared among all the locally managed locations.

The returned object is valid for local_size() requesting locations and is indexed with h.

Warning
Only one shared object is allowed per handle h.
Parameters
hHandle to index the shared object.
argsArguments to pass to the constructor of the shared object.

◆ remove_ref()

long stapl::runtime::ref_counted< gang_md , std::default_delete<gang_md > >::remove_ref ( long  count = 1,
std::memory_order  order = std::memory_order_relaxed 
)
noexceptinherited

Decreases the reference count by count.

Returns
The new reference count.

◆ release()

bool stapl::runtime::ref_counted< gang_md , std::default_delete<gang_md > >::release ( std::memory_order  order = std::memory_order_relaxed)
noexceptinherited

Decreases the reference count, destroying the object if it reached 0.

Warning
If release() returns true, then the object has been destroyed.
Returns
true if the object was destroyed, otherwise false.

The documentation for this class was generated from the following file: