|
RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
|
Segment class representing an arbitrary collection of indices. More...
#include <ListSegment.hpp>
Segment class representing an arbitrary collection of indices.
| StorageT | underlying data type for the segment indices (required) |
A TypedRangeSegment models an Iterable interface:
begin() – returns a StorageT* end() – returns a StorageT* size() – returns size of the Segment iteration space (RAJA::Index_type)
NOTE: TypedListSegment supports the option for the segment to own the its index data or simply use the index array passed to the constructor. Owning the index data is the default; an array is created in the memory space specified by the camp resource object and the values are copied from the input array to that. Ownership of the indices is determined by an optional ownership enum value passed to the constructor.
Usage:
A common C-style loop traversal pattern using an indirection array would be:
* const T* indices = ...;
* for (T i = begin; i < end; ++i) {
* // loop body -- use indices[i] as index value
* }
* A TypedListSegment would be used with a RAJA forall execution template as:
* camp::resources::Resource resource{ camp resource type };
* TypedListSegment<T> listseg(indices, length, resource);
*
* forall<exec_pol>(listseg, [=] (T i) {
* // loop body -- use i as index value
* });
*