The HEC provides the GNU Scientific Library (GSL), a numerical library for C and C++. The library offers a wide variety of numerical and statistical routines, as described on the GSL Home Page (see Further Reading).

To view the different module versions of GSL available, run the following command:

  module avail gsl

Module names decribe the version of GSL offered, along with the supported compiler.



More information

 Using GSL with Intel compilers

The default GSL module has been compiled with the Intel compiler suite and includes the optimised BLAS provided by the Intel Math Kernel Library. To access both the library and the Intel compilers, simply add the gsl module to your login environment:

  module add gsl

or to request a specific version, use the full module name which will be suffixed with -intel. For example:

  module add gsl/1.16-intel

To compile a stand-alone C source code from file myprogram.c:

  icc -I$GSLINC -o my_program my_program.c -L$GSLLIB -lgsl -limf

The resulting executable will be named my_program

The gsl module creates two additional variables to allow for ease of compiling: $GSLINC points to GSL's header file directory, while $GSLLIB points to the location of all the GSL libraries. For more complex builds, these can be added to Makefiles, configuration script commands, etc.




 Submitting a GSL job compiled with Intel

The following job submission script template will run an executable my_program, which has been compiled with calls to the GSL library:

#$ -S /bin/bash

#$ -q serial
#$ -N myjobname

source /etc/profile
module add gsl

./my_program < my_program.input




 Using GSL with GNU compilers

Versions of gsl compiled for the GNU Compiler Collection have the suffix -gcc in their module name. The can be loaded with the relevant module command, e.g.:

  module add gsl/1.16-gcc

To compile a stand-alone C source code from file myprogram.c:

  gcc -I$GSLINC -o my_program my_program.c -L$GSLLIB -lgsl -lgslcblas -lm

The resulting executable will be named my_program.




 Submitting a GSL job compiled with GNU

The following job submission script template will run an executable my_program, which has been compiled with calls to the GSL library:

#$ -S /bin/bash

#$ -q serial
#$ -N myjobname

source /etc/profile
module add gsl/1.16-gcc

./my_program < my_program.input