NEC

MathKeisan User's Guide


Linking MathKeisan

Linking for SX

To link, use the SUPER-UX command f90, or the cross-compile command sxf90. If your code is compiled with the f90 -dw flag (the default), link with the libraries listed in Table 1. If your code is compiled with the f90 -ew flag, link with the libraries in Table 2. Link the libraries in the order shown, or use the f90 -h lib_cyclic flag. Please see Table 3 for the integer and real data types used in the libraries.

Table 1: Linking for -dw
Library Name Link Libraries
BLAS -lblas
LAPACK -llapack -lblas
ScaLAPACK -lscalapack -lblacsF90init -lblacs -lblacsF90init -llapack -lblas -lmpi
BLACS -lblacsF90init -lblacs -lblacsF90init -lmpi
PARBLAS -lparblas -Popenmp
CBLAS -lcblas -lblas
SBLAS -lsblas
FFT -lfft
PARFFT -lparfft -Popenmp
METIS -lmetis
ParMETIS -lparmetis -lmpi
Solver -lsolver -lmetis -lblas -Popenmp
ARPACK -larpack -llapack -lblas
PARPACK -lparpack -larpack -llapack -lblas -lmpi
Table 2: Linking for -ew
Library Name Link libraries
BLAS -lblas_64
LAPACK -llapack_64 -lblas_64
ScaLAPACK -lscalapack_64 -lblacsF90init_64 -lblacs_64 -lblacsF90init_64 -llapack_64 -lblas_64 -lmpiw
BLACS -lblacsF90init_64 -lblacs_64 -lblacsF90init_64 -lmpiw
PARBLAS -lparblas_64 -Popenmp
CBLAS not available
SBLAS -lsblas_64
FFT -lfft_64
PARFFT -lparfft_64 -Popenmp
METIS -lmetis_64
ParMETIS -lparmetis_64 -lmpiw
Solver -lsolver_64 -lmetis_64 -lblas_64 -Popenmp
ARPACK -larpack_64 -llapack_64 -lblas_64
PARPACK -lparpack_64 -larpack_64 -llapack_64 -lblas_64 -lmpiw

Link errors may occur if the MathKeisan libraries cannot be found. The default directory containing MathKeisan libraries is /usr/opt/mathkeisan/inst/lib0 on SX machines, and /SX/opt/mathkeisan/inst/lib0 on cross-compile machines. If the libraries are not in these directories, please specify their location using the link flag -Ldir, where dir is the full path name of the directory containing MathKeisan libraries.

When linking with PARBLAS, FFT, or Solver using the C/C++ compiler, append -lo90sxet after the MathKeisan libraries on the command line.

When linking with f90, if any of the symbols __c_cexp, __c_csqrt, __c_npow, __c_pow, __c_ppow, __c_sincos, __c_spow, __c_stkmem, __c_stkmem2, __c_tpow, __c_vcexp, __c_vcsqrt, __c_vpow, __c_vsassign4, __c_vsincos, __c_wcexp, __c_wcsqrt, __c_wpow, __c_wsincos appear unresolved, then append -lcpp to the link command line after all MathKeisan libraries.


Libraries for SX

The MathKeisan SX libraries for different data types are listed in Table 3.

Table 3: MathKeisan SX Libraries for Data Types
Library Name 4-byte integer (f90 -dw) 8-byte integer (f90 -ew)
4-byte real 8-byte real 8-byte real
Library Prefix Library Prefix Library Prefix
BLAS libblas.a S C libblas.a D Z libblas_64.a S D C Z
LAPACK liblapack.a S C liblapack.a D Z liblapack_64.a S D C Z
ScaLAPACK libscalapack.a S C libscalapack.a D Z libscalapack_64.a S D C Z
BLACS libblacs.a S C libblacs.a D Z libblacs_64.a S D C Z
PARBLAS libparblas.a S C libparblas.a D Z libparblas_64.a S D C Z
CBLAS libcblas.a S C libcblas.a D Z not available
SBLAS libsblas.a S C libsblas.a D Z libsblas_64.a S D C Z
FFT libfft.a S C libfft.a D Z libfft_64.a S D C Z
PARFFT libparfft.a S C libparfft.a D Z libparfft_64.a S D C Z
ARPACK libarpack.a S C libarpack.a D Z libarpack_64.a S D C Z
PARPACK libparpack.a S C libparpack.a D Z libparpack_64.a S D C Z
METIS not available libmetis.a   libmetis_64.a  
ParMETIS not available libparmetis.a   libparmetis_64.a  
Solver not available libsolver.a  libsolver_64.a 

