Mark 26 C and FORTRAN Libraries

Overview

This is mark 26 of the NAG Library. The following versions are available (see modulefiles below):

  • CLL6I26DCL – C library for Intel compiler – serial version
  • FLL6I26DCL – FORTRAN library for Intel compiler – serial version
  • FSL6I26DCL – FORTRAN library for Intel compiler – parallel SMP version

Set up procedure

We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job inherit these settings.

You should load the Intel compiler modulefile:

module load compilers/intel/17.0.7

Then load one of the following modulefiles:

module load libs/intel/nag/c_mark26_intel                 # Version CLL6I26DCL
module load libs/intel/nag/fortran_mark26_intel           # Version FLL6I26DCL
module load libs/intel/nag/fortran_smp_mark26_intel       # Version FSL6I26DCL

This will set the following environment variables for easy access to the libraries, header files and example scripts:

NAG_HOME       = /opt/apps/libs/intel/nag/version

# The following environment variables have the value added to any existing setting
LIBRARY_PATH   = $NAG_HOME/lib
C_INCLUDE_PATH = $NAG_HOME/include
PATH           = $NAG_HOME/scripts

The version directory will be the lowercase version code, for example cll6i26dcl

Compiling the example programmes

The NAG library ships with example programs for every routine available. The easiest way to compile the examples is to use the supplied scripts as details below. These also show you the full compilation commands which may help with compiling your own software.

We list the scripts available in each version of the NAG library and then show an example usage below.

C Library – CLL6I26DCL

The following scripts are available, which can be run directly from a jobscript:

nagc_example         nagc_example_mkl     
nagc_example_shar    nagc_example_shar_mkl

which provide easy to use interfaces to compile, link and run each of these examples. This scripts directory is added to your PATH environment variable for convenience. The differences between these scripts are shown below:

  • nagc_example, to link with the NAG self-contained static library libnagc_nag.a
  • nagc_example_shar, to link with the NAG self-contained shareable library libnagc_nag.so
  • nagc_example_mkl, to link with the NAG static library libnagc_mkl.a and the supplied MKL libraries
  • nagc_example_shar_mkl, to link with the NAG shareable library libnagc_mkl.so and the supplied MKL libraries

FORTRAN Libraries – FSL6I26DCL and FLL6I26DCL

The following scripts are available, which can be run directly from a jobscript:

nag_example         nag_example_mkl
nag_example_shar    nag_example_shar_mkl
nag_recompile_mods

The scripts are as above but notice the scripts begin with nag_ and not nagc. The extra nag_recompile_mods script will recompile the FORTRAN .mod supplied with the library in to a local directory.

Running the scripts

These can be used to inform you how to compile the NAG library according to your needs. The scripts will copy the source code to your current working directory, compile the source code and then run it.

For example, to compile, link and run the example for the routine a00aac using the NAG static library libnagc_mkl.a and the NAG-supplied MKL libraries you would submit a jobscript containing:

#!/bin/bash --login
#$ -cwd
#### Optionally request more 2 or more cores if using the NAG SMP library
#### #$ -pe smp.pe 4

module load compilers/intel/17.0.7
module load libs/nag/c_mark26_intel

# Even though we are using the NAG serial library, the Intel MKL libraries
# may use OpenMP multithreading. So we must always inform OpenMP of how many
# cores our job is permitted to use.
export OMP_NUM_THREADS=$NSLOTS

nagc_example_mkl a00aac 

To link against the shared library libnagc_mkl.so use the following command in your jobscript;

nagc_example_shar_mkl a00aac

Submit your job using

qsub jobscript

where jobscript is the name of your jobscript.

The output from the nagc_example_mkl script is

Copying a00aace.c to current directory
cp /opt/apps/libs/intel/nag/cll6i26dcl/examples/source/a00aace.c .

Compiling and linking a00aace.c to produce executable a00aace.exe
icc -I/opt/apps/libs/intel/nag/cll6i26dcl/include a00aace.c \
    /opt/apps/libs/intel/nag/cll6i26dcl/lib/libnagc_mkl.so \
    -L/opt/apps/libs/intel/nag/cll6i26dcl/mkl_intel64_11.3.3/lib \
    -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core \
    -L/opt/apps/libs/intel/nag/cll6i26dcl/rtl/intel64 \
    -liomp5 -lpthread -lm -ldl \
    /opt/apps/libs/intel/nag/cll6i26dcl/rtl/intel64/libifcoremt.so -o a00aace.exe

Running a00aace.exe
./a00aace.exe > a00aace.r

Among other things, the above shows you the form of the icc command that NAG recommend for this usage case. The output from running the example will be contained in the file a00aace.r.

Further Information

Last modified on November 20, 2018 at 4:52 pm by George Leaver