Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6621 Discussions

Different LU factorization result between libmkl_intel_ilp64.a and libmkl_intel_lp64.a


I am a novice in the field of Intel Math Kernel Library. However, when I tried to use the LU factorization function from LAPACK by compiling different libraries, I got different results as the following.

My C++ code is as simple as the following.


#include <mkl.h>
#include <iostream>
#include <ctime>    // For time()
#include <cstdlib>

int main()


    double a[441];
    for (int i = 0; i < 441; i++)
        a = (double) rand() / RAND_MAX;
    int C = 21;

    lapack_int m1 = C;
    lapack_int n1 = C;
    lapack_int lda1 = C;
    lapack_int ipiv;
    lapack_int info1 = LAPACKE_dgetrf(LAPACK_COL_MAJOR, m1, n1, a, lda1, ipiv);

    std::cout << "Info1 is " << info1 << std::endl;

    info1 = LAPACKE_dgetri(LAPACK_COL_MAJOR, m1, a, lda1, ipiv);

    std::cout << "Info1 is " << info1 << std::endl;
    return 0;

I could get no error by linking library "libmkl_intel_lp64.a", but I got a "Segmentation fault (core dumped)" by linking library "libmkl_intel_ilp64.a". I have checked the intel official document which explains the difference between the two libraries. 

There are mainly two difference mentioned in that document:

     1. Support large data arrays (with more than 231-1 elements)

     2.Enable compiling your Fortran code with the -i8 compiler option

I do not understand why I even got error by using libmkl_intel_ilp64.a. What's more, sometimes I also meet an error "tack smashing detected" by linking library "libmkl_intel_lp64.a" but "libmkl_intel_ilp64.a" is OK. Could you please help me figure it out? Thank you so much!

0 Kudos
2 Replies


Please add "-DMKL_ILP64" option to link library "libmkl_intel_ilp64.a" in your make file. It should fix your problem.

Best Regards,



here is the output when linking with ILP64 API and compiled with  /DMKL_ILP64 option.

MKL_VERBOSE Intel(R) MKL 2019.0 Update 4 Product build 20190411 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Win 2.60GHz cdecl intel_thread
MKL_VERBOSE DGETRF(21,21,00000052E531EDF0,21,00000052E531ED30,0) 1.36ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:2
Info is 0
MKL_VERBOSE DGETRI(21,00000052E531EDF0,21,00000052E531ED30,00000052E531ECB0,-1,0) 54.61us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:2
MKL_VERBOSE DGETRI(21,00000052E531EDF0,21,00000052E531ED30,000001CCD0FC8280,1344,0) 238.55us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:2
Info1 is 0