Thursday, 30 September 2010

The Shoulders of Giants

Last week NAG held its 34th AGM and prior to the business part of the meeting we had the pleasure of hearing a lecture by Professor Nick Higham of the University of Manchester on the subject How and How Not to Compute the Exponential of a Matrix. The lecture was filmed and can be viewed here. Matrix functions are useful in a number of areas, in particular for describing the solutions of certain types of differential equations. NAG is working with Nick to include his algorithms in future marks of the Library.

One of the things I particularly enjoyed about Nick's talk was the way that he set the subject in its proper historical context, starting with the work of 19th Century mathematicians such as Sylvester and Cayley. Working at the cutting edge of computing technology its easy to forget how much of what we do depends on work that goes back hundreds of years. It wasn't always this way: Fermat, having claimed to have found a proof of what became known as his last theorem, added the waspish comment "and perhaps, posterity will thank me for having shown it that the ancients did not know everything".

A few years ago SIAM interviewed a number of prominent people who had been active in the early days of numerical analysis and scientific computing, including NAG's own Brian Ford. You can find transcripts of the interviews and related material on SIAM's website. Reading these transcripts is illuminating, particularly to a (relative) youngster like me, especially given the number of references to NAG's early history that they contain. I hope that SIAM keeps up this activity, and continues to collect personal reminiscences from prominent people in the field.

Thursday, 23 September 2010

HTML5: Possible implications for technical documentation

A New Version of HTML

As you may have heard, HTML5, a new version of HTML, the main markup language for the web is under development. This is the first version for quite some time, HTML4.01, the current version, was released in December, 1999. There was an XML version, XHTML 1.0, XHTML (Released in January 2000 and revised August 2002), but it did not contain any new features.

Much of the buzz around HTML5 concentrates on new features such as video (as an alternative to using flash plugins etc) and canvas (a JavaScript API for 2 dimensional graphics), but in this article I want to look at the features that impact on the kind of technical, mathematical documents used by NAG.

SVG and MathML

SVG is an XML format for describing scalar graphics, using a similar graphics model to PostScript or PDF, but using XML syntax and CSS for styling, just as for HTML. It has been around for some years, but HTML5, for the first time, specifies how it works in the context of HTML (rather than XML). In a related move, Internet Explorer 9 will support SVG. (Other common browsers have supported it for some years.)

Many of the function plots in the NAG documentation are generated from gnuplot. Gnuplot can save to SVG as well as the EPS and PNG outputs that we currently use. Also the remaining diagrams are currently stored as EPS (for use in PDF versions of the document) and EPS can usually be converted without any loss of information to SVG.

There are many advantages to using a scalable format for plots, especially documents that are read on smaller devices such as tablets (or phones), but also printing at higher resolution; being able to scale and zoom in as required without the loss of quality inherent in scaling bitmap images is a big win.

The other XML-derived language supported natively by the HTML5 parser is MathML. MathML should be familiar to most NAG users as it has been used in the XHTML version of our documentation for years. However being able to use MathML in HTML should hopefully simplify the installation of this documentation, and also the prominence given to MathML by its inclusion in HTML5 will also hopefully encourage the remaining browser vendors, who do not natively support it, to implement mathematics rendering in their browsers.

Current State of (Future) Browsers

All the common desktop browsers are moving towards supporting HTML5 in the near future. The following sections list the state of SVG and MathML rendering in some common cases.

Internet Explorer 9 Beta

IE 9 finally adds SVG support to Microsoft's Internet Explorer browser. Design Science's MathPlayer may still be used to get very high quality rendering of MathML. There are currently some problems in interfacing MathPlayer and IE 9, and some of the markup that worked in IE 8 no longer works, however this may be fixed before the full product comes out, or a few lines of IE-specific javascript, as used in the example below, may be used to work around the main problems.

