Grappa  r3821, hash 22cd626d567a91ead5b23302066d1e9469f45c66
Memory

Namespaces

 Grappa
 this core's base pointer
 

Classes

class  GlobalAddress< T >
 Global address class. More...
 
struct  LocalIterator< T >
 

Macros

#define symmetric_static   static
 Use this macro to allocate space for a variable at the same address on all cores. More...
 

Functions

template<typename T >
GlobalAddress< T > operator+ (const GlobalAddress< T > &t, ptrdiff_t i)
 return an address that's i T's more than t. More...
 
template<typename T >
GlobalAddress< T > operator- (const GlobalAddress< T > &t, ptrdiff_t i)
 return an address that's i T's less than t. More...
 
template<typename T >
ptrdiff_t operator- (const GlobalAddress< T > &t, const GlobalAddress< T > &u)
 how many T's different are t and u? More...
 
template<>
ptrdiff_t operator-< char > (const GlobalAddress< char > &t, const GlobalAddress< char > &u)
 how many bytes different are t and u? More...
 
template<typename T >
GlobalAddress< T > make_global (T *t, Core n=global_communicator.mycore)
 return a 2d global pointer to a local pointer on a particular core More...
 
template<typename T >
GlobalAddress< T > make_linear (T *t)
 takes a local pointer to a block-cyclic distributed chuck of memory allocated at the same base address on all cores, and makes a linear global pointer pointing to that byte. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &o, const GlobalAddress< T > &ga)
 output human-readable version of global address More...
 
template<typename T , typename M >
GlobalAddress< M > global_pointer_to_member (const GlobalAddress< T > t, const M T::*m)
 computes offsets of members in structs and claases call like this: More...
 
template<typename T >
LocalIterator< T > iterate_local (GlobalAddress< T > base, size_t nelem)
 Helper for iterating over local elements of a Linear address range. More...
 
template<typename T >
T * Grappa::locale_alloc (size_t n=1)
 Allocate memory in locale shared heap. More...
 
template<typename T >
T * Grappa::locale_alloc_aligned (size_t alignment, size_t n=1)
 
template<typename T , typename... Args>
T * Grappa::locale_new (Args &&...args)
 allocate an object in the locale shared heap, passing arguments to its constructor More...
 
template<typename T >
T * Grappa::locale_new ()
 allocate an object in the locale shared heap More...
 
template<typename T >
T * Grappa::locale_new_array (size_t n=1)
 allocate an array in the locale shared heap More...
 
void Grappa::locale_free (void *ptr)
 Free memory that was allocated from locale shared heap. More...
 

Detailed Description

Macro Definition Documentation

#define symmetric_static   static

Use this macro to allocate space for a variable at the same address on all cores.

NOTE: the variable declared will be zero-initialized on all cores. Assiging a nonzero initial value is not guaranteed to work; constructors are not guaranteed to run. You should initialize the variable yourself the first time you use it, or with an on_all_cores().

Definition at line 188 of file GlobalAllocator.hpp.

Function Documentation

template<typename T , typename M >
GlobalAddress< M > global_pointer_to_member ( const GlobalAddress< T >  t,
const M T::*  m 
)
inline

computes offsets of members in structs and claases call like this:

1 struct Foo {
2  int i;
3 } foo;
4 GlobalAddress< Foo > foo_gp = make_global( foo );
5 GlobalAddress< int > foo_i_gp = global_pointer_to_member( foo_gp, &Foo::i );

Definition at line 463 of file Addressing.hpp.

template<typename T >
LocalIterator<T> iterate_local ( GlobalAddress< T >  base,
size_t  nelem 
)

Helper for iterating over local elements of a Linear address range.

1 auto array = global_alloc<long>(N);
2 on_all_cores([]{
3  for (auto& v : iterate_local(array,N)) {
4  v++;
5  }
6 });

Definition at line 490 of file Addressing.hpp.

template<typename T >
void * Grappa::locale_alloc ( size_t  n = 1)
inline

Allocate memory in locale shared heap.

Definition at line 112 of file LocaleSharedMemory.hpp.

template<typename T >
void * Grappa::locale_alloc_aligned ( size_t  alignment,
size_t  n = 1 
)
inline

Definition at line 121 of file LocaleSharedMemory.hpp.

void Grappa::locale_free ( void *  ptr)
inline

Free memory that was allocated from locale shared heap.

Definition at line 148 of file LocaleSharedMemory.hpp.

template<typename T , typename... Args>
T* Grappa::locale_new ( Args &&...  args)
inline

allocate an object in the locale shared heap, passing arguments to its constructor

Definition at line 131 of file LocaleSharedMemory.hpp.

template<typename T >
T* Grappa::locale_new ( )
inline

allocate an object in the locale shared heap

Definition at line 137 of file LocaleSharedMemory.hpp.

template<typename T >
T* Grappa::locale_new_array ( size_t  n = 1)
inline

allocate an array in the locale shared heap

Definition at line 143 of file LocaleSharedMemory.hpp.

template<typename T >
GlobalAddress< T > make_global ( T *  t,
Core  n = global_communicator.mycore 
)

return a 2d global pointer to a local pointer on a particular core

Definition at line 435 of file Addressing.hpp.

template<typename T >
GlobalAddress< T > make_linear ( T *  t)

takes a local pointer to a block-cyclic distributed chuck of memory allocated at the same base address on all cores, and makes a linear global pointer pointing to that byte.

Definition at line 443 of file Addressing.hpp.

template<typename T >
GlobalAddress< T > operator+ ( const GlobalAddress< T > &  t,
ptrdiff_t  i 
)

return an address that's i T's more than t.

Definition at line 397 of file Addressing.hpp.

template<typename T >
GlobalAddress< T > operator- ( const GlobalAddress< T > &  t,
ptrdiff_t  i 
)

return an address that's i T's less than t.

Definition at line 409 of file Addressing.hpp.

template<typename T >
ptrdiff_t operator- ( const GlobalAddress< T > &  t,
const GlobalAddress< T > &  u 
)
inline

how many T's different are t and u?

Definition at line 421 of file Addressing.hpp.

template<>
ptrdiff_t operator-< char > ( const GlobalAddress< char > &  t,
const GlobalAddress< char > &  u 
)
inline

how many bytes different are t and u?

Definition at line 429 of file Addressing.hpp.

template<typename T >
std::ostream& operator<< ( std::ostream &  o,
const GlobalAddress< T > &  ga 
)

output human-readable version of global address

Definition at line 449 of file Addressing.hpp.