[ODE] Ideas for threading ODE...

Tyler Streeter tylerstreeter at gmail.com
Thu Aug 18 14:18:55 MST 2005


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:
http://www.openmp.org/drupal/node/view/9

Tyler



More information about the ODE mailing list