Mark 26.2 C Libraries

Overview

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

  • CLL6I262CL – C library for Intel compiler – serial version

No FORTRAN library is currently available for mark 26.2.

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.2_intel               # Version CLL6I262CL

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 cll6i262cl

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 – CLL6I262CL

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

nagc_example              
nagc_example_shar

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. Add the flag -mkl to link against the Intel MKL BLAS and LAPACK libraries.
  • nagc_example_shar, to link with the NAG self-contained shareable library libnagc_nag.so. Add the flag -mkl to link against the Intel MKL BLAS and LAPACK libraries.

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.2_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 script is

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

Compiling and linking a00aace.c to produce executable a00aace.exe
icc -I/opt/apps/libs/intel/nag/cll6i262cl/include a00aace.c \
    /opt/apps/libs/intel/nag/cll6i262cl/lib/libnagc_mkl.so \
    -L/opt/apps/libs/intel/nag/cll6i262cl/mkl_intel64_11.3.3/lib \
    -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core \
    -L/opt/apps/libs/intel/nag/cll6i262cl/rtl/intel64 \
    -liomp5 -lpthread -lm -ldl \
    /opt/apps/libs/intel/nag/cll6i262cl/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:49 pm by George Leaver