Friday, 13 April 2012

NAG on the Cloud

I have been at NAG for 3 months now and one of my first tasks here was the topic of cloud computing. Customers have been inquiring as to whether they can utilize the NAG library on the hundreds of cores available on Cloud services like Microsoft's Azure and Amazons EC2. Below you will find a preliminary report of calling the NAG Library for .NET on Windows Azure.

I began with Microsoft's Cloud Numerics; a .NET analytical library that can easily be scaled out to Windows Azure for large computations. Cloud Numerics provides a library of about 400 Mathematical and Statistical functions that the user can call (in this case, from C#). Since NAG supplies the library in a .NET framework, I decided this was a good way to start.

Getting an account and all the correct software downloaded can be a challenge. I actually found this example quite useful for installation, setup, and deployment of Cloud Numerics on Azure.



To start calling NAG functions from the MSCloudNumerics example program, just add the NAG .NET dll under references and include the namespace NagLibrary. When you are ready to deploy the application to the cloud, right-click the 'AppConfigure' tab in the Solution Explorer and select 'Set as StartUp Project'. Then put in your Azure account information, create a cluster, and deploy!

Tuesday, 3 April 2012

How To: Call Brent's Root-Finding Algorithm From C#

As a Senior Technical Consultant for NAG, I answer many customer questions covering many topics. I thought I’d write up one such question I recently received from a NAG C Library user, as the answer may be useful to others.

Q: In looking through the C# associated info, I found many examples of InteropService calls from C# to the C Library (CLW3209DA_nag.dll). Have any examples been posted for the "c05" functions, e.g. nag_zero_cont_func_brent_bsrch(c05agc)?

A: I'm glad you asked! By the time you reach the end of this post, there will be one. J
In working with the NAG C Library from C#, there are three main factors to which we must attend. The first is how to represent the NAG C Library structure types in C#, and for C# this has largely been taken care of for you in NAGCFunctionsAPI.cs.