Libraries in Table 3 are for either 4-byte (32-bit) integer data type (Fortran integer(kind=4)) or 8-byte (64-bit) integer date type (Fortran integer(kind=8)).

Code compiled with the f90 default -dw uses 4-byte integers, and should be linked to libraries shown under the heading "4-byte integer".

Code compiled with f90 -ew uses 8-byte integers, and should be linked to libraries shown under the heading "8-byte integer".

The floating-point data type is either implicit, which is indicated when the "Prefix" column is empty, or is determined by the prefix of the subprogram name, as follows:

Table 4: SX Data Types Based on Prefixes
Prefix 4-byte integer (f90 -dw) 8-byte integer (f90 -ew)
S 4-byte real (Fortran real(kind=4)) 8-byte real (Fortran real(kind=8))
D 8-byte real (Fortran real(kind=8)) 8-byte real (Fortran real(kind=8))
C 8-byte complex (Fortran complex(kind=4)) 16-byte complex (Fortran complex(kind=8))
Z 16-byte complex (Fortran complex(kind=8)) 16-byte complex (Fortran complex(kind=8))

Note that in Table 4, the subprograms for 8-byte integer data type (f90 -ew) have 8-byte real data type for both the S and D prefixes, and 16-byte complex data type for both the C and Z prefixes.

Linking for Itanium® Processor Family

MathKeisan for IPF contains archive libraries (.a), and shared libraries (.so). Table 5 lists link flags for .a libraries using full library path names. Table 6 is for .a libraries using the link flag -static. Table 7 is for .so libraries. The macro $(LIBDIR) in the tables should be set to the MathKeisan lib directory. The default is $(LIBDIR) = /opt/MathKeisan/lib. For the libraries ScaLAPACK, BLACS, and ParMETIS, the macros $(MPI) and $(MPILIBDIR) should be set to the MPI directories for either NEC MPI or MPICH. For NEC MPI, the defaults are $(MPI) = NECMPI, and $(MPILIBDIR) = /usr/lib/libmpi.a. For MPICH, the defaults are $(MPI) = MPICH_ch_p4s, and $(MPILIBDIR) = /opt/mpich/lib/libmpich.a. See Table 8 for the integer and real data types used in the libraries.

Table 5: Linking for .a or archive libraries using full path name.
Library Name Link flags
BLAS $(LIBDIR)/libblas.a -openmp
LAPACK $(LIBDIR)/liblapack.a $(LIBDIR)/libblas.a -openmp
ScaLAPACK $(LIBDIR)/libscalapack.a $(LIBDIR)/$(MPI)/libblacsF90init.a $(LIBDIR)/$(MPI)/libblacs.a $(LIBDIR)/$(MPI)/libblacsF90init.a $(LIBDIR)/libblas.a -L$(LIBMPIDIR) -lmpi -openmp
BLACS $(LIBDIR)/$(MPI)/libblacsF90init.a $(LIBDIR)/$(MPI)/libblacs.a $(LIBDIR)/$(MPI)/libblacsF90init.a -L$(LIBMPIDIR) -lmpi
CBLAS $(LIBDIR)/libcblas.a -openmp
SBLAS $(LIBDIR)/libsblas.a -openmp
FFT $(LIBDIR)/libfft.a -openmp
METIS $(LIBDIR)/libmetis.a
ParMETIS $(LIBDIR)/$(MPI)/libparmetis.a -L$(LIBMPIDIR) -lmpi
Solver $(LIBDIR)/libsolver.a $(LIBDIR)/libmetis.a $(LIBDIR)/libblas.a -openmp
PARDISO $(LIBDIR)/libmkl_solver.a $(LIBDIR)/liblapack.a $(LIBDIR)/libblas.a -openmp
ARPACK $(LIBDIR)/libarpack.a $(LIBDIR)/liblapack.a $(LIBDIR)/libblas.a -openmp
Table 6: Linking for .a or archive libraries using the flag -static.
Library Name Link flags
BLAS -static -L$(LIBDIR) -lblas -openmp
LAPACK -static -L$(LIBDIR) -llapack -lblas -openmp
ScaLAPACK -static -L$(LIBDIR) -lscalapack -L$(LIBDIR)/$(MPI) -lblacsF90init -lblacs -lblacsF90init -lblas -L$(MPILIBDIR) -lmpi -openmp
BLACS -static -L$(LIBDIR)/$(MPI) -lblacsF90init -lblacs -lblacsF90init -L$(MPILIBDIR) -lmpi
CBLAS -static -L$(LIBDIR) -lcblas -openmp
SBLAS -static -L$(LIBDIR) -lsblas -openmp
FFT -static -L$(LIBDIR) -lfft -openmp
METIS -static -L$(LIBDIR) -lmetis
ParMETIS -static -L$(LIBDIR)/$(MPI) -lparmetis -L$(MPILIBDIR) -lmpi
Solver -static -L$(LIBDIR) -lsolver -lmetis -lblas -openmp
PARDISO -static -L$(LIBDIR) -lmkl_solver -llapack -lblas -openmp
ARPACK -static -L$(LIBDIR) -larpack -llapack -lblas -openmp
Table 7: Linking for shared or .so libraries.
Library Name Link flags
BLAS -L$(LIBDIR) -lblas -openmp
LAPACK -L$(LIBDIR) -llapack -lblas -openmp
ScaLAPACK -L$(LIBDIR) -lscalapack -L$(LIBDIR)/$(MPI) -lblacsF90init -lblacs -lblacsF90init -lblas -L$(MPILIBDIR) -lmpi -openmp
BLACS -L$(LIBDIR)/$(MPI) -lblacsF90init -lblacs -lblacsF90init -L$(MPILIBDIR) -lmpi
CBLAS -L$(LIBDIR) -lcblas -openmp
SBLAS -L$(LIBDIR) -lsblas -openmp
FFT -L$(LIBDIR) -lfft -openmp
METIS -L$(LIBDIR) -lmetis
ParMETIS -L$(LIBDIR)/$(MPI) -lparmetis -L$(MPILIBDIR) -lmpi
Solver -L$(LIBDIR) -lsolver -lmetis -lblas -openmp
PARDISO not available
ARPACK -L$(LIBDIR) -larpack -llapack -llapack -lblas -openmp

