GNU Scientific Library (GSL)
The GNU Scientific Library (or GSL) is a software library for numerical computations in applied mathematics and science. The GSL is written in the C programming language, but bindings exist for other languages as well.
Online-Documentation: http://www.gnu.org/software/gsl/
Local-Documentation:
See 'info gsl', 'man gsl' and 'man gsl-config'.
Tips for compiling and linking:
Load the gsl module. After having loaded the gsl environment module, you can use several environment variables to compile and link your application with the gsl library.
Your source code should contain preprocessor include statements with a gsl/ prefix, such as
#include <gsl/gsl_math.h>
A typical compilation command for a source file example.c with the Intel C compiler icc is
$ icc -Wall -I$GSL_INC_DIR -c example.c
The $GSL_INC_DIR environment variable points to location of the include path for the gsl header files.
The following command can be used to link the application with the gsl libraries,
$ icc -L$GSL_LIB_DIR -o example example.o -lgsl -lgslcblas -lm
The $GSL_LIB_DIR environment variable points to the location of the gsl libraries.
Also make sure to have the gsl module loaded before running applications build with this library.
Example
Create source code file 'intro.c':
#include <stdio.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 0;
}
|
Load the gsl module for the Intel compiler, compile, link and run the program:
$ module load numlib/gsl/1.16-intel-13.1 Loading module dependency 'compiler/intel/13.1'. $ icc -Wall -I$GSL_INC_DIR -c intro.c $ icc -L$GSL_LIB_DIR -o intro intro.o -lgsl -lgslcblas -lm $ ./intro J0(5) = -1.775967713143382642e-01