Wednesday, 29 August 2012

NAG on the Cloud: Part 2

In case you missed Part 1 of NAG on the Cloud, I discussed calling the Library on Windows Azure using the C# library and Microsoft's Cloud Numerics. We now turn to a different cloud provider. Amazon's Elastic Cloud Computing (EC2) allows the user to buy or rent instances of virtual computers and pay for only what you use. Below, I'll discuss how to put the NAG Library on EC2 and give some initial performance tests.

Creating an Instance 
There are a plethora of videos on creating Amazon EC2 instances. If you are going to install and run the NAG Library, make sure you start a Virtual Private Cloud when creating the instance. Private Clouds can be created at no additional cost on EC2 and remain compatible with NAG's Kusari License management system. I decided to create a couple tests:

My EC2 Console Instances

The above instances vary in size, memory, and type of OS running. When the instance is created, you can gain access to it via ssh. To load the library onto EC2, just download the .tgz file of your choice from the NAG website and secure copy it up there:

$scp -i VPCkey.pem fll6a23dfl.tgz ubuntu@50.112.131.89:/home/ubuntu

Here VPCkey.pem is a key file that only allows my computer to access this Cloud instance. Once the Library is copied, we can unzip it and the installation instructions remain the same as if the computer were right in front of you!



Is the Cloud Faster?
First the system specs:
Amazon EC2 Cloud High-CPU Extra Large Instance:
  • 20 EC2 Compute Units (8 virtual cores with 2.5 EC2 compute units each)
  • 64-bit Ubuntu
  • 7 GB of memory
My laptop:
  • Intel Core i5
  • 64-bit Ubuntu
  • 3 GB RAM 
Clearly the Cloud is more powerful, but is it faster? Since I had recently completed a project on sparse Linear and Quadratic Programming, I decided to use some of the data and compare the run-times between my laptop and the cloud (routine tested was e04nq, all times are in seconds):

Cloud Time My Laptop

QP1 1114.42 1429.06

QP2 45.97 57.2

LP1 78.13 96.83

LP2 24.36 28.99

LP3 39.42 43.53
Thus, by running these programs on the cloud I was able to obtain a 10-20% speed improvement!

CPU Utilization on the Cloud
As I was browsing the information page of my High-CPU Instance, I examined the CPU utilization used in the above programming problems and found some interesting results (click to enlarge):


As you can see, I was using less than 20% of my CPU capacity on the Cloud when running these tests! This is a result of using the serial library and not taking advantage of all the cores on EC2. I would suspect you could obtain a substantial performance increase when using the NAG Library for SMP and Multicore.

For more information on running your applications on the Cloud, contact support@nag.co.uk or support@nag.com.

1 comment:

  1. I should note that my examples (QP1, QP2, LP1, etc) are a collection of Sparse Linear and Quadratic problems I had available. The large difference in solving times are due to the size differences in the Hessian and Constraint matrices.

    ReplyDelete

NAG moderates all replies and reserves the right to not publish posts that are deemed inappropriate.