GSL

Software Category
Version
1.6, 2.3, 2.6

GSL

Introduction

The GNU Scientific Library (GSL) is a powerful library of numerical functions that are commonly used in Scientific Software. The library supports linking with C and C++ code. GSL commonly gets used as a backend for larger scientific software packages. There is an R library which wraps GSL for use in R as well R GSL which is a dependency of many other R libraries.

Versions of GSL Available on RCC Systems

RCC has three versions of GSL available. The current default version is 1.6. The versions are listed below in the following table (replace MYPROGRAMNAME with the appropriate name of your source code file):

Version Default? Full File Path
Version 1.6 YES /usr/lib64/
Version 2.3 NO /gpfs/research/software/gsl/2.3/gsl-2.3_build/
Version 2.6 NO /gpfs/research/software/gsl/2.6/gsl-2.6_build/

Using GSL on RCC Systems

To use the default version of GSL on RCC systems, you should include it in your code according to the Documentation. Then you will need to complete two steps to get your program compiled and linked correctly to the default GSL library:

  1. gcc -I/usr/include/gsl/ -c MYPROGRAMNAME.c
  2. gcc -L/usr/lib64/ MYPROGRAMNAME.o -lgsl -lgslcblas -lm

Linking against Newer GSL Versions

Linking against the newer versions of GSL can be done in much the same way. Start by including GSL in your code according to the Documentation. Then you will need to complete two steps to get your program compiled and linked correctly to the default GSL library:

For GSL Version 2.3

  1. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/gpfs/research/software/gsl/2.3/gsl-2.3_build/lib/
  2. gcc -I/gpfs/research/software/gsl/2.3/gsl-2.3_build/include/ -c MYPROGRAMNAME.c
  3. gcc -L/gpfs/research/software/gsl/2.3/gsl-2.3_build/lib/ MYPROGRAMNAME.o -lgsl -lgslcblas -lm

For GSL Version 2.6

  1. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/gpfs/research/software/gsl/2.6/gsl-2.6_build/lib/
  2. gcc -I/gpfs/research/software/gsl/2.6/gsl-2.6_build/include/ -c MYPROGRAMNAME.c
  3. gcc -L/gpfs/research/software/gsl/2.6/gsl-2.6_build/lib/ MYPROGRAMNAME.o -lgsl -lgslcblas -lm

Using Newer GSL Versions for R Library Installations

One situation which can come up is that you may wish to install an R library which depends on a newer version of GSL than the default. There are many possible ways that installing that library can be done and you should refer to your package's documentation first and formost but one example of a possible installation route as follows. Note that the Environment Variables your package uses to access the GSL library and config programs may be different.

Check your package's documentation and recommended installation method before proceeding!

install.packages("MYLIBRARYNAME", \
configure.vars=c("GSL_CONFIG=/gpfs/research/software/gsl/2.6/gsl-2.6_build/bin/gsl-config", \
"GSL_LIBS=/gpfs/research/software/gsl/2.6/gsl-2.6_build/lib")