[ODE] Ideas for threading ODE...
Hendrix_ at gmx.net
Tue Aug 30 11:43:29 MST 2005
I just want to share my experiences and some thoughts:
I have put the physics in one thread and the OpenGL output into an
other. The speed increase is quite high (even on single-
I did not use synchronization (double-buffering of position/
orientation), so the OpenGL-output is a mix of the last
frames computed. (But that is not recognizable by the user.)
I have used "explicit" parallelization (Windows: CreateThread(),
Macintosh: MPCreateTask() ).
Next thing I will do is parallelize the collision detection. 90% of
my objects are trimeshes, so that is the most time-comsuming part.
TT is already threadable (of course, _AABBTreeCollider has to be
some other colliders not yet (using ugly global variables, eg. see BT).
Then dJointCreateContact() has to own some synchro, too, when putting
all the joints into the contact-joint-group.
The SOR is certainly parallelizable, which I will exploit, too.
But then again, my app is for 3d-animation designers, who tend to
have latest hardware. I also assume that high-end
workstations will not be limited to only 2 processors. So my project
is probably not applicable to game-design.
On 18. Aug 2005, at 21:18 Uhr, Tyler Streeter wrote:
> It seems wise to discuss ways to make ODE multithreaded. With all the
> new hardware options becoming available (e.g. multi core general
> purpose CPUs, general purpose vector machines like the CELL chip, and
> specialized physics chips like Ageia's PhysX), it would be a shame to
> be stuck in a single thread forever.
> Since islands of bodies are by definition independent, each island
> could be sent to a separate thread. During collision detection each
> non-colliding space could be sent to a separate thread (e.g. ODE's
> spaces, or the octants of an octree).
> Using OpenMP (http://www.openmp.org) would make it easy to add support
> for multiple threads. OpenMP is great for data parallelism, which I
> think is the case here. Also, it requires minor code changes. For
> example, just put "#pragma omp parallel for" in front of a for loop
> (whose iterations must be totally independent), and OpenMP
> automatically distributes the iterations to separate threads.
> One major caveat is gcc support for OpenMP. As far as I know, gcc
> doesn't support it yet. There is the GOMP project
> (http://www.gnu.org/software/gcc/projects/gomp/), but I don't know how
> far along it is. Besides that, a lot of compilers are supported,
> including VC++ 8.0. Here's a list of supported compilers:
> ODE mailing list
> ODE at q12.org
More information about the ODE