Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
8c10f04f
There was an error fetching the commit references. Please try again later.
Commit
8c10f04f
authored
5 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Added description of the Algorithms namespace.
parent
69de1fb0
No related branches found
No related tags found
1 merge request
!44
Tutorials
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TNL/Algorithms/ParallelFor.h
+37
-31
37 additions, 31 deletions
src/TNL/Algorithms/ParallelFor.h
with
37 additions
and
31 deletions
src/TNL/Algorithms/ParallelFor.h
+
37
−
31
View file @
8c10f04f
...
...
@@ -31,13 +31,19 @@
*/
namespace
TNL
{
namespace
Algorithms
{
/**
* \brief Namespace for fundamental TNL algorithms
*
* It contains algorithms like for-loops, memory operations, (parallel) reduction,
* multireduction, scan etc.
*/
namespace
Algorithms
// TODO: ParallelForMode should be moved to Device (=Executor)
/**
* \brief Enum for the parallel processing of the for-loop.
*
* \brief Enum for the parallel processing of the for-loop.
*
* Synchronous means that the program control returns to the caller when the loop is processed completely.
* Asynchronous means that the program control returns to the caller immediately even before the loop is processing is finished.
*/
...
...
@@ -46,9 +52,9 @@ enum ParallelForMode { SynchronousMode, AsynchronousMode };
/**
* \brief Parallel for loop for one dimensional interval of indexes.
*
*
* \tparam Device says on what device the for-loop is gonna be executed.
* It can be Devices::Host, Devices::Cuda or Devices::Sequential.
* It can be Devices::Host, Devices::Cuda or Devices::Sequential.
* \tparam Mode defines synchronous/asynchronous mode on parallel devices.
*/
template
<
typename
Device
=
Devices
::
Sequential
,
...
...
@@ -57,22 +63,22 @@ struct ParallelFor
{
/**
* \brief Static method for execution of the loop.
*
*
* \tparam Index defines the type of indexes over which the loop iterates.
* \tparam Function is the type of function to be called in each iteration.
* \tparam FunctionArgs is a variadic type of additional parameters which are
* \tparam FunctionArgs is a variadic type of additional parameters which are
* supposed to be passed to the inner Function.
*
*
* \param start the for-loop iterates over index interval [start, end).
* \param end the for-loop iterates over index interval [start, end).
* \param f is the function to be called in each iteration
* \param args are additional parameters to be passed to the function f.
*
*
* \par Example
* \include Algorithms/ParallelForExample.cpp
* \par Output
* \include ParallelForExample.out
*
*
*/
template
<
typename
Index
,
typename
Function
,
...
...
@@ -86,9 +92,9 @@ struct ParallelFor
/**
* \brief Parallel for loop for two dimensional domain of indexes.
*
*
* \tparam Device says on what device the for-loop is gonna be executed.
* It can be Devices::Host, Devices::Cuda or Devices::Sequential.
* It can be Devices::Host, Devices::Cuda or Devices::Sequential.
* \tparam Mode defines synchronous/asynchronous mode on parallel devices.
*/
template
<
typename
Device
=
Devices
::
Sequential
,
...
...
@@ -97,30 +103,30 @@ struct ParallelFor2D
{
/**
* \brief Static method for execution of the loop.
*
*
* \tparam Index defines the type of indexes over which the loop iterates.
* \tparam Function is the type of function to be called in each iteration.
* \tparam FunctionArgs is a variadic type of additional parameters which are
* \tparam FunctionArgs is a variadic type of additional parameters which are
* supposed to be passed to the inner Function.
*
*
* \param startX the for-loop iterates over index domain [startX,endX)x[startY,endY).
* \param startY the for-loop iterates over index domain [startX,endX)x[startY,endY).
* \param endX the for-loop iterates over index domain [startX,endX)x[startY,endY).
* \param endY the for-loop iterates over index domain [startX,endX)x[startY,endY).
* \param f is the function to be called in each iteration
* \param args are additional parameters to be passed to the function f.
*
* The function f is called for each iteration as
*
*
* The function f is called for each iteration as
*
* f( i, j, args... )
*
*
* where the first parameter is changing more often than the second one.
*
* \par Example
* \include Algorithms/ParallelForExample-2D.cpp
* \par Output
* \include ParallelForExample-2D.out
*
*
*/
template
<
typename
Index
,
typename
Function
,
...
...
@@ -135,9 +141,9 @@ struct ParallelFor2D
/**
* \brief Parallel for loop for three dimensional domain of indexes.
*
*
* \tparam Device says on what device the for-loop is gonna be executed.
* It can be Devices::Host, Devices::Cuda or Devices::Sequential.
* It can be Devices::Host, Devices::Cuda or Devices::Sequential.
* \tparam Mode defines synchronous/asynchronous mode on parallel devices.
*/
template
<
typename
Device
=
Devices
::
Sequential
,
...
...
@@ -146,12 +152,12 @@ struct ParallelFor3D
{
/**
* \brief Static method for execution of the loop.
*
*
* \tparam Index defines the type of indexes over which the loop iterates.
* \tparam Function is the type of function to be called in each iteration.
* \tparam FunctionArgs is a variadic type of additional parameters which are
* \tparam FunctionArgs is a variadic type of additional parameters which are
* supposed to be passed to the inner Function.
*
*
* \param startX the for-loop iterates over index domain [startX,endX)x[startY,endY)x[startZ,endZ).
* \param startY the for-loop iterates over index domain [startX,endX)x[startY,endY)x[startZ,endZ).
* \param startZ the for-loop iterates over index domain [startX,endX)x[startY,endY)x[startZ,endZ).
...
...
@@ -160,18 +166,18 @@ struct ParallelFor3D
* \param endZ the for-loop iterates over index domain [startX,endX)x[startY,endY)x[startZ,endZ).
* \param f is the function to be called in each iteration
* \param args are additional parameters to be passed to the function f.
*
* The function f is called for each iteration as
*
*
* The function f is called for each iteration as
*
* f( i, j, k, args... )
*
*
* where the first parameter is changing the most often.
*
*
* \par Example
* \include Algorithms/ParallelForExample-3D.cpp
* \par Output
* \include ParallelForExample-3D.out
*
*
*/
template
<
typename
Index
,
typename
Function
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment