Peano
Loading...
Searching...
No Matches
Loop.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define parallelForWithSchedulerInstructions(counter, max, loopParallelism)
 
#define endParallelFor
 
#define parallelDforWithSchedulerInstructions2d(counter, max, loopParallelism)
 
#define parallelDforWithSchedulerInstructions3d(counter, max, loopParallelism)
 
#define parallelDforWithSchedulerInstructions4d(counter, max, loopParallelism)
 
#define parallelDforWithSchedulerInstructions5d(counter, max, loopParallelism)
 
#define endParallelDfor
 
#define simtForWithSchedulerInstructions(counter, max, loopParallelism)    parallelForWithSchedulerInstructions(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))
 Brackets here are important.
 
#define endSimtFor    endParallelFor
 
#define simtDforWithSchedulerInstructions2d(counter, max, loopParallelism)    parallelDforWithSchedulerInstructions2d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))
 
#define simtDforWithSchedulerInstructions3d(counter, max, loopParallelism)    parallelDforWithSchedulerInstructions3d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))
 
#define simtDforWithSchedulerInstructions4d(counter, max, loopParallelism)    parallelDforWithSchedulerInstructions4d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))
 
#define simtDforWithSchedulerInstructions5d(counter, max, loopParallelism)    parallelDforWithSchedulerInstructions5d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))
 
#define endSimtDfor    endParallelDfor
 

Macro Definition Documentation

◆ endParallelDfor

#define endParallelDfor
Value:
} \
} \
); \
}
  • The first (curly) bracket closes the nested for loops within the functor. We need brackets here - even if users decide to add only one line - as the loop body defines the counter vector.
  • The second (curly) bracket closes the functor handed into the blocked_range.
  • The third (round) bracket closes the parallel_for, which is a mere function call. So it followed by a semicolon.
  • The fourth (curly) bracket closes the whole block into which the for loop is embedded. This block not only hosts the loop, but also the construction of the max vector and the actual loop ranges.

Definition at line 102 of file Loop.h.

◆ endParallelFor

#define endParallelFor
Value:
} \
);
  • the first curly bracket closes the functor
  • the second round bracket closes the tbb::parallel_for call

Definition at line 19 of file Loop.h.

◆ endSimtDfor

#define endSimtDfor    endParallelDfor

Definition at line 130 of file Loop.h.

◆ endSimtFor

#define endSimtFor    endParallelFor

Definition at line 115 of file Loop.h.

◆ parallelDforWithSchedulerInstructions2d