Warning: IE 9 Beta, unlike all the other test releases of browsers mentioned here will replace your existing Internet Explorer installation. If you wish to test IE 9 rendering without removing your IE 8 (or earlier) installation make sure that you install the Platform Preview rather than the Beta. The platform preview releases use the IE 9 rendering engine but without all the normal browser menus and facilities, and it does not replace your existing browser.

IE 9 Beta 1 was tested.

Firefox 4.0 Beta

Firefox 4 uses the new HTML5 parser which automatically places MathML elements in the MathML namespace and SVG elements in the SVG namespace. The rendering of MathML and SVG in HTML 5 is then essentially exactly as has been available in earlier Firefox releases in XHTML documents, but now also available in HTML.

Firefox 4 Beta 6 was tested.

WebKit Nightlies

A Nightly release is a public binary release that is essentially just a snapshot of the current development build. As such it is expected to have bugs and unimplemented features. However these releases, which show the development state of the core rendering engine used by both Chrome and Safari browsers show that it has a reasonably well developed SVG renderer, and that MathML support, while very new, is improving. (These WebKit browsers have very good CSS support so until the native MathML is ready for use it will probably be possible to use a CSS rendering of MathML in these cases, as is done for the current NAG XHTML documentation).

WebKit-r67637, from 16th September was tested.

An Example

We do not yet have any definite plans or dates to move towards using HTML5, it depends a lot on the timing of the above test releases becoming mainstream (which is likely to be very soon) and how long it takes for use of older browsers to die out. (This can take a long time, many people only change their browser when they get a new machine, Internet Explorer 6 (released in 2001 and replaced by IE 7 in 2006 and IE 8 in 2009) is still in widespread use for example.)

As an experiment we have converted one example routine document into HTML5, using inline MathML and SVG. Note in the example all links to external documents have been made to point back to the test document so that it is self-standing. The document has 207 MathML fragments, which are essentially unchanged from the existing XHTML+MathML version of the document, the two plots shown in the example section, which were previously only available as monochrome scalable images in the PDF version of the document, or a coloured PNG bitmaps in the XHTML version, are provided as scalable SVG which is directly included into the HTML file, not referenced using <img src=....

The document is reported as valid HTML5+SVGMathML by the online validator.

The document appears to be perfectly usable in Firefox 4 and IE 9. The MathML support in WebKit is still very new, and there also appear to be some problems with the SVG which get rendered with a black background in the Windows nightly build of 16th September. Note however that, as their name suggests nightly builds are unstable test releases and should not be taken as indicative of the final product. The fact that the SVG was fully rendered apart from some colour problems, and that the MathML was recognized, albeit with some rendering problems, is I think a good sign that WebKit based browsers (Safari, Chrome, and many mobile phone browsers) will support these documents in the near future.

Fortran Library Mark 22 Routine Document (D02AGF)
XHML+PNG+MathML Mark 22 Documentation d02agf.xml
PDF Mark 22 Documentationd02agf.pdf
HTML5+SVG+MathML Experimental d02agf.html


HTML5 will be mainstream in currently popular browsers very soon, it will take a few years before its use may be assumed, but it promises to be a big improvement for technical documents.

Both MathML and SVG allow the use of scalable formats freeing the web from the use of inappropriate bitmap images. This simplifies document distribution and should improve the quality both for printing and for use on a wider range of devices, including greatly increased accessibility.

Monday, 13 September 2010

Do you want ice with your supercomputer?

Would you like ice with your drink?” It’s a common question of course. One that divides people – few will think “I don’t mind” – most have a firm preference one way or the other. There are people who hate ice with their drink and those who freak if there is none. National stereotypes have a role to play – in the USA the question is not always asked – it’s assumed you want ice with everything. In the UK, you often have to ask specifically to get ice.

Yet the role of ice in making our drinks chilled is misleading. I once had a discussion with a leading American member of the international HPC community about this. “No ice”, he was complaining as we headed out of a European country, “they had no ice for the drink”.

I don’t get this obsession with ice”, I chipped in. “What?!” He looked at me as if I were mad. “Why do you like your coke warm?

