DotMP
Package Functions | Properties | Private Member Functions | Private Attributes | List of all members
DotMP.ForAction< T > Class Template Reference

Class encapsulating all of the possible callbacks in a Parallel.For-style loop. This includes Parallel.For, Parallel.ForReduction<T>, Parallel.ForCollapse, and Parallel.ForReductionCollapse<T>. More...

Package Functions

 ForAction (Action< int > action)
 Constructor for regular for loops with 1 variable. More...
 
 ForAction (ActionRef< T > action)
 Constructor for reduction for loops with 1 variable. More...
 
 ForAction (Action< int, int > action,(int, int)[] ranges)
 Constructor for collapsed for loops with 2 variables. More...
 
 ForAction (Action< int, int, int > action,(int, int)[] ranges)
 Constructor for collapsed for loops with 3 variables. More...
 
 ForAction (Action< int, int, int, int > action,(int, int)[] ranges)
 Constructor for collapsed for loops with 4 variables. More...
 
 ForAction (Action< int[]> action,(int, int)[] ranges)
 Constructor for collapsed for loops with unbounded variables. More...
 
 ForAction (ActionRef2< T > action,(int, int)[] ranges)
 Constructor for reduction collapsed for loops with 2 variables. More...
 
 ForAction (ActionRef3< T > action,(int, int)[] ranges)
 Constructor for reduction collapsed for loops with 3 variables. More...
 
 ForAction (ActionRef4< T > action,(int, int)[] ranges)
 Constructor for reduction collapsed for loops with 4 variables. More...
 
 ForAction (ActionRefN< T > action,(int, int)[] ranges)
 Constructor for reduction collapsed for loops with unbounded variables. More...
 
void PerformLoop (ref int curr_iter, int start, int end, ref T local)
 Executes a chunk using the action selected by ForAction.selector More...
 

Properties

ValueTuple< int, int >[] ranges [get, set]
 Represents the ranges of collapsed loops for unflattening, ensuring that loops do not have too many iterations. More...
 
bool IsCollapse [get, private set]
 Tracks if the action represents a collapsed for loop. More...
 
bool IsReduction [get, private set]
 Tracks if the action represents a reduction loop. More...
 

Private Member Functions

void ComputeIndices2 (int curr_iter, int start1, int start2, int diff2, out int i, out int j)
 Computes the indices for collapsed loops with 2 indices. More...
 
void ComputeIndices3 (int curr_iter, int start1, int start2, int start3, int diff2, int diff3, out int i, out int j, out int k)
 Computes the indices for collapsed loops with 3 indices. More...
 
void ComputeIndicesN (int curr_iter, int[] indices)
 Computes the indices for collapsed loops with 4 or more indices. More...
 

Private Attributes

Action< int > omp_fn
 Represents an action that can be selected via ActionSelector.Regular More...
 
ActionRef< T > omp_red
 Represents an action that can be selected via ActionSelector.Reduction More...
 
Action< int, int > omp_col_2
 Represents an action that can be selected via ActionSelector.Collapse2 More...
 
Action< int, int, int > omp_col_3
 Represents an action that can be selected via ActionSelector.Collapse3 More...
 
Action< int, int, int, int > omp_col_4
 Represents an action that can be selected via ActionSelector.Collapse4 More...
 
Action< int[]> omp_col_n
 Represents an action that can be selected via ActionSelector.CollapseN More...
 
ActionRef2< T > omp_red_col_2
 Represents an action that can be selected via ActionSelector.ReductionCollapse2 More...
 
ActionRef3< T > omp_red_col_3
 Represents an action that can be selected via ActionSelector.ReductionCollapse3 More...
 
ActionRef4< T > omp_red_col_4
 Represents an action that can be selected via ActionSelector.ReductionCollapse4 More...
 
ActionRefN< T > omp_red_col_n
 Represents an action that can be selected via ActionSelector.ReductionCollapseN More...
 
ActionSelector selector
 Holds the data regarding which action to select. More...
 
ValueTuple< int, int >[] ranges_prv
 Represents the ranges of collapsed loops for future unflattening. More...
 
int[] indices
 Array representing the starting indices. More...
 
int[] end_indices
 Array representing the ending indices. More...
 
int[] diffs
 Array which represents the length of collapsed loops in each dimension. More...
 

Detailed Description

Class encapsulating all of the possible callbacks in a Parallel.For-style loop. This includes Parallel.For, Parallel.ForReduction<T>, Parallel.ForCollapse, and Parallel.ForReductionCollapse<T>.

Template Parameters
TThe type of the reduction callback.

Constructor & Destructor Documentation

◆ ForAction() [1/10]

DotMP.ForAction< T >.ForAction ( Action< int >  action)
inlinepackage

Constructor for regular for loops with 1 variable.

Parameters
actionThe action to run.

◆ ForAction() [2/10]

DotMP.ForAction< T >.ForAction ( ActionRef< T >  action)
inlinepackage

Constructor for reduction for loops with 1 variable.

Parameters
actionThe action to run.

◆ ForAction() [3/10]

