Peano
Loading...
Searching...
No Matches
Loop.h File Reference

Go to the source code of this file.

Macros

#define parallelForWithSchedulerInstructions(counter, max, loopParallelism)    for( int counter = 0; counter < max; counter++ ) {
 Parallel for.
 
#define endParallelFor   }
 
#define parallelDforWithDynamicScheduling2d(counter, max, loopParallelism)
 
#define parallelDforWithDynamicScheduling3d(counter, max, loopParallelism)
 
#define parallelDforWithDynamicScheduling4d(counter, max, loopParallelism)
 
#define parallelDforWithDynamicScheduling5d(counter, max, loopParallelism)
 
#define endParallelDfor   }}
 
#define simtForWithSchedulerInstructions(counter, max, loopParallelism)
 
#define endSimtFor
 
#define simtDforWithDynamicScheduling2d(counter, max, loopParallelism)
 We need an additional opening bracket here, as we need one more nested scope for 4d and 5d.
 
#define simtDforWithDynamicScheduling3d(counter, max, loopParallelism)
 
#define simtDforWithDynamicScheduling4d(counter, max, loopParallelism)
 
#define simtDforWithDynamicScheduling5d(counter, max, loopParallelism)
 
#define endSimtDfor
 

Macro Definition Documentation

◆ endParallelDfor

#define endParallelDfor   }}

Definition at line 54 of file Loop.h.

◆ endParallelFor

#define endParallelFor   }

Definition at line 17 of file Loop.h.

◆ endSimtDfor

#define endSimtDfor
Value:
}} \
); \
}).wait(); \
}
void wait(MPI_Request &request, const std::string &fullQualifiedClassName, const std::string &functionName)
Wrapper around MPI_Wait.
  • The first two (curly) brackets close the functor and the for loop within this functor (4d and 5d). For d=2 and d=3, the functor is using two opening brackets.
  • The third (round) bracket closes the parallel_for, which is a mere function call. So it followed by a semicolon.
  • The fourth combination of a curly plus round bracket close the submit(). This one is followed by a wait().
  • We have another curly bracket here as we also embed the counter##Max thing into a scope. If we have two loops with the same counter name, we don't want to run into a duplicate variable error.

Definition at line 139 of file Loop.h.

◆ endSimtFor

#define endSimtFor
Value:
} \
); \
}).wait();
  • The first (curly) bracket closes functor of the loop body.
  • The second (round) bracket closes the parallel_for, which is a mere function call. So it is followed by a semicolon.
  • The third combination of a curly plus round bracket close the submit(). It also comprises the wait().

Definition at line 72 of file Loop.h.

◆ parallelDforWithDynamicScheduling2d

