# 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:  echo$NAG_KUSARI_FILE
/usr/local/nag/nag.kusari.lic


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:

	NE_NO_LICENCE:


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, PGI pgf77, Double Precision

Full documentation: http://www.nag.com/numeric/fl/manual/html/FLlibrarymanual.asp.

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

libnag_nag.a             - Static,  NAG BLAS/LAPACK
libnag_nag.so            - Dynamic, NAG BLAS/LAPACK
libnag_acml.a            - Static,  BLAS/LAPACK
libnag_acml.so           - Dynamic, BLAS/LAPACK


Note:

• You must be logged into a system which is licensed for PGI (ares, hera, thor, achilles, charon, juno, jupiter, pandora).
• Use of a static library results in a faster execution and more portable code. Use of a dynamic library resuts in a smaller executable and you don't need to relink to take advantage of patches.

To use the NAG Fortran Library and the supplied ACML libraries (ACML = AMD Core Math Library), you may link in the following manner:

pgf77 driver.f /usr/local/NAG/fll3a21dpl/lib/libnag_acml.a \

where driver.f is your application program

If you have problems when calling a NAG routine using libnag_acml.a or libnag_acml.so as described above, you may use the self-contained libraries as follows:

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

Full documentation: http://www.nag.com/numeric/fl/manual/html/FLlibrarymanual.asp.

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

libnag_nag.a             - Static,  self-contained libraries
libnag_nag.so            - Dynamic, self-contained libraries
libnag_mkl.a             - Static,  MKL libraries
libnag_mkl.so            - 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 \

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:

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

Full documentation: http://www.nag.com/numeric/CL/nagdoc_cl08/html/CLlibrarymanual.asp.

Both static and dynamically linked libraries are available:

	libnagc_nag.a     - Static
libnagc_nag.so    - Dynamic


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

gcc driver.c -I/usr/local/NAG/cllux08dgl/include \

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

	libnagc_mkl.a     - Static
libnagc_mkl.so    - 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 \