This weekend, we developed an n-body simulation—think galaxy simulation—from scratch and deployed it in the cloud.
N-body simulations are cool; they are widely used in astrophysics to study the formation of stars and galaxies. However, n-body simulations are very resource intensive and require a lot of processing power to compute and render.
At HackPrinceton, we hacked up two algorithms for running n-body simulations, the Barnes-Hut algorithm and the naive algorithm. We started from scratch and used C/C++ and Cairo for rendering. We used OpenMP for parallelism.
To deploy our software, we used Linode, running our simulations and rendering across a couple of beefy 20-core, 96 GB nodes. We deployed two simulations, one of a 10,000 body system and another of a 100,000 body system. This took overnight, so the total cost of deploying these models stayed within the handy $50 Linode voucher.
The impact of deploying our simulation in the cloud was significant. Each timestep of the 10,000 body system took approximately 23 seconds to perform on a mid-2012 MacBook Pro, but only 0.7 seconds to perform when deployed on Linode. This helped keep the time of the simulation down so we could get some sleep Saturday night.
Check out video from our 10,000 and 100,000 particle simulations.
Log in or sign up for Devpost to join the conversation.