TiledArray::Pmap Class Referenceabstract
Inheritance diagram for TiledArray::Pmap:
Collaboration diagram for TiledArray::Pmap:

Documentation

Process map.

This is the base and interface class for other process maps. It provides access to the local tile iterator and basic process map information. Derived classes are responsible for distribution of tiles. The general idea of process map objects is to compute process owners with an O(1) algorithm to provide fast access to tile owner information and avoid storage of process map. A cached list of local tiles can be stored so that algorithms that need to iterate over local tiles can do so without computing the owner of all tiles. The algorithm to generate the cached list of local tiles and the memory requirement should scale as O(tiles/processes), if possible.

Definition at line 55 of file pmap.h.

Classes

class  Iterator
 Pmap iterator type. More...
 

Public Types

typedef std::size_t size_type
 Size type. More...
 

Public Member Functions

 Pmap (World &world, const size_type size)
 Process map constructor. More...
 
virtual ~Pmap ()
 
virtual size_type owner (const size_type tile) const =0
 Maps tile to the processor that owns it. More...
 
virtual bool is_local (const size_type tile) const =0
 Check that the tile is owned by this process. More...
 
size_type size () const
 Size accessor. More...
 
size_type rank () const
 Process rank accessor. More...
 
size_type procs () const
 Process count accessor. More...
 
virtual bool known_local_size () const
 Queries whether local size is known. More...
 
size_type local_size () const
 Local size accessor. More...
 
bool empty () const
 Check if there are any local elements. More...
 
virtual bool is_replicated () const
 Replicated array status. More...
 

Protected Attributes

const size_type rank_
 The rank of this process. More...
 
const size_type procs_
 The number of processes. More...
 
const size_type size_
 The number of tiles mapped among all processes. More...
 
std::vector< size_typelocal_
 A list of local tiles (may be empty, if not needed) More...
 
size_type local_size_
 

Iteration

typedef Iterator const_iterator
 Iterator type. More...
 
class Iterator
 Iterator type. More...
 
virtual const_iterator begin () const
 Begin local element iterator. More...
 
virtual const_iterator end () const
 End local element iterator. More...
 
const const_iterator cbegin () const
 Begin local element iterator. More...
 
const const_iterator cend () const
 End local element iterator. More...
 

Member Typedef Documentation

◆ const_iterator

Iterator type.

Definition at line 282 of file pmap.h.

◆ size_type

typedef std::size_t TiledArray::Pmap::size_type

Size type.

Definition at line 57 of file pmap.h.

Constructor & Destructor Documentation

◆ Pmap()

TiledArray::Pmap::Pmap ( World &  world,
const size_type  size 
)
inline

Process map constructor.

Parameters
worldThe world where the tiles will be mapped
sizeThe number of tiles to be mapped

Definition at line 78 of file pmap.h.

◆ ~Pmap()

virtual TiledArray::Pmap::~Pmap ( )
inlinevirtual

Definition at line 85 of file pmap.h.

Member Function Documentation

◆ begin()

virtual const_iterator TiledArray::Pmap::begin ( ) const
inlinevirtual

Begin local element iterator.

Returns
An iterator that points to the beginning of the local element set

Reimplemented in TiledArray::detail::ReplicatedPmap, TiledArray::detail::CyclicPmap, and TiledArray::detail::BlockedPmap.

Definition at line 287 of file pmap.h.

Here is the caller graph for this function:

◆ cbegin()

const const_iterator TiledArray::Pmap::cbegin ( ) const
inline

Begin local element iterator.

Returns
An iterator that points to the beginning of the local element set

Definition at line 303 of file pmap.h.

Here is the call graph for this function:

◆ cend()

const const_iterator TiledArray::Pmap::cend ( ) const
inline

End local element iterator.

Returns
An iterator that points to the beginning of the local element set

Definition at line 308 of file pmap.h.

Here is the call graph for this function:

◆ empty()

bool TiledArray::Pmap::empty ( ) const
inline

Check if there are any local elements.