#define parallelDforWithSchedulerInstructions2d ( counter,
max,
loopParallelism )
Value:
{ \
tarch::la::Vector<2,int> counter##Max(max); \
int counter##Size[] = {counter##Max(0),counter##Max(1)}; \
tbb::parallel_for( \
tbb::blocked_nd_range<int,2>( \
counter##Size, \
loopParallelism==::peano4::utils::LoopPlacement::Serial ? counter##Max(0) : 1 \
), \
[&]( const tbb::blocked_nd_range<int,2>& range ) { \
for( int counter##1 = range.dim(0).begin(); counter##1 < range.dim(0).end(); counter##1++ ) \
for( int counter##2 = range.dim(1).begin(); counter##2 < range.dim(1).end(); counter##2++ ) { \
tarch::la::Vector<2, int> counter = { counter##1, counter##2 };
I've written an API to IIT, but I'm not currently using.
Simple vector class.
Definition Vector.h:159

Definition at line 24 of file Loop.h.

◆ parallelDforWithSchedulerInstructions3d

#define parallelDforWithSchedulerInstructions3d ( counter,
max,
loopParallelism )
Value:
{ \
tarch::la::Vector<3,int> counter##Max(max); \
int counter##Size[] = {counter##Max(0),counter##Max(1),counter##Max(2)}; \
tbb::parallel_for( \
tbb::blocked_nd_range<int,3>( \
counter##Size,\
loopParallelism==::peano4::utils::LoopPlacement::Serial ? counter##Max(0) : 1 \
), \
[&]( const tbb::blocked_nd_range<int,3>& range ) { \
for( int counter##1 = range.dim(0).begin(); counter##1 < range.dim(0).end(); counter##1++ ) \
for( int counter##2 = range.dim(1).begin(); counter##2 < range.dim(1).end(); counter##2++ ) \
for( int counter##3 = range.dim(2).begin(); counter##3 < range.dim(2).end(); counter##3++ ) {\
tarch::la::Vector<3, int> counter = { counter##1, counter##2, counter##3 };

Definition at line 39 of file Loop.h.

◆ parallelDforWithSchedulerInstructions4d

#define parallelDforWithSchedulerInstructions4d ( counter,
max,
loopParallelism )
Value:
{ \
tarch::la::Vector<4,int> counter##Max(max); \
int counter##Size[] = {counter##Max(0),counter##Max(1),counter##Max(2),counter##Max(3)}; \
tbb::parallel_for( \
tbb::blocked_nd_range<int,4>( \
counter##Size,\
loopParallelism==::peano4::utils::LoopPlacement::Serial ? counter##Max(0) : 1 \
), \
[&]( const tbb::blocked_nd_range<int,4>& range ) { \
for( int counter##1 = range.dim(0).begin(); counter##1 < range.dim(0).end(); counter##1++ ) \
for( int counter##2 = range.dim(1).begin(); counter##2 < range.dim(1).end(); counter##2++ ) \
for( int counter##3 = range.dim(2).begin(); counter##3 < range.dim(2).end(); counter##3++ ) \
for( int counter##4 = range.dim(3).begin(); counter##4 < range.dim(3).end(); counter##4++ ) { \
tarch::la::Vector<4, int> counter = { counter##1, counter##2, counter##3, counter##4 };

Definition at line 55 of file Loop.h.

◆ parallelDforWithSchedulerInstructions5d

#define parallelDforWithSchedulerInstructions5d ( counter,
max,
loopParallelism )
Value:
{ \
tarch::la::Vector<5,int> counter##Max(max); \
int counter##Size[] = {counter##Max(0),counter##Max(1),counter##Max(2),counter##Max(3),counter##Max(4)}; \
tbb::parallel_for( \
tbb::blocked_nd_range<int,5>( \
counter##Size,\
loopParallelism==::peano4::utils::LoopPlacement::Serial ? counter##Max(0) : 1 \
), \
[&]( const tbb::blocked_nd_range<int,5>& range ) { \
for( int counter##1 = range.dim(0).begin(); counter##1 < range.dim(0).end(); counter##1++ ) \
for( int counter##2 = range.dim(1).begin(); counter##2 < range.dim(1).end(); counter##2++ ) \
for( int counter##3 = range.dim(2).begin(); counter##3 < range.dim(2).end(); counter##3++ ) \
for( int counter##4 = range.dim(3).begin(); counter##4 < range.dim(3).end(); counter##4++ ) \
for( int counter##5 = range.dim(4).begin(); counter##5 < range.dim(4).end(); counter##5++ ) { \
tarch::la::Vector<5, int> counter = { counter##1, counter##2, counter##3, counter##4, counter##5 };

Definition at line 72 of file Loop.h.

◆ parallelForWithSchedulerInstructions

#define parallelForWithSchedulerInstructions ( counter,
max,
loopParallelism )
Value:
tbb::parallel_for( \
tbb::blocked_range<int>( \
0, max, loopParallelism==::peano4::utils::LoopPlacement::Serial ? max : 1 \
), \
[&]( const tbb::blocked_range<int>& range ) { \
for( int counter = range.begin(); counter < range.end(); counter++ ) \

Definition at line 6 of file Loop.h.

◆ simtDforWithSchedulerInstructions2d

#define simtDforWithSchedulerInstructions2d ( counter,
max,
loopParallelism )    parallelDforWithSchedulerInstructions2d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))

Definition at line 118 of file Loop.h.

◆ simtDforWithSchedulerInstructions3d

#define simtDforWithSchedulerInstructions3d ( counter,
max,
loopParallelism )    parallelDforWithSchedulerInstructions3d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))

Definition at line 121 of file Loop.h.

◆ simtDforWithSchedulerInstructions4d

#define simtDforWithSchedulerInstructions4d ( counter,
max,
loopParallelism )    parallelDforWithSchedulerInstructions4d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))

Definition at line 124 of file Loop.h.

◆ simtDforWithSchedulerInstructions5d

#define simtDforWithSchedulerInstructions5d ( counter,
max,
loopParallelism )    parallelDforWithSchedulerInstructions5d(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))

Definition at line 127 of file Loop.h.

◆ simtForWithSchedulerInstructions

#define simtForWithSchedulerInstructions ( counter,
max,
loopParallelism )    parallelForWithSchedulerInstructions(counter, max, (loopParallelism==::peano4::utils::LoopPlacement::Nested ? ::peano4::utils::LoopPlacement::Nested : ::peano4::utils::LoopPlacement::Serial))

Brackets here are important.

Otherwise macro resolution will fail.

Definition at line 112 of file Loop.h.