- Infos im HLRS Wiki sind nicht rechtsverbindlich und ohne Gewähr -
- Information contained in the HLRS Wiki is not legally binding and HLRS is not responsible for any damages that might result from its use -
MKL: Difference between revisions
From HLRS Platforms
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
The MKL fortran interfaces must be build seperately because different compiler return complex values differently. Due to the large number of combinations occuring from this the user has to do this on his own. | The MKL fortran interfaces must be build seperately because different compiler return complex values differently. Due to the large number of combinations occuring from this the user has to do this on his own. | ||
{{Command| command =<nowiki> | |||
# example how to build a fortran interface of the intel MKL | |||
# set up your environment | |||
module load numlib/intel # set up MKL environment | |||
module load compiler/intel | |||
module load mpi/impi # MPI needed by some fftw interfaces | |||
# switch into the directory of the needed interface | |||
cd $MKLROOT/interfaces/<interfacename> | |||
# display build options like compiler and mpi library | |||
make | |||
# install the library into $HOME/lib | |||
# By default, for interfaces without MPI the ifort compiler is used. | |||
# You can change it by an additional parameter FC=<compiler>. | |||
make INSTALL_DIR=$HOME/lib libem64t [OPTIONS]</nowiki> | |||
}} | |||
=== Example === | === Example === | ||
Here is a simple example how to compile an application with the Fortran 95 interface and wrappers for BLAS95. You should have build the BLAS95 Interfaces already as described above. | |||
{{File|filename = example_blas.f90 | |||
| content = <pre> | |||
program example_blas | program example_blas | ||
implicit none | implicit none | ||
Line 51: | Line 54: | ||
! Result: 2.44948974278318 | ! Result: 2.44948974278318 | ||
end program example_blas | end program example_blas | ||
</pre> | |||
}} | |||
Compile with | Compile this with | ||
{{Command| command = | |||
ifort example_blas.f90 -L$HOME/lib -lmkl_blas95 $MKLPATH/libmkl_intel_lp64.a -Wl, | |||
: --start-group $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group <nowiki></nowiki> | |||
: -L$MKLPATH -liomp5 -o example_blas | |||
}} | |||
== See also == | == See also == | ||
* [[Software Development Tools, Compilers & Libraries]] | * [[Software Development Tools, Compilers & Libraries]] |
Revision as of 12:57, 1 March 2010
Intel's Math Kernel Library (MKL) is a library of optimized, math routines for science, engineering, and financial applications. Core math functions include BLAS, LAPACK, ScaLAPACK, Sparse Solvers, Fast Fourier Transforms and Vector Math. |
|
Fortran 95 Interfaces and Wrappers for LAPACK, BLAS, etc.
The MKL fortran interfaces must be build seperately because different compiler return complex values differently. Due to the large number of combinations occuring from this the user has to do this on his own.
# example how to build a fortran interface of the intel MKL
# set up your environment
module load numlib/intel # set up MKL environment
module load compiler/intel
module load mpi/impi # MPI needed by some fftw interfaces
# switch into the directory of the needed interface
cd $MKLROOT/interfaces/<interfacename>
# display build options like compiler and mpi library
make
# install the library into $HOME/lib
# By default, for interfaces without MPI the ifort compiler is used.
# You can change it by an additional parameter FC=<compiler>.
make INSTALL_DIR=$HOME/lib libem64t [OPTIONS]
Example
Here is a simple example how to compile an application with the Fortran 95 interface and wrappers for BLAS95. You should have build the BLAS95 Interfaces already as described above.
File: example_blas.f90
program example_blas implicit none real, dimension(3) :: a = (/2.,1.,-1./), b = (/5., -2., 1.5/) real :: c, sdot real(kind=8) :: d, dnrm2 ! *** skalar product *** ! sdot: s ... REAL, dot ... skalar product ! 1. Argument ... dimensions of the vectors ! 2. und 4. A. ... the vectors ! 3. und 5. A. ... increment (here 1) c = sdot(3, a, 1, b, 1) write(*,*) c ! Result: 6.500000 ! *** norm of the vectors *** ! dnrm2: d ... DOUBLE PRECISION, nrm2 ... (euklidian) norm ! 1. Argument: dimensions of the vectors ! 2. A.: vektor ! 3. A.: increment (here 1) d = dnrm2(3, dble(a), 1) write(*,*) d ! Result: 2.44948974278318 end program example_blas
Compile this with
ifort example_blas.f90 -L$HOME/lib -lmkl_blas95 $MKLPATH/libmkl_intel_lp64.a -Wl,
- --start-group $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group
- -L$MKLPATH -liomp5 -o example_blas