Turing : The LAPACK library

Description

LAPACK is a group of Fortran subroutines for solving linear algebraic problems (dense systems). LAPACK depends on the BLAS. LAPACK is the successor of the LINPACK and EISPACK libraries.

Comments :

  • Some LAPACK subroutines (in numeric mode I4S4D8) are included in the ESSL library.
  • Among these subroutines, some are SMP parallel (shared memory). These parallized LAPACK subroutines can be accessed by linking with the ESSL SMP library.
  • The LAPACK library calls the ESSL subroutines (not only the BLAS) for the purpose of optimisation.

LAPACK is written in Fortran 77.

Installed versions

  • 3.3.1
  • 3.4.2 (default version)

Utilisation

Linking Numeric Mode Subroutine names Addressing mode
$ module load lapack
$ mpixlf90_r call_lapack.f
I4S4 S… / C… 32
I4D8 D… / Z…
  • Call in a Fortran code:

    $ module load lapack
    $ mpixlc_r call_lapack.f90
  • Call in a C/C++ code: If a LAPACK subroutine is called in a C code, it is necessary to use the command corresponding to the Fortan compilation system during the linking (so that all the Fortran calls will be resolved).

    $ module load lapack
    $ mpixlc_r -c call_lapack.c
    $ mpixlf90 call_lapack.o

Example

$ cat myprogram.f90
...
      integer, parameter:: n = 1000
      double precision a(n,n), b(n)
      integer ipiv(n), info, lwork
      double precision, allocatable:: work(:)
    ...
      ! Get the optimal size of the WORK array:
      allocate(work(1))
      call DSYSV('U', N, 1, A, n, IPIV, B, n, work, -1, INFO)
      print *, ''info = '', info
      if (info /= 0) stop
      lwork = WORK(1)
      print *, ''lwork = '', lwork
      deallocate(work)
      ! Solve the set of equations:
      allocate(work(lwork))
      call DSYSV('U', N, 1, A, n, IPIV, B, n, WORK, LWORK, INFO)
      print *, ''info = '', info
      if (info /= 0) stop
    ...
$ module load lapack
$ mpixlf90_r myprogram.f90