Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

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

$
0
0

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()
{

    srand(time(0));

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

    lapack_int m1 = C;
    lapack_int n1 = C;
    lapack_int lda1 = C;
    lapack_int ipiv[C];
    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!


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>