p.Chaos.NewtonEvolution.ParalleIntegrate
p.Chaos.NewtonEvolution.ParalleIntegrate
#Overview
name: p.Chaos.NewtonEvolution.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.NewtonEvolution.ParalleIntegrate is to control whether the integration step in the Chaos physics system’s Newton Evolution algorithm runs in parallel.
This setting variable is primarily used in the Chaos physics system, which is an experimental physics engine in Unreal Engine 5. Specifically, it’s part of the Newton Evolution algorithm, which is likely responsible for simulating the motion of objects in the physics system.
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 CVarChaosNewtonEvolutionMinParallelBatchSize and CVarChaosNewtonEvolutionUseNestedParallelFor. These variables together control the parallelization strategy of the Newton Evolution algorithm.
Developers should be aware that this variable is marked with ECVF_Cheat flag, which means it’s intended for debugging or development purposes and should not be exposed to end-users in shipping builds.
Best practices when using this variable include:
- Use it for performance tuning of the Chaos physics system.
- Be cautious when enabling it in production, as parallel execution may introduce non-determinism in physics simulations.
- Test thoroughly with different scenarios when changing this setting, as it may significantly impact performance and behavior.
Regarding the associated variable CVarChaosNewtonEvolutionParallelIntegrate:
This is the actual console variable object that controls the parallel integration setting. It’s used in the AdvanceOneTimeStep function of the FNewtonEvolution class to determine whether to use parallel execution for the integration step.
The value of this variable is checked at runtime using the GetValueOnAnyThread() method, which suggests that it can be changed dynamically during execution.
When using this variable, developers should:
- Consider the trade-offs between performance and determinism in physics simulations.
- Use it in conjunction with CVarChaosNewtonEvolutionMinParallelBatchSize to fine-tune the parallelization strategy.
- Be aware that enabling parallel integration may increase CPU usage but potentially improve performance for complex physics scenes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/NewtonEvolution.cpp:38
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarChaosNewtonEvolutionMinParallelBatchSize(TEXT("p.Chaos.NewtonEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosNewtonEvolutionWriteCCDContacts(TEXT("p.Chaos.NewtonEvolution.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> CVarChaosNewtonEvolutionParallelIntegrate(TEXT("p.Chaos.NewtonEvolution.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 Newton 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 CVarChaosNewtonEvolutionParallelIntegrate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/NewtonEvolution.cpp:38
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarChaosNewtonEvolutionMinParallelBatchSize(TEXT("p.Chaos.NewtonEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosNewtonEvolutionWriteCCDContacts(TEXT("p.Chaos.NewtonEvolution.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> CVarChaosNewtonEvolutionParallelIntegrate(TEXT("p.Chaos.NewtonEvolution.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 Newton 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/NewtonEvolution.cpp:702
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FNewtonEvolution::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 = !CVarChaosNewtonEvolutionUseNestedParallelFor.GetValueOnAnyThread();
const int32 MinParallelBatchSize = !CVarChaosNewtonEvolutionParallelIntegrate.GetValueOnAnyThread() ?
TNumericLimits<int32>::Max() : // Disable
CVarChaosNewtonEvolutionMinParallelBatchSize.GetValueOnAnyThread(); // TODO: 1000 is a guess, tune this!
const bool bWriteCCDContacts = CVarChaosNewtonEvolutionWriteCCDContacts.GetValueOnAnyThread();
{
TRACE_CPUPROFILER_EVENT_SCOPE(ChaosNewtonPreIterationUpdates);