Document Actions
How to link and use mkl library (BLAS,LAPACK...)
Up to Table of Contents
Simple examples of linking:
ifort myprog.f90 -shared-intel -Wl,--start-group /global/apps/intel/mkl/10.2.0.013/lib/em64t/libmkl_intel_lp64.a /global/apps/intel/mkl/10.2.0.013/lib/em64t/libmkl_sequential.a /global/apps/intel/mkl/10.2.0.013/lib/em64t/libmkl_core.a -Wl,--end-group -lpthread
static linking of code myprog.f90 with Intel MKL sequential library.
ifort myprog.f90 -shared-intel -Wl,--start-group /global/apps/intel/mkl/10.2.0.013/lib/em64t/libmkl_intel_lp64.a /global/apps/intel/mkl/10.2.0.013/lib/em64t/libmkl_intel_thread.a /global/apps/intel/mkl/10.2.0.013/lib/em64t/libmkl_core.a -Wl,--end-group -lguide -lpthread
static linking of code myprog.f90 with Intel MKL parallel (threaded) library.
ifort -shared-intel -Wl,-rpath,/global/apps/intel/mkl/10.2.0.013/lib/em64t -L/global/apps/intel/mkl/10.2.0.013/lib/em64t -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lguide -lpthread myprog.f90
dynamic linking of code myprog.f90 with Intel MKL parallel (threaded) library.
In case you have linked to a parallel library, the library routines will by default use as many threads as available; on a compute node this means that the program will run with 8 threads by default. You can choose the number of threads with (for 4 threads):
export OMP_NUM_THREADS=4
Please consult the MKL documentation for more details.

