# NAG

## Description and Overview

The Numerical Algorithms Group (NAG) library is a comprehensive math library that is usually considered the British analogue of IMSL. The functionality is comparable to that of IMSL. The version on Carver is double precision.

## How to Use NAG on Carver

**NOTE:** There are a limited number of NAG licenses on Carver, and access to the NAG libraries is granted only to the people whose work is **critically** dependent on the software. Many NAG functionalities can be found in other math libraries, such as LAPACK, PARPACK, GSL (GNU Scientific Library), FFTW, etc., that are available on Carver. If your work doesn't have to depend on NAG, please look for these alternatives. If you need help with that or if you need to use the NAG software, please contact the consultants.

There are PGI, GNU and Intel versions available on Carver. The module names for them are nag, nag-gnu, and nag-intel respectively. Load an appropriate module and then build an executable as follows:

% module load nag # using the PGI version

% mpif90 -o myprogram myprogram.f90 $NAG

You can separate the compile and link stages, too:

% mpif90 -c myprogram.f90 $NAG_INC

% mpif90 -o myprogram myprogram.o $NAG

Then, run the executable, myprogram, on compute nodes, by using 'mpirun -np ... ./myprogram' in your batch script.

## Example Programs

NAG example programs can be accessed by the command nagexample. For example, the following example is to build and run c02affe example code in an interactive batch job:

% qsub -I -lnodes=1:ppn=8 # interactive batch job to run on compute nodes

qsub: waiting for job 585157.cvrsvc09-ib to start

qsub: job 585157.cvrsvc09-ib ready

% cd $PBS_O_WORKDIR

% module load nag

% nag_example f02gbf

The last command will copy the source code of the specified example program and its data from the $NAG_DIR/examples direcotry into the files f02gbfe.f and f02gbfe.d in the current directory; compile, link, and execute the example; and write its results to stdout. Further usage details may be obtained by using the command nag_example without arguments.

## Documentation

For NAG on-line documentation in HTML/PDF format, see the NAG website. You can make use of NAG's search tools for keywords or routine names; you can also use their Site Map. See also the Library Manual.

## Background

The NAG Fortran Library is a comprehensive collection of Fortran routines for the solution of numerical and statistical problems. The word routine is used to denote subroutine or function.

The library is divided into chapters, each devoted to a branch of numerical analysis or statistics. Each chapter has a three-character name and a title, e.g.,

D01 - Quadrature

All documented routines in the Library have six-character names, beginning with the characters of the chapter name, e.g.,

D01AJF

Note that the second and third characters are digits, not letters; e.g., 0 is the digit zero, not the letter O. The last letter of each routine name always appears as F in the commercial documentation, but it appears as E in single-precision versions.

## Availability at NERSC

Package | Platform | Category | Version | Module | Install Date | Date Made Default |
---|---|---|---|---|---|---|

NAG | carver | libraries/ programming | 21 | nag/21 | 2010-03-28 | |

NAG | carver | libraries/ programming | 21 | nag-gnu/21 | 2010-03-28 | |

NAG | carver | libraries/ programming | 22 | nag/22 | 2010-03-19 | 2010-03-19 |

NAG | carver | libraries/ programming | 22 | nag-gnu/22 | 2010-03-19 | 2010-03-19 |

NAG | carver | libraries/ programming | 23 | nag-intel/23 | 2011-08-19 | 2011-08-19 |

NAG | carver | libraries/ programming | 23 | nag-gnu/23 | 2012-04-14 | 2012-04-14 |

NAG | carver | libraries/ programming | 24 | nag-intel/24 | 2013-05-10 | 2014-08-07 |

NAG | carver | libraries/ programming | 24 | nag/24 | 2014-05-23 | 2014-08-07 |

NAG | carver | libraries/ programming | 24 | nag-gnu/24 | 2014-05-23 | 2014-08-07 |

NAG | carver_sl6 | libraries/ programming | 21 | nag/21 | 2014-08-15 | |

NAG | carver_sl6 | libraries/ programming | 21 | nag-gnu/21 | 2014-08-15 | |

NAG | carver_sl6 | libraries/ programming | 22 | nag/22 | 2014-08-15 | |

NAG | carver_sl6 | libraries/ programming | 22 | nag-gnu/22 | 2014-08-15 | |

NAG | carver_sl6 | libraries/ programming | 23 | nag-gnu/23 | 2014-08-15 | |

NAG | carver_sl6 | libraries/ programming | 23 | nag-intel/23 | 2014-08-15 | |

NAG | carver_sl6 | libraries/ programming | 24 | nag/24 | 2014-08-15 | 2014-08-15 |

NAG | carver_sl6 | libraries/ programming | 24 | nag-gnu/24 | 2014-08-15 | 2014-08-15 |

NAG | carver_sl6 | libraries/ programming | 24 | nag-intel/24 | 2014-08-15 | 2014-08-15 |