YAKL
Public Member Functions | List of all members
yakl::c::Bounds< N, false > Class Template Reference

Describes a set of C-style tightly-nested loops where at least one loop has a lower bound other than 0 or a stride other than 1. More...

#include <YAKL_Bounds_c.h>

Public Member Functions

YAKL_INLINE Bounds (LBnd const &b0, LBnd const &b1=LBnd(), LBnd const &b2=LBnd(), LBnd const &b3=LBnd(), LBnd const &b4=LBnd(), LBnd const &b5=LBnd(), LBnd const &b6=LBnd(), LBnd const &b7=LBnd())
 Declares the bounds for each loop for a set of 1 to 8 tightly-nested loops. More...
 
YAKL_INLINE int dim (int i) const
 Get the total number of iterations for this loop index. More...
 
YAKL_INLINE int lbound (int i) const
 Get the lower loop bound for this loop index. More...
 
YAKL_INLINE int stride (int i) const
 Get the stride for this loop index. More...
 
YAKL_INLINE void unpackIndices (index_t iGlob, int indices[N]) const
 Unpack a global index into N loop indices given bounds and strides. More...
 

Detailed Description

template<int N>
class yakl::c::Bounds< N, false >

Describes a set of C-style tightly-nested loops where at least one loop has a lower bound other than 0 or a stride other than 1.

Also contains functions to unpack indices from a single global index given the loop bounds and strides. Order is always left-most loop is the slowest varying, and right-most loop is the fastest varying.

Parameters
NThe nuber of tightly nested loops being described

Constructor & Destructor Documentation

◆ Bounds()

template<int N>
YAKL_INLINE yakl::c::Bounds< N, false >::Bounds ( LBnd const &  b0,
LBnd const &  b1 = LBnd(),
LBnd const &  b2 = LBnd(),
LBnd const &  b3 = LBnd(),
LBnd const &  b4 = LBnd(),
LBnd const &  b5 = LBnd(),
LBnd const &  b6 = LBnd(),
LBnd const &  b7 = LBnd() 
)
inline

Declares the bounds for each loop for a set of 1 to 8 tightly-nested loops.

Order is always left-most loop is the slowest varying, and right-most loop is the fastest varying. Number of loop bounds passed to the constructor must match the number of loops, N. Recall only positive strides are allowed because requiring a negative stride implies the loop order matters, which means your kernel is not trivially parallel, and yakl::c::parallel_for should not be used.

Each parameter accepts either:

  • A single integer, for which lower bound defaults to 0, and stride defaults to 1
  • An initializer list with two entries: {lower_bound,upper_bound} (inclusive), and stride defaults to 1
  • An initializer list with three entries: {lower,upper,stride}, where stride is positive

Member Function Documentation

◆ dim()

template<int N>
YAKL_INLINE int yakl::c::Bounds< N, false >::dim ( int  i) const
inline

Get the total number of iterations for this loop index.

◆ lbound()

template<int N>
YAKL_INLINE int yakl::c::Bounds< N, false >::lbound ( int  i) const
inline

Get the lower loop bound for this loop index.

◆ stride()

template<int N>
YAKL_INLINE int yakl::c::Bounds< N, false >::stride ( int  i) const
inline

Get the stride for this loop index.

◆ unpackIndices()

template<int N>
YAKL_INLINE void yakl::c::Bounds< N, false >::unpackIndices ( index_t  iGlob,
int  indices[N] 
) const
inline

Unpack a global index into N loop indices given bounds and strides.


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