DASH
0.3.0
|
As known from classic stencil algorithms, boundaries are the outermost elements within a block that are requested by neighoring units. More...
#include <HaloMatrixWrapper.h>
Public Types | |
using | Element_t = typename MatrixT::value_type |
using | ViewSpec_t = ViewSpec< NumDimensions, pattern_index_t > |
using | GlobBoundSpec_t = GlobalBoundarySpec< NumDimensions > |
using | HaloBlock_t = HaloBlock< Element_t, Pattern_t, GlobMem_t > |
using | HaloMemory_t = HaloMemory< HaloBlock_t > |
using | HaloUpdateEnv_t = HaloUpdateEnv< HaloBlock_t, SigReady > |
using | ElementCoords_t = std::array< pattern_index_t, NumDimensions > |
using | region_index_t = internal::region_index_t |
using | stencil_dist_t = internal::spoint_value_t |
Public Member Functions | |
template<size_t NumStencilPointsFirst, typename... StencilSpecRestT> | |
HaloMatrixWrapper (MatrixT &matrix, const GlobBoundSpec_t &glob_bnd_spec, const StencilSpec< StencilPoint< NumDimensions >, NumStencilPointsFirst > &stencil_spec_first, const StencilSpecRestT &... stencil_spec) | |
Constructor that takes Matrix, a GlobalBoundarySpec and a user defined number of stencil specifications (StencilSpec) More... | |
template<typename StencilPointT = StencilPoint<NumDimensions>> | |
HaloMatrixWrapper (MatrixT &matrix, const GlobBoundSpec_t &glob_bnd_spec, stencil_dist_t dist, std::enable_if_t< std::is_integral< stencil_dist_t >::value, std::nullptr_t >=nullptr) | |
Constructor that takes Matrix and a stencil point distance to create a HaloMatrixWrapper with a full stencil with the given width. More... | |
template<typename StencilPointT = StencilPoint<NumDimensions>> | |
HaloMatrixWrapper (MatrixT &matrix, stencil_dist_t dist, std::enable_if_t< std::is_integral< stencil_dist_t >::value, std::nullptr_t >=nullptr) | |
Constructor that takes Matrix and a stencil point distance to create a HaloMatrixWrapper with a full stencil with the given width. More... | |
template<typename StencilPointT , std::size_t NumStencilPoints> | |
HaloMatrixWrapper (MatrixT &matrix, const StencilSpec< StencilPointT, NumStencilPoints > stencil_spec) | |
Constructor that takes Matrix and a user defined number of stencil specifications (StencilSpec). More... | |
template<typename... StencilSpecT, typename std::enable_if_t< sizeof...(StencilSpecT) > = 2, bool > | |
HaloMatrixWrapper (MatrixT &matrix, const StencilSpecT &... stencil_spec) | |
Constructor that takes Matrix and a user defined number of stencil specifications (StencilSpec). More... | |
const HaloBlock_t & | halo_block () |
Returns the underlying HaloBlock. More... | |
void | update () |
Initiates a blocking halo region update for all halo elements. More... | |
void | update_at (region_index_t index) |
Initiates a blocking halo region update for all halo elements within the the given region. More... | |
void | update_async () |
Initiates an asychronous halo region update for all halo elements. More... | |
void | update_async_at (region_index_t index) |
Initiates an asychronous halo region update for all halo elements within the given region. More... | |
void | wait () |
Waits until all halo updates are finished. More... | |
void | wait (region_index_t index) |
Waits until the halo updates for the given halo region is finished. More... | |
const ViewSpec_t & | view_local () const |
Returns the local ViewSpec. More... | |
HaloUpdateEnv_t & | halo_env () |
Returns the halo environment management object HaloUpdateEnv. More... | |
const HaloUpdateEnv_t & | halo_env () const |
Returns the halo environment management object HaloUpdateEnv. More... | |
MatrixT & | matrix () |
Returns the underlying NArray. More... | |
const MatrixT & | matrix () const |
Returns the underlying NArray. More... | |
template<typename FunctionT > | |
void | set_custom_halos (FunctionT f) |
Sets all global border halo elements. More... | |
Element_t * | halo_element_at_global (ElementCoords_t coords) |
Returns the halo value for a given global coordinate or nullptr if no halo element exists. More... | |
Element_t * | halo_element_at_local (ElementCoords_t coords) |
Returns the halo value for a given local coordinate or nullptr if no halo element exists. More... | |
template<typename StencilSpecT > | |
StencilOperator< HaloBlock_t, StencilSpecT > | stencil_operator (const StencilSpecT &stencil_spec) |
Crates StencilOperator for a given StencilSpec. More... | |
CoordinateAccess< HaloBlock_t > | coordinate_access () |
As known from classic stencil algorithms, boundaries are the outermost elements within a block that are requested by neighoring units.
Halos represent additional outer regions of a block that contain ghost cells with values copied from adjacent units' boundary regions.
The HaloMatrixWrapper
acts as a wrapper of the local blocks of the NArray and extends these by boundary and halo regions. The HaloMatrixWrapper also provides a function to create a StencilOperator.
Example for an outer block boundary iteration space (halo regions):
.--halo region 0 .-- halo region 1 / / .-------..-------------------------. -. | 0 1 || 0 1 2 3 4 5 6 7 | | | 2 3 || 8 9 10 11 12 13 14 15 | |-- halo width in dimension 0 '-------''-------------------------' -' .-------..-------------------------..-------. | 0 1 || || 0 1 | : ... :: local block :: ... : --- halo region 5 | 6 7 || || 6 7 | '-------''-------------------------''-------' : .-------------------------.: : | | 0 1 2 3 4 5 6 7 |'---.---' | | 8 9 10 11 12 13 14 15 | : | `-------------------------' '- halo width in dimension 1 ' \ halo region 3 '- halo region 7
Definition at line 53 of file HaloMatrixWrapper.h.
|
inline |
Constructor that takes Matrix, a GlobalBoundarySpec and a user defined number of stencil specifications (StencilSpec)
Definition at line 87 of file HaloMatrixWrapper.h.
|
inline |
Constructor that takes Matrix and a stencil point distance to create a HaloMatrixWrapper with a full stencil with the given width.
The GlobalBoundarySpec is set to default.
Definition at line 107 of file HaloMatrixWrapper.h.
|
inline |
Constructor that takes Matrix and a stencil point distance to create a HaloMatrixWrapper with a full stencil with the given width.
The GlobalBoundarySpec is set to default.
Definition at line 119 of file HaloMatrixWrapper.h.
|
inline |
Constructor that takes Matrix and a user defined number of stencil specifications (StencilSpec).
The GlobalBoundarySpec is set to default.
Definition at line 129 of file HaloMatrixWrapper.h.
|
inline |
Constructor that takes Matrix and a user defined number of stencil specifications (StencilSpec).
The GlobalBoundarySpec is set to default.
Definition at line 138 of file HaloMatrixWrapper.h.
|
inline |
Returns the underlying HaloBlock.
Definition at line 146 of file HaloMatrixWrapper.h.
|
inline |
Returns the halo value for a given global coordinate or nullptr if no halo element exists.
This also means that only a unit connected to the given coordinate will return a halo value. All others will return nullptr.
Definition at line 285 of file HaloMatrixWrapper.h.
|
inline |
Returns the halo value for a given local coordinate or nullptr if no halo element exists.
Definition at line 298 of file HaloMatrixWrapper.h.
|
inline |
Returns the halo environment management object HaloUpdateEnv.
Definition at line 203 of file HaloMatrixWrapper.h.
|
inline |
Returns the halo environment management object HaloUpdateEnv.
Definition at line 208 of file HaloMatrixWrapper.h.
|
inline |
Returns the underlying NArray.
Definition at line 213 of file HaloMatrixWrapper.h.
|
inline |
Returns the underlying NArray.
Definition at line 218 of file HaloMatrixWrapper.h.
|
inline |
Sets all global border halo elements.
set_custom_halos calls FuntionT with all global coordinates of type: std::array<dash::default_index_t,Number Dimensions>.
Every unit is called only with the related global coordinates. E.g.:
............. : Border | <- coordinates for example: : Unit 0 | (-1,-1),(0,-1), (-2,5) : .--------..--------. : | || | : | Unit 0 || Unit 1 | : | || | '- :--------::--------: | || | | Unit 2 || Unit 3 | | || | '--------''--------'
Definition at line 243 of file HaloMatrixWrapper.h.
References dash::halo::HaloBlock< ElementT, PatternT, GlobMemT >::boundary_regions(), dash::distance(), dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::halo_memory(), dash::Matrix< ElementT, NumDimensions, IndexT, PatternT, LocalMemSpaceT >::pattern(), and dash::halo::HaloMemory< HaloBlockT >::range_at().
|
inline |
Crates StencilOperator for a given StencilSpec.
Asserts whether the StencilSpec fits in the provided halo regions.
Definition at line 307 of file HaloMatrixWrapper.h.
References dash::halo::HaloSpec< NumDimensions >::extent(), dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::halo_memory(), dash::index(), dash::halo::HaloBlock< ElementT, PatternT, GlobMemT >::index_at(), dash::Matrix< ElementT, NumDimensions, IndexT, PatternT, LocalMemSpaceT >::lbegin(), dash::halo::HaloMemory< HaloBlockT >::range_at(), dash::halo::HaloSpec< NumDimensions >::spec(), and dash::halo::StencilSpec< StencilPointT, NumStencilPoints >::specs().
|
inline |
Initiates a blocking halo region update for all halo elements.
Definition at line 151 of file HaloMatrixWrapper.h.
References dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::update().
|
inline |
Initiates an asychronous halo region update for all halo elements.
Definition at line 166 of file HaloMatrixWrapper.h.
References dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::update_async().
|
inline |
Initiates an asychronous halo region update for all halo elements within the given region.
Definition at line 174 of file HaloMatrixWrapper.h.
References dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::update_async_at().
|
inline |
Initiates a blocking halo region update for all halo elements within the the given region.
Definition at line 159 of file HaloMatrixWrapper.h.
References dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::update_at().
|
inline |
Returns the local ViewSpec.
Definition at line 198 of file HaloMatrixWrapper.h.
|
inline |
Waits until all halo updates are finished.
Only useful for asynchronous halo updates.
Definition at line 182 of file HaloMatrixWrapper.h.
References dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::wait().
|
inline |
Waits until the halo updates for the given halo region is finished.
Only useful for asynchronous halo updates.
Definition at line 190 of file HaloMatrixWrapper.h.
References dash::halo::HaloUpdateEnv< HaloBlockT, SigReady >::wait().