Synodic-Software / Soul-Engine

Physically based renderer and simulation engine for real-time applications.
GNU General Public License v3.0
42 stars 24 forks source link

Add Parallel For with the Fiber Schedular #54

Open Behemyth opened 7 years ago

Behemyth commented 7 years ago

The "ParallelFor" function should divide a for loop into chucks which are each their own job. These jobs then execute through the fiber scheduler. Take a look at Soul Engine\Source\Parallelism\Fiber\Scheduler.h/.cpp at ForEachThread which executes a callable on each thread. You can implement different varieties of the "ParallelFor" function. Maybe one would be for std conforming containers like https://en.cppreference.com/w/cpp/algorithm/for_each. Maybe for pure iteration, you would take a parameter such as iterationCount and another for taskCount. Maybe the given callable would require a value i as its first parameter, allowing it to make use of its ID.

This is a smaller task, but heavy on C++ knowledge.