Grappa  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlobalAddress< T > Class Template Reference

Global address class. More...

#include <Addressing.hpp>

Public Member Functions

 GlobalAddress ()
 Construct a global address, initialized to a null pointer. More...
 
intptr_t raw_bits () const
 Return the raw bits of a global address. More...
 
Core core () const
 Return the home core of a global address. More...
 
Pool pool () const
 Return the home core of a global address TODO: implement this. More...
 
T * pointer () const
 Return the local pointer from a global address. More...
 
T * localize (Core nid=-1) const
 Find lowest local address of the object at this address. More...
 
T * operator-> () const
 Does not remotely dereference the global address, this is syntactic sugar for localize()-> More...
 
GlobalAddress< T > block_min () const
 Find base address of block containing this byte. More...
 
GlobalAddress< char > first_byte () const
 find global byte address of first byte of block More...
 
GlobalAddress< char > last_byte () const
 find global byte address of last byte of block More...
 
GlobalAddress< T > block_max () const
 
bool is_2D () const
 is this a 2D address? More...
 
bool is_linear () const
 is this a linear address? More...
 
GlobalAddress< T > & operator++ ()
 increment address by one T More...
 
GlobalAddress< T > operator++ (int)
 increment address by one T More...
 
GlobalAddress< T > & operator-- ()
 decrement address by one T More...
 
GlobalAddress< T > & operator+= (ptrdiff_t i)
 increment address by i T's More...
 
GlobalAddress< T > & operator-= (ptrdiff_t i)
 decrement address by i T's More...
 
bool equals (const GlobalAddress< T > &t) const
 test for equality TODO: get rid of this More...
 
bool operator== (const GlobalAddress< T > &t) const
 test for equality TODO: get rid of this More...
 
template<typename U >
bool operator== (const GlobalAddress< U > &u) const
 test for equality More...
 
bool operator< (const GlobalAddress< T > &t) const
 compare addresses More...
 
template<typename U >
 operator GlobalAddress< U > ()
 generic cast operator More...
 
 operator void * ()
 cast to void *. More...
 

Static Public Member Functions

static GlobalAddress TwoDimensional (T *t, Core n=global_communicator.mycore)
 Construct a 2D global address with an initial pointer and core. More...
 
static GlobalAddress Linear (T *t, Pool p=0)
 Construct a linear global address from a local pointer. More...
 
static GlobalAddress Raw (intptr_t t)
 Construct a global address from raw bits. More...
 

Friends

template<typename U >
std::ostream & operator<< (std::ostream &o, const GlobalAddress< U > &ga)
 
template<typename U >
ptrdiff_t operator- (const GlobalAddress< U > &t, const GlobalAddress< U > &u)
 

Detailed Description

template<typename T>
class GlobalAddress< T >

Global address class.

We support two types of global addresses:

  1. 2D addresses
  2. Linear addresses

2D addresses are a PGAS-style tuple of ( core, address on core )

Linear addresses are block cyclic across all the cores in the system.

Definition at line 99 of file Addressing.hpp.

Constructor & Destructor Documentation

template<typename T>
GlobalAddress< T >::GlobalAddress ( )
inline

Construct a global address, initialized to a null pointer.

Definition at line 137 of file Addressing.hpp.

Member Function Documentation

template<typename T>
GlobalAddress< T > GlobalAddress< T >::block_max ( ) const
inline

Definition at line 281 of file Addressing.hpp.

template<typename T>
GlobalAddress< T > GlobalAddress< T >::block_min ( ) const
inline

Find base address of block containing this byte.

Definition at line 256 of file Addressing.hpp.

template<typename T>
Core GlobalAddress< T >::core ( ) const
inline

Return the home core of a global address.

Definition at line 192 of file Addressing.hpp.

template<typename T>
bool GlobalAddress< T >::equals ( const GlobalAddress< T > &  t) const
inline

test for equality TODO: get rid of this

Definition at line 345 of file Addressing.hpp.

template<typename T>
GlobalAddress< char > GlobalAddress< T >::first_byte ( ) const
inline

find global byte address of first byte of block

Definition at line 271 of file Addressing.hpp.

template<typename T>
bool GlobalAddress< T >::is_2D ( ) const
inline

is this a 2D address?

Definition at line 298 of file Addressing.hpp.

