Tags:
create new tag
, view all tags

How to use GSL - the GNU Scientific Library the cluster

Introduction

  • GSL Ver 1.15 is available on Hydra, for the GNU (gcc) compilers.
  • You can find it under /share/apps/gsl. Places to look for libraries or packages are /usr/lib, /usr/local/lib and /share/apps.
  • The file /share/apps/gsl/lib/pkgconfig/gsl.pc lists that package's configuration.

Compiling and linking

  • To compile, specify -I/share/apps/gsl/include,
  • To link, specify -L/share/apps/gsl/lib -lgsl -l gslcblas -lm

Running

  • To find the library at runtime, you must have /share/apps/gsl/lib in the loader library path (csh syntax):
setenv LD_LIBRARY_PATH /share/apps/gsl/lib:$LD_LIBRARY_PATH or setenv LD_LIBRARY_PATH /share/apps/gsl/lib

Example and Documentation

  • A trivial example (csh syntax):
    % cat > bessel.c
    #include 
    #include 
    
    int
    main (void)
    {
      double x = 5.0;
      double y = gsl_sf_bessel_J0 (x);
      printf ("J0(%g) = %.18e\n", x, y);
      return 0;
    ^D
    
    % gcc -c -I/share/apps/gsl/include bessel.c
    % gcc -o bessel -L/share/apps/gsl/lib bessel.o -lgsl -l gslcblas -lm
    % setenv LD_LIBRARY_PATH /share/apps/gsl/lib:$LD_LIBRARY_PATH
    % ./bessel
    J0(5) = -1.775967713143382642e-01
    

-- SylvainKorzennikHPCAnalyst - 2014-03-24

Topic revision: r1 - 2014-03-24 - SylvainKorzennikHPCAnalyst
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback