Monday, October 18, 2010

CPU - DEM Simulation


This is my first attempt for a CPU based DEM (discreet elements method) simulator ( more info here: )

It's based on a Nvidia demo I saw running with the GPU, It was really cool, so I tried to do the same but with the CPU and multithreaded. Of course is not so fast as the GPU version, but it´s not too bad. 100000 particles - 18 fps.
Note that the drawing is not optimized at all, so it´s much slower when I draw spheres. Probably it could be used for a sand simulation or something like that. I made tests at around 1fps with one million particles. I'm now writing a plugin for Houdini.


Ruben Penalva said...

Hi Tony,
Really cool. Did you use sse apart from multithreading? What approach did you take to parallelize the demo, just plain threads (ie, boost::threads), openmp or a task scheduler (ie, tbb)?

Keep the good work!

Ruben Penalva

El Tony said...

Hi Ruben!

Thanks, I'm glad you like it :)

Nope, I didn't use sse, nor boost. In fact, what I did is a very simple multithreading system. I used Qt threads, I just divided the grid and sent a bunch of particles for every thread to process. So it's really simple, and I think there's a lot of room for improvement.
I'll work on that :)