Parallel solver experiments

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Parallel solver experiments

Postby MeltingPlastic » Tue Jun 26, 2018 12:07 am

Just did a fresh build of the sandbox (cleared out any residual plugin builds) and that is working well and performance is awesome. The compounds demo works as well.

My Urho3D project using object linking still gives a crash when I introduce a compound though. In that setup I have no plugins so It is using the default solver.
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm

Re: Parallel solver experiments

Postby Julio Jerez » Tue Jun 26, 2018 12:58 am

do you mean is running ok in the sandbox demos, but not in you wrapper.
Has you try the compound demos in the sandbox?

three things we can do:
1-I can enable the serialization so that you can export your scene to the sane box
2-you said you are link to the newton sdk statically, can you link to teh dll and make a repro demo.
2-maybe this is a good time, for me to get the urtho3d engine to see what is going on.


MeltingPlastic wrote:... and performance is awesome.

I will get much better, aft ethe latest optimizations. :D
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Parallel solver experiments

Postby Julio Jerez » Tue Jun 26, 2018 9:43 am

Ok I now made the final thread optimizations, the parallel solver is now lock free, it only uses two atomics iterator in a place where the alternative with be far worse.
It makes an appreciable difference in multithreaded mode, and almost not difference in single thread.

Edit:
One remarkable side effect is that the with the changes to the thread pool system, and if I add the extra pass to calculate the jacobians offset in the parent thread, them the parallel solve is deterministic.

Of course that's only on part of it, it will also requires modification to the broard and narrow phase of the collision system.
But this is a step on the right direction.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Parallel solver experiments

Postby MeltingPlastic » Tue Jun 26, 2018 10:01 am

Julio Jerez wrote:Ok I now made the final thread optimizations, the solve is lock free, and only use tow atomics in a place whe the alternative with be far worse.
It makes a appreciable difference in multithreaded mode, and almost no difference in single thread.


Sweet!

Julio Jerez wrote:do you mean is running ok in the sandbox demos, but not in you wrapper.


Yes

Julio Jerez wrote:Has you try the compound demos in the sandbox?


Those work well for me.

Julio Jerez wrote:I can enable the serialization so that you can export your scene to the sane box


That would be helpful.

Julio Jerez wrote:you said you are link to the newton sdk statically, can you link to teh dll and make a repro demo.


I am actually linking using the Objects directly right now. I can change it to link dynamically (dll). But I need to find the right cmake calls to generate a project file from the newton sdk. Last time I tried it I got myself into a nice linker error mess. will try again
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm

Re: Parallel solver experiments

Postby Julio Jerez » Thu Jun 28, 2018 3:00 pm

Ok I spent some time tryin to make a file browser so that we can load serialize scenes, but that is harder that I was anticipation using imgui.
there are some add on that people has made but they do no seem very stable, sop I try to make my one and I run into some bugs in the library with popup controller.

I updated to new version and it got worse because they made change to deal with context and stuff and that does not work well when trying to make call to the gui library from a different thread.

That can be fixed but the problem start to get out of control, and I do no want to make a big case out of that.

so I reverted back the older version, and instead I will make it that the sandbox will simple load serialized file form a menu drop down the same way is load demo.

this way the end user can save an open file from that forded, but it can't brose outside that folder to search for other files, the use will have to copy the physically in the directory.

this similar to how Mac project work, but much simpler since they is no browsing at all.
I will do that over the weekend.

I will focus instead on getting the joint to work with the parallel solver, and also adding the progressive sleeping.

the solver is now brute force, which is fine when the opened are moving but because is put every thing in one giant island, it is kind of an old or nothing, so I need to extend sleep to the partial islands.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Parallel solver experiments

Postby thedmd » Fri Jun 29, 2018 4:32 am

"God started from scratch too"
User avatar
thedmd
 
Posts: 149
Joined: Fri Jun 26, 2009 11:52 pm

Re: Parallel solver experiments

Postby MeltingPlastic » Wed Jul 04, 2018 6:27 pm

also have you considered using tracy?: https://bitbucket.org/wolfpld/tracy seems to be a good profiler that supports imgui.

Also - after updating some code - I am getting an error in dNewton.cpp:
Code: Select all
Severity   Code   Description   Project   File   Line   Suppression State
Error (active)   E0386   no instance of overloaded function "dNewton::OnCompoundSubCollisionAABBOverlap" matches the required type   newton-dynamics   c:\Users\casht\Repos\greatgame\Urho3D\Source\ThirdParty\newton-dynamics\sdk\dNewton\dNewton.cpp   100   
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm

Re: Parallel solver experiments

Postby Julio Jerez » Wed Jul 04, 2018 10:18 pm

wow that profiler seems exactly what I was looking for, I download and try but unfornatlly they are using lot of CPP 11 and beyond that is not supported by Visual studio 2015 and older versions.

On the error, I am adding my own simple profiler to see what is going on with the thread pool class, in some cases it seems to be slower in multithread mode that when in single thread.
I recently changed the thread pool to have independent lanes, this is unread of the pool system having a common queue from where each thread take a job and execute it, now each worker there has its own queue and it is the parent thread that assign job to each queue.
This allows for lock free pool system however it also less responsive because each thread has to have its load of work, so if one thread finish its tasks if can to take work from the other.
Before it was a single lane of job and any thread took and available job, so if a core was available that core could do all the work, and that seem better.

I has that problem long time ago using openmp, and I decided to abandoned, but now that I learned more about threads, I am trying again but it seems that is not really a good choise.

anyway this is why I need a frame capture thread profiler before I go on.

Later tonigh I will commit a clean version that compile all libraries. Sorry about that.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Parallel solver experiments

Postby Julio Jerez » Thu Jul 05, 2018 7:29 pm

I think I now have a very basic profiler that can save a timeline for one thread.
later I will make so that is a multi threaded, but for now this is enough to write the program that present the data.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests