Wed, Mar 19, 2008, 4:06pm OpenMP/GL Particle Demo
Programming » OpenMP
(Last updated: Sat, Jun 18, 2016, 7:46am)
S
ince this little program behaves differently on different machines, I thought I'd post a small video of it running on an 8-core Mac Pro. It's a simple charged particle simulation. Controls for it are shown below at full-size. Arrows coming out of the spheres indicate the strength and direction of the field is (the field's gradient). Purely for visual fun enjoyment, the program optionally wraps the spheres in NASA planet images (Earth and Venus, in this case), and you can also follow around a randomly-chosen sphere.

A perhaps more interesting part lies in using OpenMP in a Cocoa program to throttle how many cores are utilized, and how to let the user dynamically control it. To this end, there is a Core selector at the top which dynamically detects the number of cores on the machine, sets up a tick-based slider with that many tick marks (1 core = far left, more cores = further right).


After showing off the planet wrapping and the follow-a-charge function, the demo slowly turns on more cores to crunch the interaction force calculations. Since this is often too gradual a way to notice any difference in the speed of the simulation it ends by toggling between 1 and 8 cores. It's easiest to notice when just staring at the simulation and not at the controls.

There is a more pronounced speed-up when all cores are selected than shown here, because the screen-recording software was taking up a lot of cpu overhead as well.

(It's also my first iMovie, despite owning it in various forms for many years.)

  • Javier (Thu, March 20th, 2008, 5:59am UTC)
    Hi Jeff!

    Very cool video. A few weeks ago I tried to do a similiar thing in 2D with my much more limited knowledge of programming.

    One question, which program have you used to record the video?

    Javier

  • Jeff (Thu, March 20th, 2008, 6:17am UTC)
    Hey, Javier! Snapz Pro X took the vid (and it's even better quality than what's shown here). Still trying to decide whether to buy, but it's very well made.

  • Jay Nelson (Sat, April 5th, 2008, 10:59am UTC)
    WTF? Seriously though, it looks cool. I'll show it at our next CoMUG meeting. Congrats.

Leave a comment