template<typename T>
bool GlobalAddress< T >::is_linear ( ) const
inline

is this a linear address?

Definition at line 303 of file Addressing.hpp.

template<typename T>
GlobalAddress< char > GlobalAddress< T >::last_byte ( ) const
inline

find global byte address of last byte of block

Definition at line 276 of file Addressing.hpp.

template<typename T>
static GlobalAddress GlobalAddress< T >::Linear ( T *  t,
Pool  p = 0 
)
inlinestatic

Construct a linear global address from a local pointer.

TODO: the pool argument is currenly unused

Definition at line 153 of file Addressing.hpp.

template<typename T>
T* GlobalAddress< T >::localize ( Core  nid = -1) const
inline

Find lowest local address of the object at this address.

Used for PGAS-style local iteration.

Definition at line 228 of file Addressing.hpp.

template<typename T>
template<typename U >
GlobalAddress< T >::operator GlobalAddress< U > ( )
inlineexplicit

generic cast operator

Definition at line 370 of file Addressing.hpp.

template<typename T>
GlobalAddress< T >::operator void * ( )
inline

cast to void *.

Definition at line 376 of file Addressing.hpp.

template<typename T>
GlobalAddress< T >& GlobalAddress< T >::operator++ ( )
inline

increment address by one T

Definition at line 312 of file Addressing.hpp.

template<typename T>
GlobalAddress< T > GlobalAddress< T >::operator++ ( int  )
inline

increment address by one T

Definition at line 318 of file Addressing.hpp.

template<typename T>
GlobalAddress< T >& GlobalAddress< T >::operator+= ( ptrdiff_t  i)
inline

increment address by i T's

Definition at line 332 of file Addressing.hpp.

template<typename T>
GlobalAddress< T >& GlobalAddress< T >::operator-- ( )
inline

decrement address by one T

Definition at line 325 of file Addressing.hpp.

template<typename T>
GlobalAddress< T >& GlobalAddress< T >::operator-= ( ptrdiff_t  i)
inline

decrement address by i T's

Definition at line 338 of file Addressing.hpp.

template<typename T>
T* GlobalAddress< T >::operator-> ( ) const
inline

Does not remotely dereference the global address, this is syntactic sugar for localize()->

struct { int y; } x = {1};
cout << xa->y;
//> 1

Definition at line 253 of file Addressing.hpp.

template<typename T>
bool GlobalAddress< T >::operator< ( const GlobalAddress< T > &  t) const
inline

compare addresses

Definition at line 362 of file Addressing.hpp.

template<typename T>
bool GlobalAddress< T >::operator== ( const GlobalAddress< T > &  t) const
inline

test for equality TODO: get rid of this

Definition at line 351 of file Addressing.hpp.

template<typename T>
template<typename U >
bool GlobalAddress< T >::operator== ( const GlobalAddress< U > &  u) const
inline

test for equality

Definition at line 357 of file Addressing.hpp.

template<typename T>
T* GlobalAddress< T >::pointer ( ) const
inline

Return the local pointer from a global address.

Definition at line 211 of file Addressing.hpp.

template<typename T>
Pool GlobalAddress< T >::pool ( ) const
inline

Return the home core of a global address TODO: implement this.

Definition at line 205 of file Addressing.hpp.

template<typename T>
static GlobalAddress GlobalAddress< T >::Raw ( intptr_t  t)
inlinestatic

Construct a global address from raw bits.

Definition at line 179 of file Addressing.hpp.

template<typename T>
intptr_t GlobalAddress< T >::raw_bits ( ) const
inline

Return the raw bits of a global address.

Definition at line 187 of file Addressing.hpp.

template<typename T>
static GlobalAddress GlobalAddress< T >::TwoDimensional ( T *  t,
Core  n = global_communicator.mycore 
)
inlinestatic

Construct a 2D global address with an initial pointer and core.

Definition at line 140 of file Addressing.hpp.

Friends And Related Function Documentation

template<typename T>
template<typename U >
ptrdiff_t operator- ( const GlobalAddress< U > &  t,
const GlobalAddress< U > &  u 
)
friend
template<typename T>
template<typename U >
std::ostream& operator<< ( std::ostream &  o,
const GlobalAddress< U > &  ga 
)
friend

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