About HPC Systems Software User Guides Education Partners

  / gears / hpc / software / numlib / imsl


Bioinformatics

Compilers and Programming Tools

Computational Chemistry

File System

Finite Element Solvers

Graphics

Mathematics

Numerical Libraries

Optimization

Parallel Programming Libraries and Tools

Queuing and Scheduling Systems

Solid Modeling

Statistics

IMSL

Overview

The IMSL libraries are a collection of over 1000 mathematical and statistical FORTRAN and C routines and functions useful in research and in mathematical and statistical analysis. Statistical subroutines perform most of the procedures available in SPSS, BMDP, or SAS, as well as many procedures that are unavailable in other general purpose statistical packages. Each routine is designed and documented to be used in research activities as well as by technical specialists.

A complete function catalog in PDF format is available at URL http://gears.aset.psu.edu/hpc/software/numlib/imsl/FortranFC.pdf.

Setup

To use IMSL, it is necessary for you to set your IMSL environment by running a special command sequence once per login session. You may place these commands in your .cshrc (C Shell users) or .profile (Bourne Shell users) file to avoid having to manually run these commands each login session.

The command to run varies by which cluster and which compiler you wish to use. Please refer to the following tables.

For sh and bash (default user shell):

  • For Hammer and LION-XO with the Pathscale EKO compiler:

    . /usr/global/vni/CTT6.0/ctt/bin/cttsetup.sh

    . /usr/global/vni/CTT6.0/ctt/bin/pathscale2.sh

  • For Hammer and LION-XO with the PGI compiler:

    . /usr/global/vni/CTT6.0/ctt/bin/cttsetup.sh

    . /usr/global/vni/CTT6.0/ctt/bin/pgi64.sh

  • For LION-XM with the PGI compiler:

    . /usr/global/vni/CTT6.0/ctt/bin/cttsetup.sh

For csh and tcsh:

  • For Hammer and LION-XO with the Pathscale EKO compiler:

    source /usr/global/vni/CTT6.0/ctt/bin/cttsetup.csh

    source /usr/global/vni/CTT6.0/ctt/bin/pathscale2.csh

  • For Hammer and LION-XO with the PGI compiler:

    source /usr/global/vni/CTT6.0/ctt/bin/cttsetup.csh

    source /usr/global/vni/CTT6.0/ctt/bin/pgi64.csh

  • For LION-XM with the PGI compiler:

    source /usr/global/vni/CTT6.0/ctt/bin/cttsetup.csh


Usage

Compiling and linking FORTRAN codes

For compiling and linking IMSL routines into your code, you need to write FORTRAN (f77) code which calls these routines, and then compile your program in the following way.

$FC -o executable.file code_file.f $FFLAGS $LINK_FNL

An SMP version of the IMSL library is available by using the following command. This version may provide performance improvements by utilizing multiple processing cores within a node. Not all routines will parallelize. The SMP library also offers LaPACK support.

$FC -o executable.file code_file.f $FFLAGS $LINK_FNL_SMP

where code_file.f is the FORTRAN source file and any name can be chosen for the executable.file. $FC is the default Fortran 77 compiler (and can be replaced by xlf, f77, etc).

To compile and link a Fortran 90 code with IMSL Fortran 90 library, issue the command:

$F90 -o executable.file code_file.f $F90FLAGS $LINK_F90

Just as with the F77 library, the F90 library has an SMP version available. You can access the SMP library by changing the linked library as follows.

$F90 -o executable.file code_file.f $F90FLAGS $LINK_F90_SMP

This version may provide performance improvements by utilizing multiple processing cores within a node. Not all routines will parallelize. The SMP library also offers LaPACK support. The SMP library will invoke the high performance ACML library on x86_64 clusters such as lionxo, lionxb, and hammer when using the PathScale compiler. Use of the SMP version of the library with PathScale is highly recommended for best performance.

Please note that there is no IMSL available for the em64t-based cluster lionxc at the present time. We are working to obtain a version of IMSL for this cluster and hope to have it available soon.

Compiling and linking C codes

IMSL with C requires you to run a different setup command:

For sh and bash (default user shell):

. /usr/global/vni/imsl/cnl600/linux64/bin/cnlsetup.sh

For csh and tcsh:

source /usr/global/vni/imsl/cnl600/linux64/bin/cnlsetup.csh

For compiling and linking IMSL routines into your code, you need to write C code which calls these routines as well as includes a header file imsl.h. You should compile your program as follows:

$CC -o executable.file $CFLAGS code_file.c $LINK_CNL

where code_file.c is the C source file and any name can be chosen for the executable.file.

If you have a C++ code, calling imsl is the same as for a C code, just use a C++ compiler in stead of $CC.

Just as with the F77 and F90 libraries, the C library has an SMP version available by using the following command. This version may provide performance improvements by utilizing multiple processing cores within a node. Not all routines will parallelize. The SMP library also offers LaPACK support.

$CC -o executable.file $CFLAGS code_file.c $LINK_CNL_SMP

Examples

The following Fortran 90 application is from the IMSL example code for a general linear solver, lin_sol_gen. It is saved in a file named lin_sol_gen.f90.

Program TestLinSolGen

  use lin_sol_gen_int
  use rand_gen_int
  use error_option_packet
  implicit none
  ! This is Example 1 for LIN_SOL_GEN.
  integer, parameter :: n=32
  real(kind(1e0)), parameter :: one=1e0
  real(kind(1e0)) err
  real(kind(1e0)) A(n,n), b(n,n), x(n,n), res(n,n), y(n**2)

  ! Generate a random matrix.
  call rand_gen(y)
  A = reshape(y,(/n,n/))

  ! Generate random right-hand sides.
  call rand_gen(y)
  b = reshape(y,(/n,n/))

  ! Compute the solution matrix of Ax=b.
  call lin_sol_gen(A, b, x)

  ! Check the results for small residuals.
  res = b - matmul(A,x)
  err = maxval(abs(res))/sum(abs(A)+abs(b))
  if (err <= sqrt(epsilon(one))) then
  write (*,*) 'Example 1 for LIN_SOL_GEN is correct.'
  end if

end Program TestLinSolGen

Compile the file lin_sol_gen.f90 with the following command, creating the executable file lin_sol_gen:

$F90 lin_sol_gen.f90 $F90FLAGS $LINK_F90 -o lin_sol_gen

A screen shot of the compilation, using the PathScale compiler, and subsequent execution would look as follows:

[xyz123@lionxo imsl]$ . /usr/global/vni/CTT6.0/ctt/bin/cttsetup.sh 
[xyz123@lionxo imsl]$ . /usr/global/vni/CTT6.0/ctt/bin/pathscale2.sh
[xyz123@lionxo imsl]$ $F90 lin_sol_gen.f90 $F90FLAGS $LINK_F90 -o lin_sol_gen
[xyz123@lionxo imsl]$ ./lin_sol_gen
 Example 1 for LIN_SOL_GEN is correct.
[xyz123@lionxo imsl]$
Documentation

Documentation can be found in PDF files in the directory $CTT_DIR/help after the appropriate setup scripts have been run. These files can be viewed with the command acroread.


Please send questions or suggestions about this web page to beatnic@aset.psu.edu

ASET | ITS | Penn State