GSL

Guidance last updated: 16 October 2026

The GNU Scientific Library (GSL) is a collection of routines for numerical computing. The routines have been written from scratch in C. See here for the types of routines that the GSL provides.

Documentation: https://www.gnu.org/software/gsl/doc/html/index.html

Usage

After connecting to Stanage (see Establishing a SSH connection), start an interactive session:

salloc

The GSL library can be loaded by running one of:

module load GSL/2.8-GCC-14.3.0
module load GSL/2.8-GCC-13.3.0
module load GSL/2.7-GCC-13.2.0

which also loads the matching GCC compiler.

Example

Save this example program as test.c (taken from the GSL documentation):

#include <stdio.h>
#include <stdlib.h>
#include <gsl/gsl_sf_bessel.h>

int main (void) {
  double x = 5.0;
  double y = gsl_sf_bessel_J0(x);

  printf("J0(%g) = %.18e\n", x, y);

  return EXIT_SUCCESS;
}

Build this using:

gcc -Wall -o test test.c $(gsl-config --cflags --libs)

Then run using:

./test

which should print the following (correct to double-precision accuracy):

J0(5) = -1.775967713143383198e-01

The gsl-config command supplies the include paths and libraries for the loaded GSL module.

Installation notes

GSL was installed using Easybuild, build details can be found in $EBROOTGSL/easybuild with a given module loaded.

Direct dependencies for latest version of GSL