Returns
true when there are no local tiles, otherwise false .
Warning
if size()>0 asserts that known_local_size()==true

Definition at line 133 of file pmap.h.

Here is the call graph for this function:

◆ end()

virtual const_iterator TiledArray::Pmap::end ( ) const
inlinevirtual

End local element iterator.

Returns
An iterator that points to the beginning of the local element set

Reimplemented in TiledArray::detail::ReplicatedPmap, TiledArray::detail::CyclicPmap, and TiledArray::detail::BlockedPmap.

Definition at line 295 of file pmap.h.

Here is the caller graph for this function:

◆ is_local()

virtual bool TiledArray::Pmap::is_local ( const size_type  tile) const
pure virtual

Check that the tile is owned by this process.

Parameters
tileThe tile to be checked
Returns
true if tile is owned by this process, otherwise false .

Implemented in TiledArray::detail::RoundRobinPmap, TiledArray::detail::ReplicatedPmap, TiledArray::detail::HashPmap, TiledArray::detail::CyclicPmap, and TiledArray::detail::BlockedPmap.

Here is the caller graph for this function:

◆ is_replicated()

virtual bool TiledArray::Pmap::is_replicated ( ) const
inlinevirtual

Replicated array status.

Returns
true if the array is replicated, and false otherwise

Reimplemented in TiledArray::detail::ReplicatedPmap.

Definition at line 141 of file pmap.h.

◆ known_local_size()

virtual bool TiledArray::Pmap::known_local_size ( ) const
inlinevirtual

Queries whether local size is known.

Returns
true if the number of local elements is known
Note
Override if it is too expensive to precompute

Reimplemented in TiledArray::detail::HashPmap.

Definition at line 118 of file pmap.h.

Here is the caller graph for this function:

◆ local_size()

size_type TiledArray::Pmap::local_size ( ) const
inline

Local size accessor.

Returns
The number of local elements
Warning
if size()>0 asserts that known_local_size()==true

Definition at line 124 of file pmap.h.

Here is the call graph for this function:

◆ owner()

virtual size_type TiledArray::Pmap::owner ( const size_type  tile) const
pure virtual

Maps tile to the processor that owns it.

Parameters
tileThe tile to be queried
Returns
Processor that logically owns tile

Implemented in TiledArray::detail::RoundRobinPmap, TiledArray::detail::ReplicatedPmap, TiledArray::detail::HashPmap, TiledArray::detail::CyclicPmap, and TiledArray::detail::BlockedPmap.

Here is the caller graph for this function:

◆ procs()

size_type TiledArray::Pmap::procs ( ) const
inline

Process count accessor.

Returns
The number of processes

Definition at line 112 of file pmap.h.

Here is the caller graph for this function:

◆ rank()

size_type TiledArray::Pmap::rank ( ) const
inline

Process rank accessor.

Returns
The rank of this process

Definition at line 107 of file pmap.h.

Here is the caller graph for this function:

◆ size()

size_type TiledArray::Pmap::size ( ) const
inline

Size accessor.

Returns
The number of elements

Definition at line 102 of file pmap.h.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ Iterator

friend class Iterator
friend

Iterator type.

Definition at line 280 of file pmap.h.

Member Data Documentation

◆ local_

std::vector<size_type> TiledArray::Pmap::local_
protected

A list of local tiles (may be empty, if not needed)

Definition at line 64 of file pmap.h.

◆ local_size_

size_type TiledArray::Pmap::local_size_
protected

The number of tiles mapped to this process (if local_ is not empty, this equals local_.size()); if local_size_known()==false this is not used

Definition at line 65 of file pmap.h.

◆ procs_

const size_type TiledArray::Pmap::procs_
protected

The number of processes.

Definition at line 61 of file pmap.h.

◆ rank_

const size_type TiledArray::Pmap::rank_
protected

The rank of this process.

Definition at line 60 of file pmap.h.

◆ size_

const size_type TiledArray::Pmap::size_
protected

The number of tiles mapped among all processes.

Definition at line 62 of file pmap.h.


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