ParallelFor

General purpose parallel for that uses the taskgraph for unbalanced tasks Offers better work distribution among threads at the cost of a little bit more synchronization.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Async/ParallelFor.h

Include

#include "Async/ParallelFor.h"

Syntax

void ParallelFor
(
    int32 Num,
    TFunctionRef< void)> Body,
    EParallelForFlags Flags
)

Remarks

General purpose parallel for that uses the taskgraph for unbalanced tasks Offers better work distribution among threads at the cost of a little bit more synchronization. This should be used for tasks with highly variable computational time.

Parameters

Parameter

Description

Num;

number of calls of Body; Body(0), Body(1)....Body(Num - 1)

Body;

Function to call from multiple threads

Flags;

Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss