CHPC Software: NAG Library

Due to limited demand and high licensing costs, we have discontinued NAG licensing. If you have a need for NAG, please, contact CHPC at issues@chpc.utah.edu. Below is the instructions that we used when our license was active.

Numerical Algorithms Group, mathematical Fortran and C subroutines library.

Below are links for documentation for the appropriate library. We recommend to follow the intructions for the platforms specified below first with one of the numerous examples that are located in the directory tree of each library. Refer to the links below for detailed documentation on the library routines and their use.

Notes on installation on the CHPC machines

NAG library is located in /uufs/arches/sys/pkg/nag/. The latest Fortran library is in /uufs/arches/sys/pkg/nag/FL, it is Mark 21 for use with GNU, PGI or Pathscale compilers. The latest C library is in /uufs/arches/sys/pkg/nag/CL/std and is designed for use with GNU compilers and compatibles (i.e. most other compilers such as PGI or Pathscale). All x86-64 NAG libraries use AMD's ACML library for high performance BLAS and LAPACK.

The steps to link the NAG libraries to your code are as follows:

  1. Source file that defines environment for NAG:
    • source /uufs/arches/sys/pkg/nag/FL/std_comp/etc/nagf.csh (for Fortran library and csh/tcsh)
    • source /uufs/arches/sys/pkg/nag/CL/std/etc/nagc.csh (for C library and csh/tcsh)
    • source /uufs/arches/sys/pkg/nag/FL/std_comp/etc/nagf.sh (for Fortran library and ksh/bash)
    • source /uufs/arches/sys/pkg/nag/CL/std/etc/nagc.sh (for C library and ksh/bash)
  2. where std_comp is either std_gnu for GNU Fortran, std_pgi for PGI Fortran or std_psc for Pathscale Fortran.
  3. Compile with selected Fortran compiler, e.g.:
    • g77 -O3 program.f -L/uufs/arches/sys/pkg/nag/FL/std_gnu/lib -lnag -L/uufs/arches/sys/pkg/acml/std/gnu64/lib -lacml -o executable.exe
    • pgf77 -fastsse program.f -L/uufs/arches/sys/pkg/nag/FL/std_pgi/lib -lnag -L/uufs/arches/sys/pkg/acml/std/pgi64/lib -lacml -o executable.exe
    • pgf90 -fastsse program.f -L/uufs/arches/sys/pkg/nag/FL/std_pgi/lib -lnag -L/uufs/arches/sys/pkg/acml/std/pgi64/lib -lacml -o executable.exe
    • pathf90 -Ofast program.f -L/uufs/arches/sys/pkg/nag/FL/std_psc/lib -lnag -L/uufs/arches/sys/pkg/acml/std/pathscale64/lib -lacml -o executable.exe
  4. or with choice of C compiler, e.g.:
    • gcc -O3 program.c -I/uufs/arches/sys/pkg/nag/CL/std/include -L/uufs/arches/sys/pkg/nag/CL/std/lib -lnagc -L/uufs/arches/sys/pkg/acml/std/gnu64/lib -lacml -lg2c -lpthread -lm -o executable.exe

Note that for the C library we include path to C header files and also link GNUs Fortran to C library (g2c) and pthread and math (m) libraries.

Also note that the license is also required during the runtime. Additionally, both libnag and libacml are provided in both static and dynamic form, dynamic being the default. In order to get the right license and the right search path to the libraries, one must source the NAG source files in login scripts ( .tcshrc, .bashrc) before running program compiled with NAG.

Last Modified: October 06, 2008 @ 21:07:46