DotMP.ForAction< T >.ForAction ( Action< int, int >  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for collapsed for loops with 2 variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

◆ ForAction() [4/10]

DotMP.ForAction< T >.ForAction ( Action< int, int, int >  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for collapsed for loops with 3 variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

◆ ForAction() [5/10]

DotMP.ForAction< T >.ForAction ( Action< int, int, int, int >  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for collapsed for loops with 4 variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

◆ ForAction() [6/10]

DotMP.ForAction< T >.ForAction ( Action< int[]>  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for collapsed for loops with unbounded variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

◆ ForAction() [7/10]

DotMP.ForAction< T >.ForAction ( ActionRef2< T >  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for reduction collapsed for loops with 2 variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

◆ ForAction() [8/10]

DotMP.ForAction< T >.ForAction ( ActionRef3< T >  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for reduction collapsed for loops with 3 variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

◆ ForAction() [9/10]

DotMP.ForAction< T >.ForAction ( ActionRef4< T >  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for reduction collapsed for loops with 4 variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

◆ ForAction() [10/10]

DotMP.ForAction< T >.ForAction ( ActionRefN< T >  action,
(int, int)[]  ranges 
)
inlinepackage

Constructor for reduction collapsed for loops with unbounded variables.

Parameters
actionThe action to run.
rangesThe ranges of the collapsed loop.

Member Function Documentation

◆ ComputeIndices2()

void DotMP.ForAction< T >.ComputeIndices2 ( int  curr_iter,
int  start1,
int  start2,
int  diff2,
out int  i,
out int  j 
)
inlineprivate

Computes the indices for collapsed loops with 2 indices.

Parameters
curr_iterThe current iteration to unflatten.
start1The start of the first pair of indices.
start2The start of the second pair of indices.
diff2The divisor to divrem by.
iThe first computed index.
jThe second computed index.

◆ ComputeIndices3()

void DotMP.ForAction< T >.ComputeIndices3 ( int  curr_iter,
int  start1,
int  start2,
int  start3,
int  diff2,
int  diff3,
out int  i,
out int  j,
out int  k 
)
inlineprivate

Computes the indices for collapsed loops with 3 indices.

Parameters
curr_iterThe current iteration to unflatten.
start1The start of the first pair of indices.
start2The start of the second pair of indices.
start3The start of the third pair of indices.
diff2The difference in the second pair of indices.
diff3The difference in the third pair of indices.
iThe first computed index.
jThe second computed index.
kThe third computed index.

◆ ComputeIndicesN()

void DotMP.ForAction< T >.ComputeIndicesN ( int  curr_iter,
int[]  indices 
)
inlineprivate

Computes the indices for collapsed loops with 4 or more indices.

Parameters
curr_iterThe current iteration to unflatten.
indicesThe array to store indices in.

◆ PerformLoop()

void DotMP.ForAction< T >.PerformLoop ( ref int  curr_iter,
int  start,
int  end,
ref T  local 
)
inlinepackage

Executes a chunk using the action selected by ForAction.selector

Parameters
curr_iterA reference to the current iteration.
startThe start of the chunk, inclusive.
endThe end of the chunk, exclusive.
localThe local variable to reduce to.

Member Data Documentation

◆ diffs

int [] DotMP.ForAction< T >.diffs
private

Array which represents the length of collapsed loops in each dimension.

◆ end_indices

int [] DotMP.ForAction< T >.end_indices
private

Array representing the ending indices.

◆ indices

int [] DotMP.ForAction< T >.indices
private

Array representing the starting indices.

◆ omp_col_2

Action<int, int> DotMP.ForAction< T >.omp_col_2
private

Represents an action that can be selected via ActionSelector.Collapse2

◆ omp_col_3

Action<int, int, int> DotMP.ForAction< T >.omp_col_3
private

Represents an action that can be selected via ActionSelector.Collapse3

◆ omp_col_4

Action<int, int, int, int> DotMP.ForAction< T >.omp_col_4
private

Represents an action that can be selected via ActionSelector.Collapse4

◆ omp_col_n

Action<int[]> DotMP.ForAction< T >.omp_col_n
private

Represents an action that can be selected via ActionSelector.CollapseN

◆ omp_fn

Action<int> DotMP.ForAction< T >.omp_fn
private

Represents an action that can be selected via ActionSelector.Regular

◆ omp_red

ActionRef<T> DotMP.ForAction< T >.omp_red
private

Represents an action that can be selected via ActionSelector.Reduction

◆ omp_red_col_2

ActionRef2<T> DotMP.ForAction< T >.omp_red_col_2
private

Represents an action that can be selected via ActionSelector.ReductionCollapse2

◆ omp_red_col_3

ActionRef3<T> DotMP.ForAction< T >.omp_red_col_3
private

Represents an action that can be selected via ActionSelector.ReductionCollapse3

◆ omp_red_col_4

ActionRef4<T> DotMP.ForAction< T >.omp_red_col_4
private

Represents an action that can be selected via ActionSelector.ReductionCollapse4

◆ omp_red_col_n

ActionRefN<T> DotMP.ForAction< T >.omp_red_col_n
private

Represents an action that can be selected via ActionSelector.ReductionCollapseN

◆ ranges_prv

ValueTuple<int, int> [] DotMP.ForAction< T >.ranges_prv
private

Represents the ranges of collapsed loops for future unflattening.

◆ selector

ActionSelector DotMP.ForAction< T >.selector
private

Holds the data regarding which action to select.

Property Documentation

◆ IsCollapse

bool DotMP.ForAction< T >.IsCollapse
getprivate setpackage

Tracks if the action represents a collapsed for loop.

◆ IsReduction

bool DotMP.ForAction< T >.IsReduction
getprivate setpackage

Tracks if the action represents a reduction loop.

◆ ranges

ValueTuple<int, int> [] DotMP.ForAction< T >.ranges
getsetprivate

Represents the ranges of collapsed loops for unflattening, ensuring that loops do not have too many iterations.


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