NAg (Numerical Algorithms Group fortran maths libraries)

This library is now DEPRECATED in DAMTP and will not be available from July 2013

Please use other software libraries such as lapack

Scientific and High Performance Computing support is available.


NAg is the Numerical Algorithhms group fortran maths libraries. You should be able to compile/link against them by simply using one of:

	gfortran -o myfile myfile.f -lnag_nag
        ifort program.f -lnag_nag

where -lnag_nag tells the compiler to include routines from the nag library (libnag_nag). nag_nag is used for the classic Fortran-77 style library although these days it actually requires the use of a Fortran 9x compiler - which is why g77 versions are no longer available.

On the Linux machines the classic fortran library versions used by default are as follows:

Arch Compiler NAg implementation Version link line
i386 gfortran fll3a22dfl MK22 -lnag_nag
x86_64 gfortran fll6a22dfl MK22 -lnag_nag
i386 ifort (9.1) fllux21dcl MK21 -lnag_nag
x86_64 ifort64 (9.1) fll6i21dcl MK21 -lnag_nag
i386 ifort11 (11.1) fllux22dcl MK22 -lnag_nag
x86_64 ifort11 (11.1) fll6i22dcl MK22 -lnag_nag

This is arranged by various symbolic links, from the standard system library search locations (/usr/lib/ for 32-bit and /usr/lib64 for 64-bit), for use with gfortran or gcc, and from the intel compiler installation trees for use with ifort or icc.

For other compilers or NAg libraries we do not arrange for the right versions to be used automatically. If you plan to use other versions you will need the paths to the specific implementations we have and how to use -L to pick the right places to get the libraries picked up.

If you need to use NAg routines with other compilers or other NAg libraries please email help.

Note that unlike some previous versions mk21 and mk22 require a runtime licence check so cannot be used to build applications which can then be used on machines outside the site (unless they have a licence too). Not all the routines check the licences right away and it can be utterly confusing to find code failing apparently at random while running.

Below are the answers to some fortran queries the helpdesk have received

Question:

I would like to couple a fortran program using the NAg library to a C++ program, how to do this?

Answer:

If you are using the fortran-77 numerical library you need to do the final linking with a compiler which is compatible with the one used to build the library itself. Thus for the ifort-compiled 77 library you need to link using ifort, for the gfortran compiled one you must use gfortran etc.

If in doubt ask us for help!

Question:

My program gives compile errors which include undefined reference to `pthread_create' and undefined reference to `pthread_join'

Answer:

Add -lpthread to the command, ie

   ifort d02nbfe.f -lnag_nag -lpthread

In this case the error message mentioning pthread_create/pthread_join was a give-away but it isn't always easy to guess what extra libraries are needed to resolve such undefined reference errors.

Useful Link