Accelerated Sandpile simulation simulation using MPI
This was an assignment in my MSc, for my High Performance Computing course. We were provided with a single threaded non-parallelised implementation of sand-pile simulation using cellular automata. Our objective was to use distributed computing to parallelise the implementation. Using OpenMPI, my implementation split the grid into a number of columns, depending on the number of processors it was running on. If the processor number was not a perfect divisor of the grid size, the leftover columns would be added to the last process. Every processor had it’s own set of columns which they updated each iteration and sent back to rank 0 at the end of the simulation. The tricky part is that although a processor would work on its own set of columns, it would require 2 extra columns, which would store the leftmost adjacent and rightmost adjacent column of their neighbouring processors. Every time iteration, a halo swap would be executed to update these columns. The video below shows the simulation with each time iteration outputting an image of the grid and its subsequent updates.
My parallelisation technique, although simple, was quite effective in accelerating the runtime of the simulation. The table below shows the timings.