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

MKL 2021.4 CoreDump with LAPACKE_cgesvd_work or LAPACKE_zgesvd_work

TonyDelarue
Beginner
948 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
872 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

0 Kudos
5 Replies
Gennady_F_Intel
Moderator
934 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?


0 Kudos
TonyDelarue
Beginner
931 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
0 Kudos
Gennady_F_Intel
Moderator
919 Views

ok, we will take a look at this case.


0 Kudos
Gennady_F_Intel
Moderator
897 Views

yes, we confirmed the problem.


0 Kudos
Gennady_F_Intel
Moderator
873 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


0 Kudos
Reply