NAG Fortran compiler available on Apocrita for SEF

Posted on Mon 18 March 2019 in news by Iain Barrass

The School of Economics and Finance has a departmental licence for the Fortran compiler from NAG. The compiler, release 6.2, is now available on Apocrita.

Using the compiler

The compiler is available through a module on the cluster:

$ module load nagfor/6.2-6227
$ nagfor -V
NAG Fortran Compiler Release 6.2(Chiyoda) Build 6227
Product NPL6A62NA for x86-64 Linux
Copyright 1990-2018 The Numerical Algorithms Group Ltd., Oxford, U.K.

Documentation for the compiler is available as a collection of man pages, such as man nagfor for the compiler itself and man nag_modules for an introduction to the intrinsic modules provided by the compiler. Further detail on the individual modules is also available as man pages, with man f90_unix, for example. The full compiler manual is also available.

When developing your Fortran code we recommend that you use as wide a variety of compilers as possible. The NAG Fortran compiler in particular has very good diagnostics for detecting violations of the Fortran standard and other questionable practices (which may include bugs). To enable most run-time checks use the option -C when compiling. For even greater checking use -C=all.

Considerations

The NAG Fortran compiler we have installed offers very good support for the Fortran 2003 standard and several features from Fortran 2008. However, when compiling your code developed using a different compiler you should be aware of the differences in available features.

Further, as suggested above, the NAG Fortran compiler may appear "fussy" when compiling code. Many extensions to the Fortran standard offered by other compilers may not be accepted by this compiler. Equally, although it is common to use literal constants for type kind parameters, such as in

integer(8) li
real(16) x

the NAG Fortran compiler does not use this same numbering scheme by default. If you have written code like this for gfortran or ifort you may see error messages:

Error: KIND value (8) does not specify a valid representation method
Error: KIND value (16) does not specify a valid representation method

It is possible to use the compile-time option -kind=byte to use this numbering scheme, but we strongly advise against this. With this option it will also be necessary for all used modules to be similarly compiled.

Other compiler options may be different from those expected from using other compilers, or the behaviour of an option may be distinct: see the compiler's documentation for details of command-line options,

For advice on porting your code to use the NAG Fortran compiler, please contact the RSE team in ITSR.

Getting access to the compiler

If you wish to use the compiler, and are in SEF, please contact us to be added to the licence group. Further, if you would like packages to be built compatible with the compiler, please complete the application form, mentioning nagfor.

Other compilers available on Apocrita

All users of Apocrita have access to the GCC, Intel and PGI compiler suites installed there. These provide C and C++ compilers in addition to Fortran compilers. Detail of using these compilers can be found on our documentation site.