Creating demo applications for NAG Numerical Libraries with IRIS Explorer

by Mick Pont, Nag Inc.


Apart from IRIS Explorer, NAG is also well known for its long-established numerical libraries that can be used by anyone who is interested in writing scientific applications. These NAG libraries are available in a variety of versions that are designed to run efficiently on many machines, from the humblest PC to the fastest supercomputer.

Now, we at NAG are of course convinced that our library software products are excellent, but we also need to convince our users - or potential users - of that. That job is often made easier by having some pictures to look at, rather than raw numerical results. What better way to produce those pictures than by using the power of IRIS Explorer?

In this article, we will describe how IRIS Explorer has been used to produce demo applications for two NAG library products - the NAG SMP Library and the NAG Parallel Library. The methods used in both cases were similar in that they involved building new IRIS Explorer modules that interface with other programs, though the presentation of results in the two demos is rather different.

Demo 1: The NAG SMP Library

The NAG SMP Library is a library of numerical and statistical routines that are tailored to run well on Symmetric Multi-Processor (SMP) machines. In order to make good use of such machines, programs running on them should be scalable; that is to say, they should run faster when running on more processors than when running on fewer processors. In an ideal situation, they would run n times as fast on a machine with n processors than on the same machine with just one processor.

Of course it is not normally possible to achieve this ideal, but the SMP Library development team have been able to get good scalability in a number of key areas, particularly in linear algebra and Fast Fourier Transforms (FFTs). Since these routines are used heavily by many other NAG routines, this scalability gives good performance improvements in many places.

In an attempt to demonstrate this scalability in an easy-to-see manner, it was decided to create an IRIS Explorer map that would allow the user to interact with a specially written timing program, the timing program being linked with the SMP Library. Responding to user input, supplied by clicking on widgets on modules in the map editor, the timing program would execute a routine on a number of processors on the SMP machine, and then return timing information back to the IRIS Explorer module for processing and display.

For simplicity, it was decided to keep the timing program decoupled from the Explorer module itself - this would enable separate testing of the timing program during its development by the SMP Library team. It also means that IRIS Explorer and the SMP program can be run on different machines if necessary. The timing program was designed to accept input from a file - this input tells it what routine to time, and how many processors of the SMP machine to run on. Output from the program goes to another file, and describes how the SMP Library routine performed compared with a routine of equivalent functionality from the LAPACK (Linear Algebra PACKage) library. The latter library is typically offered in highly optimized form by machine hardware vendors.

If you have ever got to grips with the Module Builder, the GUI program used for creating new IRIS Explorer modules, you will know that it is not too difficult to extend IRIS Explorer in this way. Once the timing program was written and tested, a new module named SMPTime was developed. The control panel of SMPTime includes a list of routines that can be timed, and a choice of the number of processors on which the timing program should be run. This information is passed into the user code of the module, which writes it into a file, then spawns a copy of the timing program and waits for it to complete. The results come back into the file, and are displayed (see figure 1) as comparative 3D histograms created by multiple copies of the IRIS Explorer Graph3D module.

IE Screen image

Figure 1. The SMPTime module is used to select which routines from the NAG SMP Library to call, and how many processors to run on. SMPTime spawns a timing program that returns results, displayed here as 3D histograms. Each histogram shows the effects of varying the size of problem being solved (100, 200 etc.) and the number of processors used (1, 2, 3 or 4). Histogram bars are coloured according to the megaflop rate achieved by the routine, which makes it easy to compare the effects of changing the number of processors, as well as comparing different routines.

Because this demo is not intended to be modifiable by the user, IRIS Explorer was started in application mode like this:

% explorer -app demo.map
This has the effect of hiding the Explorer Map Editor, Librarian and Log Window, and only showing the control panels of modules that were maximized when the map was saved - particularly useful when you need to present as simple an interface as possible to the end user.

Demo 2: The NAG Parallel Library

The NAG Parallel Library is also targeted at high-performance multi-processor machines, particularly distributed-memory message-passing machines. It runs on hardware supporting the well known MPI (Message Passing Interface) or PVM (Parallel Virtual Machine) systems.

The requirement arose for an application that could be used to demonstrate some of the power of the Parallel Library. In particular we wanted to be able to show the speed of some sparse linear equation routines, and be able to compare how fast they run when working on different numbers of processors. With this aim in mind, the sparse linear equation routines were built into a partial differential equation (PDE) solver. Algorithms for solving PDE's typically generate large sparse linear systems, and it is important that these are solved efficiently.

For the purposes of the demo, an IRIS Explorer module named PDEsolve was built. It was designed to interact with the PDE solving program by sending control parameters through a file, and receiving back solutions of the PDE at different time steps. These solutions are converted into the Explorer lattice type, so that they can be passed to standard Explorer modules.

As with the SMPTime module discussed earlier, PDEsolve forks off a process to start the PDE solver program running, and then waits while results are returned. The PDEsolve control panel allows the user to choose the number of processors to be used on the parallel machine on which the solver runs. It also allows tuning of the way the sparse linear equation routines operate - for example algorithmic parameters such as the drop tolerance and whether or not a preconditioner should be applied.

As each step of the PDE solution comes back, it is passed along to IsosurfaceLat and OrthoSlice modules so that the user can see a movie of how the solution changes over time. Of course, because the solution is now stored in a standard IRIS Explorer data type, the full power of IRIS Explorer is available to examine it by adding more modules into the map.

IE Screen image

Figure 2. The PDEsolve module allows the user to alter the coarseness of the mesh on which the PDE is solved, and the number of processors to be used on the parallel machine. PDEsolve monitors the PDE solution as it steps through time, and at each time step passes data through the standard IRIS Explorer modules IsosurfaceLat, OrthoSlice and Render to display particular features of the solution in an animated sequence.

Getting your own data into IRIS Explorer

The two applications described here used custom-built modules to interact with other programs running independently from IRIS Explorer. If your data sets are not in a format suitable for direct input to IRIS Explorer using a standard reader module (of which there are a large number), you might be able to use the DataScribe program to help convert them to lattice format (see the IRIS Explorer User's Guide for more on DataScribe). Alternatively, you can learn how to build IRIS Explorer modules yourself - it's not difficult if you know some C, C++ or Fortran! See the IRIS Explorer Module Writer's Guide for how to get started.

Further information

If you would like more information about NAG Library products for high-performance machines, please see the NAG web page (External).


October 1998
[ Contents : Previous Article : Render Home : Next Article ]
© The Numerical Algorithms Group Ltd, Oxford UK. 1999