NAG

The Numerical Algorithms Group (NAG) Libraries are numerical libraries for C and Fortran.

Libraries available on ALICE and SPECTRE

Product
Description
MBL6A22DJL
NAG Toolbox for MATLAB
CLL6A23DHL
NAG C library for GNU gcc
FLL6A23DFL
NAG Fortran library for GNU gfortran
FLL6I23DCL
NAG Fortran library for Intel Fortran compiler
FNL6I04DCL
NAG Fortran 90 library for Intel Fortran compiler
FSL6I22DCL
NAG Fortran SMP library for  Intel Fortran compiler
FDL6I03DCL
NAG Fortran MPI library for Intel Fortran compiler and Intel MPI

The NAG Toolbox for MATLAB is available from within the MATLAB environment.

Linking libraries to code

The other NAG products are libraries that must be linked to C or Fortran code. For each product the module file creates an environment variable which holds the compiler flags necessary to link to the NAG libraries.

For example, to link a Fortran 90 program source.f90 to the NAG libraries using the Intel Fortran compiler:

module load nag/fll6i23dcl
ifort ${NAG_FLL6I23DCL} source.f90 -o prog

For each product the command module help nag/product will show an example of how to link the NAG libraries to your own code:

module help nag/fnl6i04dcl

----------- Module Specific Help for 'nag/fnl6i04dcl' -------------

  nag/fnl6i04dcl - loads the NAG F90 Libs for Intel Fortran Compiler (FN64I0DCL)

  Use ${NAG_FNL6I04DCL} or ${NAG_FNL6I04DCL_MKL} when compiling, e.g.:

    ifort ${NAG_FNL6I04DCL} source.f90 -o prog

  or for the MKL version:

    ifort ${NAG_FNL6I04DCL_MKL} source.f90 -o prog

The module file for each product also specifies the NAG licence, so you need to load a NAG module when submitting a NAG-linked job to the scheduler. It doesn't matter which NAG module you use at this stage.

NAG Fortran SMP Library (FSL6I22DCL)

This library uses OpenMP to enable parallelism within a single node. To link to the library:

module load nag/fsl6i22dcl
ifort ${NAG_FSL6I22DCL} source.f90 -o prog

You can submit the job to the scheduler with a submission script like the one below:

#!/bin/bash

#PBS -N NAG_SMP
#PBS -m bae
#PBS -l walltime=01:00:00
#PBS -l nodes=1:ppn=8
#PBS -l pvmem=1g

# NAG module required for licence
module load nag/fsl6i22dcl

# Intel compiler module required for LD_LIBRARY_PATH
module load intel/64/compiler/current

# OMP_NUM_THREADS is required for OpenMP
OMP_NUM_THREADS=$(cat $PBS_NODEFILE | wc -l)

cd $PBS_O_WORKDIR

./prog

NAG Fortran MPI Library (FDL6I03DCL)

This library provides functions which are even more scalable than the SMP libraries and can exploit ALICE further. To link to the NAG MPI libraries it's necessary to use mpiifort:

module load nag/fdl6i03dcl
mpiifort ${NAG_FDL6I03DCL} source.f90 -o prog

The submission script below can be used as an example for submitting a NAG MPI job:

#!/bin/bash

#PBS -N NAG_MPI
#PBS -m bae
#PBS -l walltime=00:20:00
#PBS -l nodes=4:ppn=8
#PBS -l vmem=8g

# NAG module required for licence
module load nag/fdl6i03dcl

# Intel compiler module required for LD_LIBRARY_PATH
module load intel/64/suite

nprocs=$(cat $PBS_NODEFILE | wc -l)

cd $PBS_O_WORKDIR

mpiexec prog

 

 

Share this page: