Slow when there are many collisions in physics (not affected by CPU/GPU performance?)

Hi,
I tested a scene with lots of collisions in physics.

Different CPU + same GPU, Same CPU + different GPU, Multiple GPUs
In all cases, I could not see any change in speed in the case of Physics.
Physics seems to run slower when there are a lot of collisions, what could be causing this?

At first, I thought that the calculation was being done by the CPU, not the GPU.
This seemed unlikely, as the speed was the same on different PCs with the same GPU.
I have already confirmed that the Physics Scripting Manual says “By default, rigid body simulation is performed on the GPU.” under “CPU vs GPU Rigid Body Dynamics”.

I tried swapping to a different GPU on the same PC, but this did not change the speed either.
I have confirmed that RTX calculations (RTX Path-traced) become faster when the GPU performance is good or when multiple GPUs are used.

Confirmation environment

Window 10
Omniverse Create 2021.3.8

  • Verification PC1
    CPU : AMD Ryzen 5 3600 (6 cores/12 threads)
    Mem : 32GB

  • Verification PC2
    CPU : Intel(R) Xeon(R) Gold 6226R CPU @ 2.0GHz (32 cores/64 threads)
    Mem : 96GB

  • GPU1 : NVIDIA RTX A4000

  • GPU2 : NVIDIA RTX A5000

Confirmation procedure

  1. New in Omniverse Create

  2. Run “rigidbody_benchmark.py” in Script Editor
    This is a free fall of 2560 balls.
    “boundingSphere” is explicitly specified, but the results were the same even if it was not explicitly specified.
    rigidbody_benchmark.py (4.1 KB)

  3. Press the Play button to start the animation.

Check it out by viewing the fps on Omniverse.
To be sure, I also measured it with FrameView.

Verification Results

[Verification PC1] + [RTX A4000]
[Verification PC2] + [RTX A4000]
[Verification PC2] + [RTX A5000]
[Verification PC2] + [RTX A4000] + [RTX A5000]

In both cases, there was no change at about 4.5-5 fps.

Hi,
Yes, this is expected. There are two reasons for this:

  1. most of the time is spend on the CPU to write the results back to USD. This is the real bottleneck, you can avoid this by activating omni.physx.flatcache extension (Window->extensions). This extension will bypass USD write back and write data more directly to renderer. Then your scene simulates 70fps+
  2. there are not enough rigid bodies to see any major difference. In general around 3k rigid bodies there seems to be the break point where GPU simulation makes a difference. I did increased the number of balls in your scene and then I can clearly see the GPU benefits.

To see the exact time spend in PhysX simulation you can enable profiler extension and press F8 there enable CPU profiler and increase the CPU depth to something like 10, then you should see simulation profiler zones. Alternatively you can use good old PhysX Visual Debugger and connect the profile data there. (In Physic debug window you can enable PVD connection)

Regards,
Ales

1 Like

Thank you for your clear answer!
Writing to USD, this I could not have imagined.
I see, I understand now.
Using the omni.physx.flatcache extension has made Physics much faster in my environment!

I will also try to increase the number of rigidbodies to verify.
Profiler, oh, I just found out about it…
The profiler is going to help me with my verification.
That was helpful, thank you so much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.