If you see the run-time message error while loading shared libraries, you may need to add the MathKeisan lib directory to your LD_LIBRARY_PATH environment variable. The following C shell commands will add the default MathKeisan lib directory /opt/MathKeisan/lib to LD_LIBRARY_PATH. You can put these commands in your .cshrc file, or enter them at the command line:

if !($?LD_LIBRARY_PATH) then
    setenv LD_LIBRARY_PATH /opt/MathKeisan/lib
else
    setenv LD_LIBRARY_PATH /opt/MathKeisan/lib:$LD_LIBRARY_PATH
endif

You can put the following Bash shell command in your .profile file, or enter it at the command line:

export LD_LIBRARY_PATH="/opt/MathKeisan/lib:$LD_LIBRARY_PATH"

Libraries for Itanium® Processor Family

The MathKeisan IPF libraries for different data types are listed in Table 8.

Table 8: MathKeisan IPF Libraries for Data Types
Library Name 4-byte real 8-byte real
Archive library Shared library Prefix Archive library Shared library Prefix
BLAS libblas.a libblas.soS C libblas.a libblas.soD Z
LAPACK liblapack.a liblapack.soS C liblapack.a liblapack.soD Z
ScaLAPACK libscalapack.a libscalapack.soS C libscalapack.a libscalapack.soD Z
BLACS libblacs.a libblacs.soS C libblacs.a libblacs.soD Z
CBLAS libcblas.a libcblas.soS C libcblas.a libcblas.soD Z
SBLAS libsblas.a libsblas.soS C libsblas.a libsblas.soD Z
FFT libfft.a libfft.soS C libfft.a libfft.so D Z
METIS not available libmetis.a libmetis.so 
ParMETIS not available libparmetis.alibparmetis.so 
Solver not available libsolver.alibsolver.so 
PARDISO not available libmkl_solver.alibmkl_solver.so 
ARPACK libarpack.a libarpack.so S C libarpack.a libarpack.so D Z

Libraries in Table 8 are for 4-byte (32-bit) integer data type (Fortran integer(kind=4)). The floating-point data type is either implicit, which is indicated when the "Prefix" column is empty, or is determined by the prefix of the subprogram name, as follows:

Table 9: IPF data Types Based on Prefixes
Prefix Data Type
S 4-byte real (Fortran real(kind=4))
D 8-byte real (Fortran real(kind=8))
C 8-byte complex (Fortran complex(kind=4))
Z 16-byte complex (Fortran complex(kind=8))