p.Chaos.PBDEvolution.ParalleIntegrate
p.Chaos.PBDEvolution.ParalleIntegrate
#Overview
name: p.Chaos.PBDEvolution.ParalleIntegrate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Run the integration step in parallel for.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.PBDEvolution.ParalleIntegrate is to control whether the integration step in the Position-Based Dynamics (PBD) evolution process runs in parallel.
This setting variable is primarily used by the Chaos physics system, which is an experimental physics engine within Unreal Engine 5. Specifically, it’s used in the PBD (Position-Based Dynamics) evolution module, which is responsible for simulating the behavior of soft bodies and cloth.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as a boolean TAutoConsoleVariable, which means it can be changed at runtime through console commands or configuration files.
This variable interacts closely with two other variables:
- CVarChaosPBDEvolutionUseNestedParallelFor
- CVarChaosPBDEvolutionMinParallelBatchSize
These variables work together to control the parallelization strategy of the PBD evolution process.
Developers should be aware that enabling parallel integration (by setting this variable to true) can potentially improve performance, especially for simulations with a large number of particles or constraints. However, it may also introduce some overhead for smaller simulations.
Best practices when using this variable include:
- Experiment with both true and false values to find the best performance for your specific use case.
- Consider the size of your simulation when deciding whether to enable parallel integration.
- Use in conjunction with CVarChaosPBDEvolutionMinParallelBatchSize to fine-tune the parallelization behavior.
Regarding the associated variable CVarChaosPBDEvolutionParallelIntegrate:
This is the actual console variable object that controls the parallel integration feature. It’s defined with the same name as the console command (p.Chaos.PBDEvolution.ParalleIntegrate), but with a slight typo in the command name (‘Paralle’ instead of ‘Parallel’).
The purpose and usage of this variable are identical to p.Chaos.PBDEvolution.ParalleIntegrate, as they refer to the same setting. The variable is used in the AdvanceOneTimeStep function of the FPBDEvolution class to determine whether to use parallel integration.
Developers should be aware of the typo in the console command name, as it might cause confusion when trying to set this variable through console commands. Always use the exact command name “p.Chaos.PBDEvolution.ParalleIntegrate” when modifying this setting through the console.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:37
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarChaosPBDEvolutionMinParallelBatchSize(TEXT("p.Chaos.PBDEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionWriteCCDContacts(TEXT("p.Chaos.PBDEvolution.WriteCCDContacts"), false, TEXT("Write CCD collision contacts and normals potentially causing the CCD collision threads to lock, allowing for debugging of these contacts."), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionParallelIntegrate(TEXT("p.Chaos.PBDEvolution.ParalleIntegrate"), false, TEXT("Run the integration step in parallel for."), ECVF_Cheat);
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in PBD Post iteration updates"));
static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3");
#Associated Variable and Callsites
This variable is associated with another variable named CVarChaosPBDEvolutionParallelIntegrate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:37
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarChaosPBDEvolutionMinParallelBatchSize(TEXT("p.Chaos.PBDEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionWriteCCDContacts(TEXT("p.Chaos.PBDEvolution.WriteCCDContacts"), false, TEXT("Write CCD collision contacts and normals potentially causing the CCD collision threads to lock, allowing for debugging of these contacts."), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionParallelIntegrate(TEXT("p.Chaos.PBDEvolution.ParalleIntegrate"), false, TEXT("Run the integration step in parallel for."), ECVF_Cheat);
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in PBD Post iteration updates"));
static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3");
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:475
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FPBDEvolution::AdvanceOneTimeStep
Source code excerpt:
// Don't bother with threaded execution if we don't have enough work to make it worth while.
const bool bUseSingleThreadedRange = !CVarChaosPBDEvolutionUseNestedParallelFor.GetValueOnAnyThread();
const int32 MinParallelBatchSize = !CVarChaosPBDEvolutionParallelIntegrate.GetValueOnAnyThread() ?
TNumericLimits<int32>::Max() : // Disable
CVarChaosPBDEvolutionMinParallelBatchSize.GetValueOnAnyThread(); // TODO: 1000 is a guess, tune this!
const bool bWriteCCDContacts = CVarChaosPBDEvolutionWriteCCDContacts.GetValueOnAnyThread();
{
TRACE_CPUPROFILER_EVENT_SCOPE(ChaosPBDPreIterationUpdates);