Skip to content
Class for easy parallelization of for loops in C++
C++
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
TestProject_ParallelExecution
.gitignore
CentralBuildDir.props
LICENSE
README.md
TestProject_ParallelExecution.sln

README.md

TestProject_ParallelExecution

Class for easy parallelization of for loops in C++. It also covers methods to write the result to a common variable or something to the console in a thread-safe way.

Installation

Only the header ParallelExecution.h is required. Simply download it and add it to your include path.

Usage

To run a loop in parallel, just include the header, create an object of the class ParallelExecution and then use the parallel_for() function.

#include "ParallelExecution.h"
//...
ParallelExecution pe;
pe.parallel_for(0, iterations - 1, [&](const size_t i)  // i = {0, 1, ..., iterations - 1}
{
  // Do stuff in parallel
});

More details can be found in the test program which also covers the usage of the thread-safe functions.

References

Details can be found in the cordesponding blog article.

You can’t perform that action at this time.