Brick Library 0.1
Performance-portable stencil datalayout & codegen
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
BrickDecomp< dim, BDims > Class Template Reference

Decomposition for MPI communication. More...

#include <brick-mpi.h>

Collaboration diagram for BrickDecomp< dim, BDims >:
[legend]

Classes

struct  g_region
 Record start and end of each region. More...
 

Public Member Functions

 BrickDecomp (const std::vector< unsigned > &dims, const unsigned depth, unsigned numfield=1)
 MPI decomposition for bricks.
 
void initialize (const std::vector< BitSet > &skinlist)
 initialize the decomposition using skinlist
 
void exchange (BrickStorage &bStorage)
 Minimal PUT exchange without mmap.
 
grid_access< mytype, dim, dim - 1 > operator[] (int i)
 Accessing grid indices using []
 
BrickInfo< dim > getBrickInfo ()
 Access the associated metadata.
 
 ~BrickDecomp ()
 
ExchangeView exchangeView (BrickStorage bStorage)
 Create a view for PUT exchange (mmap)
 
MultiStageExchangeView multiStageExchangeView (BrickStorage bStorage)
 Create a view for SHIFT exchange (mmap)
 
void exchange (BrickStorage bStorage, MPI_Win &win)
 Exchange using MPI_Win (don't use)
 

Public Attributes

std::vector< g_regionghost
 ghost regions record
 
std::vector< g_regionskin
 surface regions record
 
unsigned sep_pos [3]
 seperation points internal-surface-ghost
 
std::vector< BitSetskinlist
 the order of skin
 
std::vector< long > skin_size
 the size of skin
 
MPI_Comm comm
 MPI communicator it is attached to.
 
std::unordered_map< uint64_t, int > rank_map
 Mapping from neighbor to each neighbor's rank.
 

Private Types

typedef BrickDecomp< dim, BDims... > mytype
 shorthand for type of this instance
 

Private Member Functions

void _populate (BitSet region, long ref, int d, unsigned &pos)
 
void populate (BitSet owner, BitSet region, unsigned &pos)
 
long get_region_size (BitSet region)
 
void _adj_populate (long ref, unsigned d, unsigned idx, unsigned *adj)
 
void adj_populate (unsigned i, unsigned *adj)
 

Private Attributes

std::vector< unsigned > dims
 dimension of internal in bricks
 
std::vector< unsigned > t_dims
 dimension including ghosts in bricks
 
std::vector< unsigned > g_depth
 The depth of ghostzone in bricks.
 
std::vector< unsigned > stride
 stride in bricks
 
unsigned * grid
 Grid indices.
 
unsigned numfield
 Number of fields that are interleaved.
 
BrickInfo< dim > * bInfo
 Associated BrickInfo.
 

Friends

template<typename T , unsigned di, unsigned d>
struct grid_access
 Need private access for Accessing grid indices using [].
 

Detailed Description

template<unsigned dim, unsigned ... BDims>
class BrickDecomp< dim, BDims >

Decomposition for MPI communication.

Template Parameters
dimnumber of dimensions
BDimsBrick dimensions

Decomposition is setup in steps:

  1. Reserve space of the inner-inner region
  2. Surface layout of inner region
  3. Setup ghost region
  4. All extra ghost link to the end brick

Member Typedef Documentation

◆ mytype

template<unsigned dim, unsigned ... BDims>
typedef BrickDecomp<dim, BDims...> BrickDecomp< dim, BDims >::mytype
private

shorthand for type of this instance

Constructor & Destructor Documentation

◆ BrickDecomp()

template<unsigned dim, unsigned ... BDims>
BrickDecomp< dim, BDims >::BrickDecomp ( const std::vector< unsigned > &  dims,
const unsigned  depth,
unsigned  numfield = 1 
)
inline

MPI decomposition for bricks.

Parameters
dimsthe size of each dimension excluding the ghost (in elements)
depththe depths of ghost (in elements)
numfieldnumber of interleaved fields

◆ ~BrickDecomp()

template<unsigned dim, unsigned ... BDims>
BrickDecomp< dim, BDims >::~BrickDecomp ( )
inline

Member Function Documentation

◆ _adj_populate()

template<unsigned dim, unsigned ... BDims>
void BrickDecomp< dim, BDims >::_adj_populate ( long  ref,
unsigned  d,
unsigned  idx,
unsigned *  adj 
)
inlineprivate
Here is the call graph for this function:

◆ _populate()

template<unsigned dim, unsigned ... BDims>
void BrickDecomp< dim, BDims >::_populate ( BitSet  region,
long  ref,
int  d,
unsigned &  pos 
)
inlineprivate
Here is the call graph for this function:

◆ adj_populate()

template<unsigned dim, unsigned ... BDims>
void BrickDecomp< dim, BDims >::adj_populate ( unsigned  i,
unsigned *  adj 
)
inlineprivate
Here is the call graph for this function:

◆ exchange() [1/2]

template<unsigned dim, unsigned ... BDims>
void BrickDecomp< dim, BDims >::exchange ( BrickStorage bStorage)
inline

Minimal PUT exchange without mmap.

Parameters
bStoragea brick storage created using this decomposition

◆ exchange() [2/2]

template<unsigned dim, unsigned ... BDims>
void BrickDecomp< dim, BDims >::exchange ( BrickStorage  bStorage,
MPI_Win &  win 
)
inline

Exchange using MPI_Win (don't use)

Parameters
bStorage
win

◆ exchangeView()

template<unsigned dim, unsigned ... BDims>
ExchangeView BrickDecomp< dim, BDims >::exchangeView ( BrickStorage  bStorage)
inline

Create a view for PUT exchange (mmap)

Parameters
bStoragea brick storage created using this decomposition
Returns
all information needed for exchange
Here is the call graph for this function:

◆ get_region_size()

template<unsigned dim, unsigned ... BDims>
long BrickDecomp< dim, BDims >::get_region_size ( BitSet  region)
inlineprivate
Here is the call graph for this function:

◆ getBrickInfo()

template<unsigned dim, unsigned ... BDims>
BrickInfo< dim > BrickDecomp< dim, BDims >::getBrickInfo ( )
inline

Access the associated metadata.

Returns

◆ initialize()

template<unsigned dim, unsigned ... BDims>
void BrickDecomp< dim, BDims >::initialize ( const std::vector< BitSet > &  skinlist)
inline

initialize the decomposition using skinlist

Parameters
skinlistthe layout of the surface area, recommended: skin3d_good
Here is the call graph for this function:

◆ multiStageExchangeView()

template<unsigned dim, unsigned ... BDims>
MultiStageExchangeView BrickDecomp< dim, BDims >::multiStageExchangeView ( BrickStorage  bStorage)
inline

Create a view for SHIFT exchange (mmap)

Parameters
bStoragea brick storage created using this decomposition
Returns
all information needed for exchange
Here is the call graph for this function:

◆ operator[]()

template<unsigned dim, unsigned ... BDims>
grid_access< mytype, dim, dim - 1 > BrickDecomp< dim, BDims >::operator[] ( int  i)
inline

Accessing grid indices using []

Parameters
iinclude padded ghost regions
Returns

◆ populate()

template<unsigned dim, unsigned ... BDims>
void BrickDecomp< dim, BDims >::populate ( BitSet  owner,
BitSet  region,
unsigned &  pos 
)
inlineprivate
Here is the call graph for this function:

Friends And Related Function Documentation

◆ grid_access

template<unsigned dim, unsigned ... BDims>
template<typename T , unsigned di, unsigned d>
friend struct grid_access
friend

Need private access for Accessing grid indices using [].

Member Data Documentation

◆ bInfo

template<unsigned dim, unsigned ... BDims>
BrickInfo<dim>* BrickDecomp< dim, BDims >::bInfo
private

Associated BrickInfo.

◆ comm

template<unsigned dim, unsigned ... BDims>
MPI_Comm BrickDecomp< dim, BDims >::comm

MPI communicator it is attached to.

◆ dims

template<unsigned dim, unsigned ... BDims>
std::vector<unsigned> BrickDecomp< dim, BDims >::dims
private

dimension of internal in bricks

◆ g_depth

template<unsigned dim, unsigned ... BDims>
std::vector<unsigned> BrickDecomp< dim, BDims >::g_depth
private

The depth of ghostzone in bricks.

◆ ghost

template<unsigned dim, unsigned ... BDims>
std::vector<g_region> BrickDecomp< dim, BDims >::ghost

ghost regions record

◆ grid

template<unsigned dim, unsigned ... BDims>
unsigned* BrickDecomp< dim, BDims >::grid
private

Grid indices.

◆ numfield

template<unsigned dim, unsigned ... BDims>
unsigned BrickDecomp< dim, BDims >::numfield
private

Number of fields that are interleaved.

◆ rank_map

template<unsigned dim, unsigned ... BDims>
std::unordered_map<uint64_t, int> BrickDecomp< dim, BDims >::rank_map

Mapping from neighbor to each neighbor's rank.

◆ sep_pos

template<unsigned dim, unsigned ... BDims>
unsigned BrickDecomp< dim, BDims >::sep_pos[3]

seperation points internal-surface-ghost

◆ skin

template<unsigned dim, unsigned ... BDims>
std::vector<g_region> BrickDecomp< dim, BDims >::skin

surface regions record

◆ skin_size

template<unsigned dim, unsigned ... BDims>
std::vector<long> BrickDecomp< dim, BDims >::skin_size

the size of skin

◆ skinlist

template<unsigned dim, unsigned ... BDims>
std::vector<BitSet> BrickDecomp< dim, BDims >::skinlist

the order of skin

◆ stride

template<unsigned dim, unsigned ... BDims>
std::vector<unsigned> BrickDecomp< dim, BDims >::stride
private

stride in bricks

◆ t_dims

template<unsigned dim, unsigned ... BDims>
std::vector<unsigned> BrickDecomp< dim, BDims >::t_dims
private

dimension including ghosts in bricks


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