![]() ![]() To allow arbitrary orders between the library and the source code, we can use -Wl,-start-group archives -Wl,-end-group. Linking a code with a static library must place the code before the static library to allow symbols from the static library referenced in the code to be resolved correctly, as shown in the examples above. Ifort example.f -mkl -lmkl_lapack95_lp64 -o example.exe Ifort example.f -mkl=sequential -lmkl_blas95_lp64 -o example.exeĮxample 6 Link to the threaded part of MKL and LAPACK95. Again, the -mkl flag can work with the BLAS95/LAPACK95 libraries to make things much easier.Įxample 5 Link to the sequential part of MKL and BLAS95. These libraries must be stated explicitly at the command line for linking. More specifically, the MKL BLAS Fortran95 and LAPACK Fortran 95 libraries are static and have no dynamic counterparts. However, not all commonly used libraries are shared libraries and hence cannot be linked dynamically. lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -lpthread -o example.exe Link with BLAS95/LAPACK95ĭynamic linking to the right part of the MKL library has been made easy with the -mkl flag. Mpiicpc example.cpp -openmp -I$/composerxe/mkl/lib -lmkl_scalapack_lp64 -lmkl_intel_lp64 \ If we want to use the cluster part of MKL and the threaded part of MKL at the same time, we have to link each and every library explicitly.Įxample 4 Link to ScaLAPACK and the threaded part of MKL. When -mkl=cluster is used, the non-cluster part of MKL linked will be sequential. Mpiifort example.f -mkl=cluster -o example.exe For this to compile, you must load the intel/mpi module first. Icc example.c -mkl=parallel -o example.exeĮxample 3 Link to the cluster part of MKL, being it DCFT or ScaLAPACK. Ifort example.f -mkl=sequential -o example.exeĮxample 2 Link to the threaded part of MKL. In most cases, the -mkl flag provides all that you need.Įxample 1 Link to the sequential part of MKL. The Intel MPI library is required when -mkl=cluster.ĭynamic linking is the preferred way of linking to the MKL library. The cluster part of MKL includes distributed FFT (DCFT), ScaLAPACK, and other sub-libraries for distributed computing. Tells the compiler to link using the cluster part and the sequential part of MKL. Tells the compiler to link using the non-threaded part of MKL, which includes sequential BLAS, LAPACK, FFT, etc. The environment variable OMP_NUM_THREADS must be set to control the number of threads at run time for the threaded MKL library. The threaded part of MKL includes multithreaded BLAS, LAPACK, FFT, etc. This is the default if the option is specified with no lib.( -mkl=parallel is equivalent to -mkl) Tells the compiler to link using the threaded part of MKL. The flag -mkl tells the compiler to link to certain parts of MKL, where lib can be one of three values shown in the table. General forms of linking to the MKL library using the -mkl flag, with options of linking to the MKL BLAS95/LAPACK95 Fortran libraries, are as follows: In this user guide, we focus only on dynamic linking using the -mkl compiler option, with consideration of the commonly used BLAS95/LAPACK95 static libraries. Linking to the MKL library can be much involved if all possible usage senarios are considered. Our discussion below is based on the Intel compilers. ![]() However, the options required by each brand of compilers are different. The Intel MKL library can be used by various compilers, including the Intel compilers, the GNU compilers, and the PGI compilers. ![]() It sets the $MKLROOT environment variable that will be used in our examples. This command loads the default MKL library and all the modules that imkl depends on or is associated with, including icc, ifort, and impi. This page will show you how to use MKL on terra, with examples to demonstrate its common use.īefore using the MKL library, you need to load the MKL module file: The Intel Math Kernel Library (MKL) is a library of optimized and threaded math routines such as BLAS, LAPACK, sparse solvers, fast fourier transforms, vector math, and more for all the latest Intel architectures. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |