Vuori User's Guide > Program development > Mathematical libraries
Tehdyt toimenpiteet

Mathematical libraries

ACML (AMD Core Math Library)

ACML

The principal mathematical subroutine library in Vuori is ACML (AMD Core Math Library). This library is optimized for AMD64 processors.

The ACML routines can be called from both Fortran and C programs. ACML comprises the following parts:

  • BLAS - Basic Linear Algebra Subprograms
  • LAPACK - Linear Algebra Package for solving linear equations and eigenvalue problems
  • FFT - a set of routines for Fast Fourier Transform
  • RNG - a set of Random Number Generators and statistical distribution functions
  • Fast vectorized versions of standard mathematical funcions (in library ACML_MV).

For a comprehensive documentation of ACML, see http://developer.amd.com/assets/acml_userguide.pdf

A short description of ACML components is provided after the usage instructions.

Usage

The current ACML version is 4.3. The programming environments PrgEnv-pgi,  PrgEnv-pathscale and PrgEnv-gnu, load a related acml module automatically.

In order to link ACML subroutines to your program from these automatically loaded serial version modules you must use the option -lacml when linking. This option will link to the shared (dynamic) version of the library. If you need the static version of ACML, add the option -static before -lacml.

When using ACML routines from a C program,  Fortran runtime libraries might be needed when linking. This can be done by using the f90 command for linking, or by including the following options after -lacml:

PGI: -lpgf90 -lpgf90_rpm1 -lpgf902

Pathscale: -lpathfortran

When you need the faster (but slightly less accurate) versions of standard mathematical functions, the appropriate option for linking is -lacml_mv.

For OpenMP (suffix _mp in directory and libarary names) and INTEGER*8 (suffix _int64 in directory names) there are no modules and you must by yourself define the needed environment variables, make your own modules, or use -I-L, -l and OpenMP options in addition to the options mentioned above.

Linear Algebra

BLAS and LAPACK are standard libraries for linear algebra operations. For  documentation, see  http://www.netlib.org/blas  and  http://www.netlib.org/lapack.


BLAS operations are divided into three classes:

  • Level 1: operations on vectors (one or more)
  • Level 2: operations involving a vector and a matrix
  • Level 3: operations between two matrices

BLAS operations are used as building blocks for higher level operations in other libraries such as LAPACK.

LAPACK, originally written in FORTRAN 77, is a very widely used library for
solving problems in (dense) linear algebra. In addition to solving  linear equations,  the subroutines  handle least  squares problems, eigenvalue  problems and singular value problems.

The actual algorithms behind some LAPACK subroutines in ACML differ from those used in the LAPACK source in public domain. Both functionally and numerically the subroutines  conform to  the usual  LAPACK  conventions.

Fast Fourier Transforms

Discrete Fourier Transforms in ACML come in two types:

  • The transforms of the first type map complex data to complex data. These routines have names beginning with ZFFT (double precision) or CFFT (single precision). There are separate routines for 1D, 2D and 3D transforms. Applying forward and backward transforms consecutively recovers the original data.
  • Transforms of the second type map complex data to real data or vice versa. The names begin with DZFFT or SCFFT (complex to real) and  ZDFFT or CSFFT (real to complex). These routines are available only for 1D sequences, and consecutive forward and backward transforms will NOT recover the original data; rather, the transform must be conjugated before the backward transform in order to recover data.

Random Number Generators

ACML has five different  Base Random Number Generators (BRNG) for  producing  sequences of  pseudo-random numbers unifomly distributed over the open interval (0,1). In addition, there are 23 distribution generators for transforming the uniformly distributed numbers to variates from specified distributions (for example, the normal distribution or the chi squared distribution).