This project is a parallel discrete event simulation of flocking birds using MPI and pThreads and is designed to run on the RPI BG/Q super computer AMOS. It is our final project for the RPI course CSCI-4320 Parallel Computing. The summary of this project is below:
For our final project we plan on implementing a simulation of a flocking behavior in birds using MPI. Flocking is an emergent behavior found in birds (as well as other animals) where many individuals in a “flock” move collectively as a single group. These movements are not governed by any central coordination, but rather arise from many individuals following simple rules. In our case the rules of flocking we will attempt to simulate are: separation (avoid very close neighbors), alignment (move in the same direction as neighbors), and cohesion (move in the direction of the average position of neighbors). These rules can be modelled discretely and synchronized between processes in order to run the simulation in parallel in a HPC setting.
We will focus on an agent-based approach which designates one or more simulated birds (captured as a struct) to each MPI rank. With this approach each rank will perform a collective MPI_Allgather operation to receive information about each bird in the universe and calculate future movements based on that. The universe, in this case, would be represented virtually based on the information contained within each bird object. This is preferable to an explicit representation which maps each bird to a slot in a large array of the universe, because each rank will have to deal with a minimal amount of memory. Additionally, this representation is more realistic, because each bird in a flock is an agent of a larger system. The complexity of this agent-based simulation arises from the large amount of communication that is necessary between all of the objects in the simulated universe; this is what makes this project non-embarrassingly parallel.
Our project will consist of three main parts. For the first part we will adjust the parameters of the simulation to explore how they affect the flocking behavior of the birds. We plan on outputting the state of the universe at specific iterations in the experiment, and then create a visualization of the universe at these time points to view the characteristics of the flock. The second part of this experiment will be a strong scaling study on AMOS to evaluate the performance of our algorithm for a fixed universe size and number of simulated objects as we increase the number of cores used on the IBM Blue Gene/Q. Finally, we will test the performance effect of using pthreads within each MPI rank. Specifically, if the threading option is turned on, each MPI rank will spawn multiple threads to calculate the movement of each object that thread is responsible for concurrently. We will incorporate this into our strong scaling study to see the effect that using multiple threads has on performance; for example using 4 MPI processes per core with no multithreading versus 1 MPI process per core with multithreading.