From small personal projects to the data-ecosystems of fortune 500 companies, IaaS (Infrastructure as a Service) is becoming the standard way of obtaining infrastructure for any computing-related task. IaaS is, in short, a way of supplying computational-infrastructure that is similar to how you get water or electricity. Instead of you setting up your own pipes or electric-cables, you simply subscribe to a public system that runs on a common infrastructure and get charged a standard rate for a given unit of the utility you are consuming. In the same way, IaaS allows you to use 'public' data-centers (public meaning not owned by you) to host your applications while paying a standard rate for the computing power, memory, and bandwidth used. Amazon is the most popoular infrastructure supplier with AWS, but Google, Microsoft, Rackspace, and many others are also big players in the IaaS game. All of these companies offer APIs which allow us to create, destroy, and manage VMs programmatically. Today, I'll be going over how to do this through Google's IaaS offering, Compute Engine.
I'll start by going over how to set up an account with the Google Developers program and install the Google Cloud SDK, which will give you simple command-line access to Google Cloud Services. Then I'll show you how to use the
gcloud tool to access the Compute Engine API from your command-line. Finally, I'll go over my library libGVM, which is a small container of python scripts that wraps around the API provided by Google. This library keeps track of running instances and instance-snapshots, lets you set default values for various virtual-machine parameters, and much more.
In this post, we build off the theory developed in Part 1 and actually implement a double-pendulum simulator in a few different programming languages. We'll start by writing our own Runge-Kutta solvers which will give us the position, velocity, and acceleration data that is needed to completely describe the trajectory of a double pendulum system given an arbitrary set of initial conditions. Once we have this data, we can move onto plotting it using a few different plotting libraries. The languages I'll be going over are Matlab, C++, and Python. I chose these languages because they are all quite popular and any given programmer is likely to understand at least one of them.
All of the code is hosted here on Github, and more details can be found at the Double-Pendulum-Simulation project page on my website. The entire project is available for download via either of these two links : .Tar , .Zip. You can also clone it straight from the command line :
git clone https://github.com/jhallard/Double-Pendulum-Simulation.git cd Double-Pendulum-Simulation
Below is a quick summary of the last post, for more information, read Part 1.