skip to content

The NAg Fortran 95 compiler. A very correct compiler, useful for software development.

Instructions for users: 

The compiler program is called nagfor, and it is usually available as a module called 'nag', sometimes loaded by default. We have several different version available; see the modules documentation for more detail. In older versions of the compiler the compiler name was 'f95' rather than 'nagfor'. The module's name is 'nag' because 'f95' is too generic.

Licence Details: 

This is commercial licence-managed software. We have a network licence for it under the University's site deal with NAG. The licence server must be available and the licence free in order for you to compile, but you do not need the licence to run the resulting binaries. To make portable binaries it is recommended to use the -unsharedf95 option to link the compiler's libraries statically whilst linking system libraries dynamically.


There is a manpage. NAG provide online documentation at .  Release notes are in $PREFIX/lib/NAGWare/doc. HTML versions of the man pages and the release notes are in $PREFIX/lib/NAGWare/html. $PREFIX is the base location of the compiler you're using. To find it, do which f95 and take off the bin/f95 bit at the end.


The compiler can be downloaded from

Admin notes: 

f95/nagfor calls a C compiler to produce the actual binary. You can specify a different compiler binary with -Wc if you really want to.

The FlexLM licence manager starts issuing warnings to users about three months before the licence expires, which is too early. You can set an environment variable to suppress the warnings, which used to be documented in the NAG FAQ but that's vanished from the NAG website lately.

This compiler comes with a very good installer. It's a shell script - you just run it on the NFS server and input appropriate locations to keep the compiler binaries, libraries, and manpages when prompted. I put them under /usr/local/shared/nag. The locations are not entirely consistent because of the way names have changed with different releases. At the time of writing put the 64-bit versions in /usr/local/shared/nag/nagfor64/majorversion-minorversion/{bin,lib,man} and the 32-bit versions in /usr/local/shared/nag/nagfor/majorversion-minorversion/{bin,lib,man}. The 32-bit version does not work on 64-bit workstations, unlike some of the other compilers.

I only keep a few versions installed because unlike Intel and Portland the only updates we get tend to be bugfix updates. You can find out the minor version of the compiler with f95 -V or nagfor -V.

To have the compiler automatically pass appropriate -rpath options to gcc based on LIBRARY_PATH you must edit the driver script to look something like this:

  /usr/local/shared/nag/f95/5.1-218/lib/NAGWare/f95 -Qpath \ /usr/local/shared/nag/f95/5.1-218/lib/NAGWare \ ${LIBRARY_PATH:+-Wl,-Wl,,-rpath -Wl,-Wl,,$LIBRARY_PATH} "$@" 

You need to create new modules after installing for workstations (in the deb packages) and for clusters (in the /usr/local/shared/nag/Modules/modulefiles64/ directory on the NFS server)

You can test a new install of the compiler with script in the linux-workstation-tests git repository. Load the module and run python standalonenag .

System status 

System monitoring page

Can't find what you're looking for?

Then you might find our A-Z site index useful. Or, you can search the site using the box at the top of the page, or by clicking here.