Ah, but that’s just it”, I replied. “I hate warm drinks – I really like my coke chilled. But surely, in this modern world over a century after the invention of the refrigerator, it’s not unreasonable to expect the fluid to be chilled – without the need to drop lumps of solid water into it?

Ah, fair point”, he conceded.

What has this got to do with supercomputing? Perhaps the common thread is that usually we just accept the habitual choices of ways to do things – and don’t often step back to think – “are those the only choices?

Maybe we should step back a little more often and ask ourselves what we are trying to achieve with HPC – and are the usual choices the only ways forward? Or are there different ways to approach the problem that will deliver simpler, better or cheaper performance?

Perhaps your business/research goals mean you need to conduct more complex modelling or you need faster performance. Maybe the drive of computing technology towards many-core processors rather than faster processors is limiting your ability to achieve this. (I have had several conversations recently, where companies are buying older technology because their software won’t run on multicore).

The “ice or no ice” question might be whether or not to upgrade your HPC with the latest multicore processors. But what about the “just chill the fluid” option? Well, how about upgrading the software instead, or as well?

NAG has plenty of case studies to show where enhancements to software have achieved huge gains in performance or capability (e.g.,

Sometimes buying more compute power is the right answer. Sometimes, extracting more efficient performance from what you have is the answer. Bringing them together - a balance of hardware upgrades and software innovations might well give you the best chance of optimising cost efficiency, performance and sustainability of performance.

Wednesday, 8 September 2010

Working on the ADVISE project

For the past three and a half years, my colleagues and I have been working on ADVISE, a TSB-funded collaborative research project which has been developing a new toolkit for visualization and analysis. Besides NAG, the partners in the project were VSNi and the University of Leeds. VSNi have expertise in statistics, as implemented in their GenStat product, while Leeds have an international reputation for their work in visualization research. As for NAG, we've had some success with IRIS Explorer, a popular visualization toolkit which allows users to construct applications by connecting modules together via a visual programming interface.

We retained that interface in ADVISE (see Figure 1) because it has proved to be a rather intuitive way to create, modify and interact with applications. Thus, in this figure, the user selects modules from the repository on the right and connects them together in the area on the left. The widgets for controlling one of the modules are in the pane on the right at the bottom, whilst messages from the system are displayed in the area at top right.

In a similar spirit of re-use, the visualization and analysis functionality encapsulated within the ADVISE modules has come from porting just about all of the modules from IRIS Explorer into the new environment, and creating new modules that generate and process scripts of GenStat commands. We've used ADVISE to visualize and analyze a variety of data - see, for example, Figure 2, which is a display of some of the results from Christoper Goodyer's simulations of diffusion through skin.

So much for the re-use of old technology, but what's new in ADVISE? Well, its architecture makes use of recent technology developments in web services and distributed computing. This has several advantages, including the fact that it's easier to integrate applications built using ADVISE with the web (for example, running inside a browser), and that it's possible to connect ADVISE applications to other services (which could, for example, act as data sources).

To illustrate this ease of integration, Figure 3 shows a web-based application that's been created in ADVISE for the visualization of air-quality data. The window at the back shows the interface for selecting the location and duration of the data to be visualized, the next window shows that data displayed as a coloured elevated surface and the window in front shows the same data displayed as a 3D histogram. Widgets in the web page (linked to ADVISE modules) give the user a simple interface to the application - for example, allowing control over the type of display (surface or histogram), other parameters associated with the visualization, and selection of the next dataset to be displayed.

If you want to know more about the ADVISE project, or the system we produced, head over to our web page, which contains more pictures of visualizations created with the toolkit together with papers, posters and talk slides from throughout the life of the project. One picture you won't find over there, however, is the one below, which shows the whole ADVISE team (with the exception of Jungwook Seo and Colin Myers from Leeds) in all their glory at the end of the final project review meeting last month. There were (a lot of) other pictures taken at the same event, but this is the only one in which the project members aren't holding glasses.