Updated 2023-03-31

Run Naglib on the Cluster


  • NAG Library algorithms − performance driven − accurate to the core. Algorithms developed to solve complex mathematical problems quickly and easily. Algorithms that are stringently tested, expertly documented, supported and continually updated with new cutting edge algorithmic functionality. Whether in business critical applications or ground-breaking research, good numerical algorithms are the difference between success or failure.
  • Using NAG Library algorithms enables you to easily switch between programming languages giving heightened flexibility and performance – the algorithms are future proofed to ensure accuracy and performance.
  • This guide will cover how to run Naglib on the Cluster.

Walkthrough: Run Naglib on the Cluster

  • This walkthrough will cover a simple example provided by naglib: nag_example a00aac
  • SBATCH Script can be found here
  • You can transfer the files to your account on the cluster to follow along. The file transfer guide may be helpful.

Part 1: The SBTACH Script

#SBATCH -JnaglibTest
#SBATCH -A [Account]
#SBATCH -N1 --ntasks-per-node=1
#SBATCH -t10
#SBATCH -qinferno
#SBATCH -oReport-%j.out

module load intel/20.0.4
module load naglib

nag_example a00aac
  • The #SBATCH directives are standard, requesting 10 minutes of walltime and 1 node with 1 task per node. More on #SBATCH directives can be found in the Using Slurm on Phoenix Guide
  • $SLURM_SUBMIT_DIR is a variable that represents the directory you submit the SBATCH script from. Make sure the files you want to use are in the same directory you put the SBATCH script.
  • `icc compiler is used to compile the c script.
  • Output Files will also show up in this directory as well
  • To see what Naglib versions are available and to load which modules, run module spider naglib, and load the ones you want.

Part 2: Submit Job and Check Status

  • Make sure you're in the dir that contains the SBATCH Script
  • Submit as normal, with sbatch <script name>. In this case sbatch naglib.sbatch
  • Check job status with squeue --job <jobID>, replacing with the jobid returned after running sbatch
  • You can delete the job with scancel <jobID> , replacing with the jobid returned after running sbatch

Part 3: Collecting Results

  • In the directory where you submitted the SBATCH script, you should see a Report-<jobID>.out file which contains the results of the job and a00aace.c and a00aace.r files.
  • The a00aace.c and a00aace.r are in the naglib_tutorial folder.
  • Report-<jobID>.out should look like this:
Begin Slurm Prolog: Feb-15-2023 21:09:13
Job ID:    714380
User ID:   svangala3
Account:   phx-pace-staff
Job name:  naglibTest
Partition: cpu-small
QOS:       inferno

Lmod is automatically replacing "gcc/10.3.0-o57x6h" with "intel/20.0.4".

The following have been reloaded with a version change:
  1) mvapich2/2.3.6-ouywal => mvapich2/2.3.6-z2duuy

Use nagvars script to set NAG compile and link environment
variables within nag_example script
. /usr/local/pace-apps/manual/packages/naglib/mark28.5/intel-20.0.4/nll6i285nl/scripts/nagvars.sh -quiet  int32 static nag

Copying a00aace.c to current directory
cp /usr/local/pace-apps/manual/packages/naglib/mark28.5/intel-20.0.4/nll6i285nl/c_examples/source/a00aace.c .

Compiling and linking a00aace.c to produce executable a00aace.exe
icc  -I/usr/local/pace-apps/manual/packages/naglib/mark28.5/intel-20.0.4/nll6i285nl/lp64/include a00aace.c /usr/local/pace-apps/manual/packages/naglib/mark28.5/intel-20.0.4/nll6i285nl/lp64/lib/libnag_nag.a -lpthread -lm -ldl -lstdc++ -o a00aace.exe

Running a00aace.exe
./a00aace.exe > a00aace.r
nag_info_impl_details (a00aac) Example Program Results

 *** Start of NAG Library implementation details ***

 Implementation title: Linux, 64-bit, C++98 ABI, Intel Classic C/C++ or Intel Classic Fortran
            Precision: double precision
         Product Code: NLL6I285NL
                 Mark: 28.5.0 (self-contained)

           Type sizes: sizeof(Pointer) = 8, sizeof(Integer) = 4

  This is a 64-bit library using 32-bit integers.

 *** End of NAG Library implementation details ***
Begin Slurm Epilog: Feb-15-2023 21:09:17
Job ID:        714380
Array Job ID:  _4294967294
User ID:       svangala3
Account:       phx-pace-staff
Job name:      naglibTest
Resources:     cpu=1,mem=1G,node=1
Rsrc Used:     cput=00:00:05,vmem=1000K,walltime=00:00:05,mem=0,energy_used=0
Partition:     cpu-small
QOS:           inferno
Nodes:         atl1-1-02-005-24-1
  • After the result files are produced, you can move the files off the cluster, refer to the file transfer guide for help.
  • Congratulations! You successfully ran Naglib on the cluster.