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

MKL 2021.4 CoreDump with LAPACKE_cgesvd_work or LAPACKE_zgesvd_work

TonyDelarue
Beginner
544 Views

Hello,

In our code, we encounter a problem. I've isolated it for you.

When you call LAPACKE_cgesvd_work or LAPACKE_zgesvd_work, you may encounter a segfault.
But the case is very specific. You have an example below.

It occurs only if N=2. I've done a loop from 0 to 100000, and only N=2 creates the segfault.

#include <lapacke.h>
#include <cblas.h>
#include <complex.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
    int64_t ret, N=2;
    float complex querysize;

    ret = LAPACKE_cgesvd_work( LAPACK_COL_MAJOR, 'S', 'S',
                               N, N, NULL, N,
                               NULL, NULL, N, NULL, N,
                               &querysize, -1, NULL );

    printf( "[%ld] %f + i*%f\n", (long)N, creal(querysize), cimag(querysize) );

    return ret;
}

 This example was compiled thanks to the following command :

 gcc ${your_name}.c -L/opt/intel/oneapi/mkl/2021.4.0/lib/intel64/ -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -pthread -lm -ldl (to correspond with our software).

 

We observe that this problem doesn't appear in real cases, only with complex ones.

Can you reproduce this bug ?

 

Regards,

Tony Delarue

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
468 Views

The issue would be fixed in the next release/update.

There is a simple workaround for the issue consisting in the replacement of call:

ret = LAPACKE_cgesvd_work( LAPACK_COL_MAJOR, 'S', 'S',

N, N, NULL, N,

NULL, NULL, N, NULL, N,

&querysize, -1, NULL);

with

float rwork[1];

ret = LAPACKE_cgesvd_work( LAPACK_COL_MAJOR, 'S', 'S',

N, N, NULL, N,

NULL, NULL, N, NULL, N,

&querysize, -1, rwork );


We will keep this tread updated when the fix would be released.


-Gennady


View solution in original post

5 Replies
Gennady_F_Intel
Moderator
530 Views

Tony,

before checking the case, I see that you use int64_t type of N. Could you check the problem with int N = 2 instead of int64_t?


TonyDelarue
Beginner
527 Views

Same result. Core dump. Here you have the backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff1cad2a4 in mkl_lapack_cgesvd_small () from /opt/intel/oneapi/mkl/2021.4.0/lib/intel64/libmkl_core.so.1
(gdb) bt
#0  0x00007ffff1cad2a4 in mkl_lapack_cgesvd_small () from /opt/intel/oneapi/mkl/2021.4.0/lib/intel64/libmkl_core.so.1
#1  0x00007ffff1d0a58a in mkl_lapack_cgesvd () from /opt/intel/oneapi/mkl/2021.4.0/lib/intel64/libmkl_core.so.1
#2  0x00007ffff778f480 in mkl_lapack.cgesvd_ () from /opt/intel/oneapi/mkl/2021.4.0/lib/intel64/libmkl_gf_lp64.so.1
#3  0x00007ffff7953b47 in LAPACKE_cgesvd_work () from /opt/intel/oneapi/mkl/2021.4.0/lib/intel64/libmkl_gf_lp64.so.1
#4  0x00005555555551ef in main () at /home/tdelarue/intel.c:11
Gennady_F_Intel
Moderator
515 Views

ok, we will take a look at this case.


Gennady_F_Intel
Moderator
493 Views

yes, we confirmed the problem.


Gennady_F_Intel
Moderator
469 Views

The issue would be fixed in the next release/update.

There is a simple workaround for the issue consisting in the replacement of call:

ret = LAPACKE_cgesvd_work( LAPACK_COL_MAJOR, 'S', 'S',

N, N, NULL, N,

NULL, NULL, N, NULL, N,

&querysize, -1, NULL);

with

float rwork[1];

ret = LAPACKE_cgesvd_work( LAPACK_COL_MAJOR, 'S', 'S',

N, N, NULL, N,

NULL, NULL, N, NULL, N,

&querysize, -1, rwork );


We will keep this tread updated when the fix would be released.


-Gennady


Reply