NAG Libraries

NAG Libraries

We have 6 versions of the NAG libraries available, 3 32-bit libraries, and 3 64-bit libraries:

The NAG libraries are licensed softwarre. In order run programs linked against the NAG libraries, the programs must be able to contact the SNS license server. This is controlled by the environment variable NAG_KUSARI_FILE. This variable should be set for you automatically at log in time. You can check that it is set to the correct value using the command echo $NAG_KUSARI_FILE:


If it's not set to the correct value, you'll get an error like this when trying to run a program that uses the NAG libraries:

  Sorry invalid usage - Have you got a valid licence? If not please contact NAG.

If you get an error like this, please check to make sure that the value of the NAG_KUSARI_FILE environment variable is set correctly as shown above. If it is set incorrectly and you use the bash shell, you can set it to the correct value like this:

	export NAG_KUSARI_FILE=/usr/local/nag/nag.kusari.lic.

If you use the tcsh shell, you can set it to teh correct value using the setenvcommand:

	setenv NAG_KUSARI_LICENSE /usr/local/nag/nag.kusari.lic

If you are still have problems running your program, contact SNS Computing.

NAG Fortran Library, Mark 21, x86-32 Linux, GNU g77, Double Precision

Full documentation:

Both shared and dynamic libraries are available in /usr/local/NAG/fllux21dgl/lib:

libnag_nag.a             - Static,  self-contained libraries            - Dynamic, self-contained libraries
libnag_mkl.a             - Static,  MKL libraries            - Dynamic, MKL libraries

To use the NAG Fortran Library and the supplied MKL libraries (MKL = Intel Math Kernel Libraries), you may link in the following manner:

g77 driver.f /usr/local/NAG/fllux21dgl/lib/libnag_mkl.a \
-L/usr/local/NAG/fllux21dgl/mkl_32 -lmkl_lapack32 -lmkl_p4 -lvml -lmkl_vml_p4 \
-lmkl_lapack -lguide -lpthread

where driver.fis your application program.

If you prefer to link to a version of the NAG library which does not require the use of the MKL libraries, you may wish to use the self-contained libraries as follows:

g77 driver.f /usr/local/NAG/fllux21dgl/lib/libnag_nag.a -lpthread

NAG C LIbrary, Mark 8, x86-32 Linux, GNU gcc

Full documentation:

Both static and dynamically linked libraries are available:

	libnagc_nag.a     - Static    - Dynamic

To use these libraries you may link to the NAG C Library as follows:

gcc driver.c -I/usr/local/NAG/cllux08dgl/include \
/usr/local/NAG/cllux08dgl/lib/libnagc_nag.a -lpthread -lm

Libraries linked with the Intel Math Kernel Libraries are also available:

	libnagc_mkl.a     - Static    - Dynamic

Use of the Intel Math Kernel Libraries should result in a faster executable. In this case you may link to the NAG C Library as follows:

gcc driver.c -I/usr/local/NAG/cllux08dgl/include \
/usr/local/NAG/cllux08dgl/lib/libnagc_mkl.a \
-L/usr/local/NAG/cllux08dgl/mkl_32 -lmkl_lapack \
-lmkl_ia32 -lguide -lpthread -lm

NAG Fortran Library, Mark 21, 64 bit Linux, GNU g77, Double Precision

NAG C Library, Mark 8, 64 bit Linux, GNU gcc