Multi-threading support in Visions of Chaos

A long overdue and much requested feature in Visions of Chaos has been better support for multi core CPUs. Watching Visions of Chaos churn away calculating a long series of frames for a movie and only seeing one of your CPU cores in use can be frustrating.

Converting single threaded code into multi-threaded capable code is not exactly easy (depending on the algorithm some code is easier than others) but I have started converting some of the easier modes into multi-thread capable code.

Smoothed Particle Hydrodynamics (SPH) was one of the modes in Visions of Chaos that really needed a speed up. See here and here for my previous experiments with SPH.

This next screenshot shows all the 12 cores of an i7 being used for calculating the SPH formulas. Note that the actual displaying of the particles cannot be parallel so there is not 100% CPU utilization. As the particle count goes up (and the time it takes to calculate the million particles moving takes longer than the display time) the CPU usage jumps closer to 100% on all cores.

After conversion to multi-CPU capable code it was time to render some new 4K resolution SPH simulations. Once the particles count and resolution goes up to fill a 4K screen the times start to plummet again, but seeing these in full 4K resolution is really nice. The parts in the following movie used 1,000,000 SPH particles each which is double my previous particle counts.

Other than SPH, the other modes that take advantage of the rewritten parallel processing code are 4D Cellular Automata, Coupled Cellular Automata 2, Ying-Yang Fire Cellular Automata, Large Neighborhood Totalistic Cellular Automata and Liquid Crystal Cellular Automata. The CA modes are the easiest to convert to parallel processing as by nature they update each cell independent of the others.

There is still a lot of code and modes that would benefit from parallel processing. Yet another entry on my ever expanding to do list of features for Visions of Chaos.

Jason.

Share this:
Like this:Like Loading... Related