Skip to content

GSL

Module

GNU Scientific Library (GSL) is now available in the 2022r2 software stack:

module load 2022r2
module load gsl

Compile your own GNU Scientific Library

GNU Scientific Library (GSL) is now available in the 2022r2 software stack.

It is quite easy to compile it yourself. On DelftBlue, you will need to do the following:

  1. Load necessary modules:
    module load 2022r1
    module load compute
    module load gcc/11.2.0-midhpa4
    module load openmpi/4.1.1-urzuzcv
    
  2. Get the GSL and create an install folder:
    wget https://mirror.ibcp.fr/pub/gnu/gsl/gsl-latest.tar.gz
    tar -zxvf gsl-latest.tar.gz
    cd gsl-2.7.1
    mkdir install
    
  3. Configure, compile and install GSL:
    ./configure --prefix=${HOME}/tools/gsl-2.7.1/install
    make
    make check
    make install 
    
  4. Check to see if GSL works as intended: First, create the following program and name it example.c:

    #include <stdio.h>
    #include <gsl/gsl_sf_bessel.h>
    
    int
    main (void)
    {
        double x = 15.0;
        double y = gsl_sf_bessel_J0 (x);
        printf ("J0(%g) = %.18e/n", x, y);
        return 0;
    }
    

    Second, compile and link the program with the following commands:

    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HOME}/tools/gsl-2.7.1/install/lib
    gcc -Wall -I${HOME}/tools/gsl-2.7.1/install/include -c example.c
    gcc -L${HOME}/tools/gsl-2.7.1/install/lib example.o -lgsl -lgslcblas -lm
    

    Finally, run your program!

    ./a.out