Development/GSL: Difference between revisions
No edit summary |
S Richling (talk | contribs) m (S Richling moved page GSL to Development/GSL: Umzug in Development-Bereich) |
||
(55 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Softwarepage|numlib/gsl}} |
|||
{| width=600px class="wikitable" |
{| width=600px class="wikitable" |
||
|- |
|- |
||
Line 5: | Line 7: | ||
| module load |
| module load |
||
| numlib/gsl |
| numlib/gsl |
||
|- |
|||
| Availability |
|||
| [[BwForCluster_JUSTUS_2]] |
|||
|- |
|- |
||
| License |
| License |
||
Line 13: | Line 12: | ||
|- |
|- |
||
|Citing |
|Citing |
||
| <pre>M. Galassi et al., GNU Scientific Library Reference Manual (3rd Ed.), ISBN 0954612078.</pre> |
|||
| <small><small><pre>The recommended way is to cite the reference manual, |
|||
e.g. M. Galassi et al, GNU Scientific Library Reference Manual |
|||
(3rd Ed.), ISBN 0954612078.</pre></small></small> |
|||
|- |
|- |
||
| Links |
| Links |
||
Line 26: | Line 23: | ||
<br> |
<br> |
||
= Description = |
= Description = |
||
The '''GNU Scientific Library''' ('''GSL''') is a software library for numerical computations in applied mathematics and science. |
The '''GNU Scientific Library''' ('''GSL''') is a software library for numerical computations in applied mathematics and science. GSL is written in C, but bindings exist for other programming languages as well. The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite. |
||
<br> |
<br> |
||
The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. |
|||
<br> |
<br> |
||
The complete range of subject areas covered by the library: |
|||
The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite. |
|||
<br> |
<br> |
||
<br> |
|||
<u>The complete range of subject areas covered by the library includes</u> |
|||
<br> |
<br> |
||
• Complex Numbers • Roots of Polynomials • Special Functions • Vectors and Matrices • Permutations • Sorting • BLAS Support • Linear Algebra • Eigensystems • Fast Fourier Transforms • Quadrature • Random Numbers • Quasi-Random Sequences • Random Distributions • Statistics • Histograms • N-Tuples • Monte Carlo Integration • Simulated Annealing • Differential Equations • Interpolation • Numerical Differentiation • Chebyshev Approximation • Series Acceleration • Discrete Hankel Transforms • Root-Finding • Minimization • Least-Squares Fitting • Physical Constants • IEEE Floating-Point • Discrete Wavelet Transforms • Basis splines • Running Statistics • Sparse Matrices and Linear Algebra |
• Complex Numbers • Roots of Polynomials • Special Functions • Vectors and Matrices • Permutations • Sorting • BLAS Support • Linear Algebra • Eigensystems • Fast Fourier Transforms • Quadrature • Random Numbers • Quasi-Random Sequences • Random Distributions • Statistics • Histograms • N-Tuples • Monte Carlo Integration • Simulated Annealing • Differential Equations • Interpolation • Numerical Differentiation • Chebyshev Approximation • Series Acceleration • Discrete Hankel Transforms • Root-Finding • Minimization • Least-Squares Fitting • Physical Constants • IEEE Floating-Point • Discrete Wavelet Transforms • Basis splines • Running Statistics • Sparse Matrices and Linear Algebra |
||
<br> |
<br> |
||
<br> |
<br> |
||
== How to use GSL == |
|||
A man page is available and can be accessed by typing |
|||
= Availability = |
|||
GSL is available on selected bwHPC-Clusters. A complete list of versions currently installed on the bwHPC-Clusters can be obtained from the [https://www.bwhpc.de/software.html Cluster Information System (CIS)]. |
|||
In order to check which versions of GSL are installed on the compute cluster, run the following command: |
|||
<pre> |
<pre> |
||
$ |
$ man gsl |
||
</pre> |
</pre> |
||
=== Includes === |
|||
= Documentation = |
|||
=== Online === |
|||
* [http://www.gnu.org/software/gsl/ Online-Documentation] |
|||
=== Local === |
|||
* info gsl |
|||
* man gsl |
|||
* man gsl-config |
|||
<br> |
|||
= Loading the module = |
|||
You can load the default version of the GSL library with the command<br> |
|||
'module load numlib/gsl'. |
|||
<br> |
|||
The module will try to load modules it needs to function. |
|||
If loading the module fails, check if you have already loaded one of those modules with the command 'module list'. |
|||
<br> |
|||
If you wish to load a specific (older) version (if available), you can do so using e.g. |
|||
' module load numlib/gsl/'version' to load the version you desires. |
|||
<pre> |
|||
$ module avail numlib/gsl |
|||
---------------------- /opt/bwhpc/common/modulefiles ----------------------- |
|||
numlib/gsl/1.16-gnu-4.4 numlib/gsl/1.16-intel-14.0 |
|||
numlib/gsl/1.16-intel-13.1(default) |
|||
$ module load numlib/gsl/1.16-gnu-4.4 |
|||
$ module list |
|||
Currently Loaded Modulefiles: |
|||
1) numlib/gsl/1.16-gnu-4.4 |
|||
</pre> |
|||
<br> |
|||
Your source code should contain preprocessor include statements with a gsl/prefix such as |
|||
= GSL-Specific Environments = |
|||
<source lang="c">#include <gsl/gsl_math.h></source> |
|||
To see a list of all GSL environments set by the 'module load'-command use 'env | grep GSL'. |
|||
<br> |
|||
=== Compile === |
|||
Or use the command 'module show numlib/gsl'. |
|||
<pre> |
|||
$ module show numlib/gsl |
|||
----------------------------------------------------------------- |
|||
/opt/bwhpc/common/modulefiles/numlib/gsl/1.16-intel-13.1: |
|||
GSL_VERSION = 1.16 |
|||
GSL_HOME = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1 |
|||
GSL_BIN_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/bin |
|||
GSL_INC_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/include |
|||
GSL_LIB_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/lib |
|||
GSL_STA_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/lib |
|||
GSL_SHA_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/lib |
|||
GSL_MAN_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/share/man |
|||
GSL_INF_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/share/info |
|||
GSL_DOC_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/share/doc |
|||
GSL_EXA_DIR = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/share/doc/examples |
|||
GSL_WWW http://www.gnu.org/software/gsl/ |
|||
PATH = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/bin:$PATH |
|||
MANPATH = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/share/man:$MANPATH |
|||
INFOPATH = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/share/info:$INFOPATH |
|||
LD_LIBRARY_PATH = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/lib:$LD_LIBRARY_PATH |
|||
INCLUDE = /opt/bwhpc/common/numlib/gsl/1.16-intel-13.1/include:$INCLUDE |
|||
[...] |
|||
</pre> |
|||
<br> |
|||
A typical compilation command for a source file 'example.c' using the Intel C compiler icc is |
|||
= How To Use the Library = |
|||
<pre> $ icc -Wall -I$GSL_INC_DIR -c example.c </pre> |
|||
== Includes == |
|||
The <span style="background:#edeae2;margin:2px;padding:1px;border:1px dotted #808080">$GSL_INC_DIR</span> environment variable points to the location of the include path for the GSL header files. |
|||
Your source code should contain preprocessor include statements with a gsl/ prefix, such as |
|||
<source lang="c">#include <gsl/gsl_math.h></source> |
|||
== |
=== Link === |
||
A typical compilation command for a source file example.c with the |
|||
The following command can be used to link the application with the GSL libraries: |
|||
Intel C compiler icc is |
|||
<pre> $ icc -Wall -I$GSL_INC_DIR -c example.c </pre> |
|||
The [[#GSL-Specific Environments|$GSL_INC_DIR environment variable]] points to location of |
|||
the include path for the gsl header files. |
|||
<br> |
|||
== Link == |
|||
The following command can be used to link the application with the gsl libraries. |
|||
<pre> $ icc -L$GSL_LIB_DIR -o example example.o -lgsl -lgslcblas -lm </pre> |
<pre> $ icc -L$GSL_LIB_DIR -o example example.o -lgsl -lgslcblas -lm </pre> |
||
The |
The <span style="background:#edeae2;margin:2px;padding:1px;border:1px dotted #808080">$GSL_LIB_DIR</span> 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. |
|||
of the gsl libraries. |
|||
<br> |
|||
Also make sure to have the GSL-module loaded before running applications build |
|||
with this library. |
|||
<br><br> |
|||
= Example C-Source Code = |
|||
== Create source code file 'intro.c' == |
|||
<source lang="c"> |
|||
#include <stdio.h> |
|||
#include <gsl/gsl_sf_bessel.h> |
|||
= Useful links = |
|||
int main (void) |
|||
{ |
|||
double x = 5.0; |
|||
double y = gsl_sf_bessel_J0 (x); |
|||
printf ("J0(%g) = %.18e\n", x, y); |
|||
return 0; |
|||
} |
|||
</source> |
|||
<small>[https://www.gnu.org/software/gsl/manual/html_node/Special-Functions.html Bessel-Functions and more]</small> |
|||
<br> |
|||
* [https://www.gnu.org/software/gsl/doc/html/index.html Documentation (english)] |
|||
== Compile and Link == |
|||
* [https://de.wikipedia.org/wiki/GNU_Scientific_Library Wikipedia article (german)] |
|||
Load the GSL module for the Intel compiler, compile, link and run the program |
|||
* [https://en.wikipedia.org/wiki/GNU_Scientific_Library Wikipedia article (english)] |
|||
<pre> |
|||
$ 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 |
|||
</pre> |
|||
<br> |
|||
[[Category: Numerical libraries]][[Category:bwUniCluster]] |
Latest revision as of 00:03, 15 March 2023
The main documentation is available via |
Description | Content |
---|---|
module load | numlib/gsl |
License | GNU General Public License (GPL) |
Citing | M. Galassi et al., GNU Scientific Library Reference Manual (3rd Ed.), ISBN 0954612078. |
Links | Homepage | Documentation |
Graphical Interface | No |
Description
The GNU Scientific Library (GSL) is a software library for numerical computations in applied mathematics and science. GSL is written in C, but bindings exist for other programming languages as well. The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.
The complete range of subject areas covered by the library:
• Complex Numbers • Roots of Polynomials • Special Functions • Vectors and Matrices • Permutations • Sorting • BLAS Support • Linear Algebra • Eigensystems • Fast Fourier Transforms • Quadrature • Random Numbers • Quasi-Random Sequences • Random Distributions • Statistics • Histograms • N-Tuples • Monte Carlo Integration • Simulated Annealing • Differential Equations • Interpolation • Numerical Differentiation • Chebyshev Approximation • Series Acceleration • Discrete Hankel Transforms • Root-Finding • Minimization • Least-Squares Fitting • Physical Constants • IEEE Floating-Point • Discrete Wavelet Transforms • Basis splines • Running Statistics • Sparse Matrices and Linear Algebra
How to use GSL
A man page is available and can be accessed by typing
$ man gsl
Includes
Your source code should contain preprocessor include statements with a gsl/prefix such as
#include <gsl/gsl_math.h>
Compile
A typical compilation command for a source file 'example.c' using the Intel C compiler icc is
$ icc -Wall -I$GSL_INC_DIR -c example.c
The $GSL_INC_DIR environment variable points to the location of the include path for the GSL header files.
Link
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.