#define parallelDforWithDynamicScheduling2d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<2,int> counter##Max(max); \
for( int counter##0 = 0; counter##0 < counter##Max(0); counter##0++ ) \
for( int counter##1 = 0; counter##1 < counter##Max(1); counter##1++ ) { \
tarch::la::Vector<2, int> counter = { counter##0, counter##1 };
Simple vector class.
Definition Vector.h:159

Definition at line 20 of file Loop.h.

◆ parallelDforWithDynamicScheduling3d

#define parallelDforWithDynamicScheduling3d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<3,int> counter##Max(max); \
for( int counter##0 = 0; counter##0 < counter##Max(0); counter##0++ ) \
for( int counter##1 = 0; counter##1 < counter##Max(1); counter##1++ ) \
for( int counter##2 = 0; counter##2 < counter##Max(2); counter##2++ ) { \
tarch::la::Vector<3, int> counter = { counter##0, counter##1, counter##2 };

Definition at line 27 of file Loop.h.

◆ parallelDforWithDynamicScheduling4d

#define parallelDforWithDynamicScheduling4d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<4,int> counter##Max(max); \
for( int counter##0 = 0; counter##0 < counter##Max(0); counter##0++ ) \
for( int counter##1 = 0; counter##1 < counter##Max(1); counter##1++ ) \
for( int counter##2 = 0; counter##2 < counter##Max(2); counter##2++ ) \
for( int counter##3 = 0; counter##3 < counter##Max(3); counter##3++ ) { \
tarch::la::Vector<4, int> counter = { counter##0, counter##1, counter##2, counter##3 };

Definition at line 35 of file Loop.h.

◆ parallelDforWithDynamicScheduling5d

#define parallelDforWithDynamicScheduling5d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<5,int> counter##Max(max); \
for( int counter##0 = 0; counter##0 < counter##Max(0); counter##0++ ) \
for( int counter##1 = 0; counter##1 < counter##Max(1); counter##1++ ) \
for( int counter##2 = 0; counter##2 < counter##Max(2); counter##2++ ) \
for( int counter##3 = 0; counter##3 < counter##Max(3); counter##3++ ) \
for( int counter##4 = 0; counter##4 < counter##Max(4); counter##4++ ) { \
tarch::la::Vector<5, int> counter = { counter##0, counter##1, counter##2, counter##3, counter##4 };

Definition at line 44 of file Loop.h.

◆ parallelForWithSchedulerInstructions

#define parallelForWithSchedulerInstructions (   counter,
  max,
  loopParallelism 
)     for( int counter = 0; counter < max; counter++ ) {

Parallel for.

SYCL does not support a classic parallel for which can host virtual function calls, semaphores, etc. Therefore, this is maps onto a plain for.

Definition at line 14 of file Loop.h.

◆ simtDforWithDynamicScheduling2d

#define simtDforWithDynamicScheduling2d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<2,int> counter##Max(tarch::la::expandOrSlice<2>(max)); \
tarch::multicore::getHostSYCLQueue().submit([&](auto& handle) { \
handle.parallel_for( \
::sycl::range<2>{static_cast<std::size_t>(counter##Max(0)),static_cast<std::size_t>(counter##Max(1))}, \
[=](::sycl::id<2> counter##Iterator) {{ \
tarch::la::Vector<2, int> counter = { static_cast<int>(counter##Iterator[0]), static_cast<int>(counter##Iterator[1]) };

We need an additional opening bracket here, as we need one more nested scope for 4d and 5d.

See also
simtDforWithDynamicScheduling4d
simtDforWithDynamicScheduling5d

Definition at line 84 of file Loop.h.

◆ simtDforWithDynamicScheduling3d

#define simtDforWithDynamicScheduling3d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<3,int> counter##Max(tarch::la::expandOrSlice<3>(max)); \
tarch::multicore::getHostSYCLQueue().submit([&](auto& handle) { \
handle.parallel_for( \
::sycl::range<3>{static_cast<std::size_t>(counter##Max(0)),static_cast<std::size_t>(counter##Max(1)),static_cast<std::size_t>(counter##Max(2))}, \
[=](::sycl::id<3> counter##Iterator) {{ \
tarch::la::Vector<3, int> counter = { static_cast<int>(counter##Iterator[0]), static_cast<int>(counter##Iterator[1]), static_cast<int>(counter##Iterator[2]) };

Definition at line 94 of file Loop.h.

◆ simtDforWithDynamicScheduling4d

#define simtDforWithDynamicScheduling4d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<4,int> counter##Max(tarch::la::expandOrSlice<4>(max)); \
tarch::multicore::getHostSYCLQueue().submit([&](auto& handle) { \
handle.parallel_for( \
::sycl::range<3>{static_cast<std::size_t>(counter##Max(0)),static_cast<std::size_t>(counter##Max(1)),static_cast<std::size_t>(counter##Max(2))}, \
[=](::sycl::id<3> counter##Iterator) { \
for (int counter##Iterator3 = 0; counter##Iterator3<counter##Max(3); counter##Iterator3++ ) { \
tarch::la::Vector<4, int> counter = { static_cast<int>(counter##Iterator[0]), static_cast<int>(counter##Iterator[1]), static_cast<int>(counter##Iterator[2]), static_cast<int>(counter##Iterator3) };

Definition at line 104 of file Loop.h.

◆ simtDforWithDynamicScheduling5d

#define simtDforWithDynamicScheduling5d (   counter,
  max,
  loopParallelism 
)
Value:
{ \
tarch::la::Vector<5,int> counter##Max(tarch::la::expandOrSlice<5>(max)); \
tarch::multicore::getHostSYCLQueue().submit([&](auto& handle) { \
handle.parallel_for( \
::sycl::range<3>{static_cast<std::size_t>(counter##Max(0)),static_cast<std::size_t>(counter##Max(1)),static_cast<std::size_t>(counter##Max(2))}, \
[=](::sycl::id<3> counter##Iterator) { \
for (int counter##Iterator3 = 0; counter##Iterator3<counter##Max(3); counter##Iterator3++ ) \
for (int counter##Iterator4 = 0; counter##Iterator4<counter##Max(4); counter##Iterator4++ ) { \
tarch::la::Vector<5, int> counter = { static_cast<int>(counter##Iterator[0]), static_cast<int>(counter##Iterator[1]), static_cast<int>(counter##Iterator[2]), static_cast<int>(counter##Iterator3), static_cast<int>(counter##Iterator4) };

Definition at line 115 of file Loop.h.

◆ simtForWithSchedulerInstructions

#define simtForWithSchedulerInstructions (   counter,
  max,
  loopParallelism 
)
Value:
tarch::multicore::getHostSYCLQueue().submit([&](auto& handle) { \
handle.parallel_for( \
::sycl::range<1>{static_cast<std::size_t>(max)}, \
[=](::sycl::id<1> counter##Iterator) { \
int counter = counter##Iterator[0];

Definition at line 57 of file Loop.h.