Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Issues with model after linking intel MKL libraries

Blake_C_
Beginner
610 Views

I have developed  a model for application in marine biogeochemistry and have recently undertaken a task of converting some linear systems of equations solvers I wrote to using the built in MKL libraries.  This stems from moving from a 2X2 system (easy to solve) to a 4x4 system (harder to solve) and figuring that the MKL from intel would be more efficient.  After successfully linking the libraries in the makefile and compiling the code, the model began to blow up very rapidly without making any changes to the code itself.  My intuition is that by linking the MKL libraries, something changed in how certain matrices are being multipled/ divided.  I have no idea where to begin to look, or how just by linking these libraries at compilation time it would cause such a huge change in the model solution.  I have pasted the compiler line below, and I can fill in details as need be. 

 

Any information is much appreciated!

MKLLIB = -L/opt/intel/mkl/lib/intel64

MKLINC = -I/opt/intel/mkl/include/intel64/ilp64 -I/opt/intel/mkl/include

 

LIBS  = $(CLIB)  $(PARLIB) $(IOLIBS) $(MPILIB)  -L/opt/intel/mkl/lib/intel64/libmkl_blas95_ilp64.a -L/opt/intel/mkl/lib/intel64/libmkl_lapack95_ilp64.a $(MKLLIB) -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl

 

INCS  = $(IOINCS) $(MKLINC)

0 Kudos
3 Replies
TimP
Honored Contributor III
610 Views
Are you using integer(INT64) to correspond with ilp64 ? 4x4 isn't large enough to expect a performance advantage for mkl.
0 Kudos
Blake_C_
Beginner
610 Views

The purpose was not specifically to improve performance, but to make the coding easier.

I was not using INTEGER 64 in the model, what does that do specifically? 

0 Kudos
mecej4
Honored Contributor III
610 Views

If you were not calling MKL routines with 8-byte integer arguments, why did you specify the ILP libraries? That is wrong.

Use the MKL Link Line Advisor at https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ . Under "Select interface layer:" in that tool, your choices should be consistent with the type declarations of the integer variables that are arguments to MKL routines. After all your choices have been verified, you can take the proper compiler and linker options at the bottom.

Does your code call GESV? If so, your code must provide an explicit interface to the routine. Specific comments regarding the MKL/Lapack calls can be made if you display the corresponding CALL statements.

0 Kudos
Reply