How the unification changes to the NAG Library (Mark 27) benefit our users

Here at NAG we're really excited about the latest version of the NAG Library, Mark 27, which is available now. As usual, it's involved an immense amount of effort from NAG staff, both development and commercial, and we've listened to many great ideas from our users and implemented them in the new Mark. For a full list of exciting new functionality click here.

User Benefits:

  • At Mark 27 the NAG Library for C, Fortran and Algorithmic Differentiation are unified – on the NAG website you will see unified product downloads and documentation
  • For Linux versions of the NAG Library, we now have "nagvars" shell scripts which will set up environment variables that help you get correct compile and link command lines
  • The selection of the correct NAG Library becomes simpler because we now package C/C++, Fortran, 32-bit integer and 64-bit integer versions together in one package

Internally, NAG's development team have been calling this new Mark the "Unified Library". Why? Traditionally, we have produced a Fortran Library, a C/C++ Library, and wrapper code in various other languages which allow use of these compiled libraries in other environments. To cater for as many people as possible, we built variants with different integer sizes (32-bit or 64-bit) as well as using different compilers.

With the Unified Library our aim has been to combine some of these variants. Instead of having separate Libraries for C/C++ and Fortran, they've been combined into a single library which can be used as a replacement for older Marks of either library (and there should be no need to change your code). The documentation for C, C++ and Fortran has been combined too. You can see the main entry page of the Mark 27 NAG Library Manual here

As an example, take a look at one routine in particular; e04ab, a simple routine that searches for a minimum of a function of a single variable. This link takes you to the C specification.

Want to see the corresponding Fortran call? Click on the second of the FL links in the sidebar. Since there's an AD (Algorithmic Differentiation) variant of this routine too, you can click on the AD sidebar link to get to the spec of that variant. (If there hadn't been an AD variant, the link would be inactive). Go back to the Fortran variant, and look at the bottom of the left-hand sidebar. See that button labelled "Show settings"? Click it, and you can choose whether you want this routine document to show signatures for calling from any or all of Fortran, C or C++. You can also choose here whether you want to see descriptive NAG routine names like nagf_opt_handle_solve_socp_ipm or traditional-style NAG short names like e04ptf.

We also made the decision to stop producing PDF versions of NAG Library documentation. More and more we've found that our users prefer to use HTML documentation, so not producing PDF saves us time and effort (though not as much time and effort as when we stopped producing printed documentation a number of years ago!). If you want the occasional PDF document, many browsers will let you view an HTML file and choose "print to PDF" to do what you need.

For Linux versions of the NAG Library, an innovation we're introducing at Mark 27 is to have "nagvars" shell scripts which will set up environment variables that help you get correct compile and link command lines when using NAG. This can insulate you from changes for different platforms or different compilers, and also makes it less troublesome in future when we change Library names, for example when a new Mark arrives.

Importantly, for NAG users, using the NAG Library becomes simpler too - there's less chance of having the "wrong" NAG Library implementation installed; there’s no need to decide in advance if you need C++, Fortran, 32-bit or 64-bit integers; and it's easier to switch to different languages when you need to.

Another advantage of the unified NAG Library is that it is simpler to build and test than multiple separate libraries; this gives NAG’s development team more time to develop and release new content in the future.

Another big plus is that, for the increasing number of our users who like to use the NAG Library for Python, Python interfaces are available at exactly the same time as the Fortran, C or C++ interfaces. For convenience, Python documentation contains links to equivalent NAG Library FL Interface documentation, so we've now added "long names" to the Fortran documentation to reinforce that link.

Note that Java interfaces for Mark 27 will also be steaming down the line, and Mark 27 is still callable from other environments like Excel on Windows.

So, what new functionality is introduced at Mark 27? Here are some of the highlights:

Finally - did I mention that we're excited about Mark 27? I hope you will be too!    

Author
Comments
L
Lian
Does it mean all routines from Nag C++ 26.1 should produce identical results as 27? If so, it would significantly lower our migration effort
LMNL
Lawrence Mulholland, NAG Ltd
While we would expect the same routine from two different marks of the library to produce numerically comparable results, we cannot guarantee the results will be bit-wise reproducible (BWR), and this has not changed with the introduction of the unified library.
As explained <a href="https://www.nag.com/numeric/nl/nagdoc_27/nlhtml/genint/howtounl.html#bit-wisebwr">here</a>, BWR is very difficult to guarantee on modern architectures without sacrificing performance.

The implementation changes from Mk26.1 to Mk27 that might affect BWR are:
- using a later version of compiler
- using the correspondingly later version of vendor math library.



However progress continues to be made on this as compiler options and environment variables, designed to minimise bit-wise variations, become available. For example, when using latest versions of the Intel compiler, we can now generate multiple codepaths (as before) such that the default choice on each processor can be overridden at run-time to make it choose a different (consistent) path. Read
<a href="https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/optimization-and-programming-guide/processor-targeting/cpu-spoofing.html">cpu spoofing</a> to find out more about this. This feature is not used in relevant implementations of Mk27 because it was not fully available at the time of release, but will be used at future marks.
Leave a Comment