FleCSI User API Version: 2.3.0
 
Loading...
Searching...
No Matches

Local concurrent operations. More...

Classes

struct  full_range
 This class computes full range size if prefix or subinterval of the range is not specified. More...
 
struct  prefix_range
 This class computes the range based on the prefix specified. More...
 
struct  sub_range
 This class computes subinterval of a range based on the starting and ending indices provided. More...
 

Macros

#define forall(it, P, name)
 A parallel range-for loop.
 
#define reduceall(it, ref, p, R, T, name)
 A parallel reduction loop.
 

Functions

template<class M , class... RR>
auto mdiota_view (const M &m, RR... rr)
 Compute the Cartesian product of several intervals of integers.
 
template<typename Policy , typename Lambda >
void parallel_for (Policy &&p, Lambda &&lambda, const std::string &name="")
 Call a function on each element of a range, potentially in parallel.
 
template<class R , class T , typename Policy , typename Lambda >
parallel_reduce (Policy &&p, Lambda &&lambda, const std::string &name="")
 Perform a reduction based on the elements of a range, potentially in parallel.
 

Detailed Description

Local concurrent operations.

If Kokkos is not available, they simply execute serially. To avoid unnecessary copies, one needs to pass a view since the ranges provided by the user are copied.

Macro Definition Documentation

◆ forall

#define forall (   it,
  P,
  name 
)

A parallel range-for loop.

Follow with a compound statement and ;. Often the elements of range (and thus the values of it) are indices for other ranges.

Parameters
itvariable name to introduce
Psized random-access range
namedebugging name, convertible to std::string

◆ reduceall

#define reduceall (   it,
  ref,
  p,
  R,
  T,
  name 
)

A parallel reduction loop.

Follow with a compound statement to form an expression. Often the elements of range (and thus the values of it) are indices for other ranges.

Parameters
itvariable name to introduce for elements
refvariable name to introduce for storing results; call it with each value participating in the reduction
psized random-access range
Rreduction operation type
Tdata type
namedebugging name, convertible to std::string
Returns
the reduced result

Function Documentation

◆ mdiota_view()

template<class M , class... RR>
auto mdiota_view ( const M &  m,
RR...  rr 
)

Compute the Cartesian product of several intervals of integers.

Parameters
mmdspan or mdcolex object
rrfull_range, prefix_range, or sub_range objects for each dimension
Returns
sized random-access range of std::array objects, each with one index of type range_index for each argument in rr

◆ parallel_for()

template<typename Policy , typename Lambda >
void parallel_for ( Policy &&  p,
Lambda &&  lambda,
const std::string &  name = "" 
)

Call a function on each element of a range, potentially in parallel.

If GPU support is available, lambda is executed there.

Parameters
psized random-access range
nameoperation name, for debugging

◆ parallel_reduce()

template<class R , class T , typename Policy , typename Lambda >
T parallel_reduce ( Policy &&  p,
Lambda &&  lambda,
const std::string &  name = "" 
)

Perform a reduction based on the elements of a range, potentially in parallel.

If GPU support is available, lambda is executed there.

Template Parameters
Rreduction operation type
Tdata type
Lambdafunction of an element of p and a function object that calls the latter with each value participating in the reduction
Parameters
psized random-access range
nameoperation name, for debugging