Wrong Behavior

Hello,

I’m currently testing some simple sample with PhysX sdk 3.2.2 on Linux and there is a strange behavior concerning the spawn of separate rigid body solver thread.
My test consist in a pendulum (a dynamic actor + PxSphere) jointed to the ‘world’ (a static actor) by a PxRevoluteJoint.
Therefore, this test is made of 2 actors (less than the default PxSceneDesc::solverBatchSize of 32).

When running the test, all my cpu cores are being used. I expected PhysX to use only one core.
To use only one core I have to set it manually by calling PxDefaultCpuDispatcherCreate(0); (ie : instead of PxDefaultCpuDispatcherCreate(MAX_THREAD) )
The problem is that it takes a lot more computation time when using all the threads.

I don’t think this was the correct behavior according to the documentation, was it ?
Can it be fixed ?

PS: sorry I’m french

Hi,

That is a strange result. How many cores are on your machine?

Thanks,
Mike

Hi Mike,

It is a 6 cores CPU with HT => 12 Threads
When running, loads of all thread are of a few percent…

Thank you in advance.

Hummm …

Is there someone that can solve my problem, it is still very embarrasing…

Thank you

Hi,

“Can it be fixed”.

It sounds to me like you fixed it by explicitly telling it to use one core. Is this issue blocking you at this point?

Thanks,
Mike

Hi Mike,

It does not fix it, it is just a hack to reveal the problem.

In my application I need that PhysX uses all the cores of my CPU for some other works.
It can’t be done with other threading system because I must access (read access) to physx elements (according to PhysX documentation it can bring problems, and problems occured when I tried before …).

So my application NEEDS to set PxDefaultCpuDispatcherCreate(12) to run fast and safely.
Problem is : PhysX use too much cores number (unlike it is written in the doc) and so uses too much CPU time which leaves to my application less time to do its own work (I did a lot of test and benchmark).

For exemple : Here are the benchmark for the computation time of 2 tests (one with the pendulum and one with a vehicle on a flat ground).
Each with one or all available threads.

Here is a .zip containing 4 jpg picture.

Computation time is shown as Z = f(Actor velocity iteration number, Actor position iteration number)
As you can see, too much time is spent by PhysX when it is allowed to use all the cores
(of course because of overcost of threading whereas it is supposed to use only one thread according to the doc).

Thank you for giving me a little of your time.
benchmark.zip (140 KB)