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)
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?
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.