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

Issues with LAPACKE_xxx_work functions and workspace query

Samuel_D_1
Beginner
321 Views

Hi,

My question follows up this old thread:

https://software.intel.com/fr-fr/forums/intel-math-kernel-library/topic/497736

I have a similar problem with LAPACKE_dsytrf_work and other LAPACKE_xxx_work functions. Using Gennady's code:

    int work_sz = -1; // workspace query; optimal size is returned in tmp
    info = LAPACKE_dsytrf_work(LAPACK_ROW_MAJOR, 'L', m, NULL, m, NULL, (double *)&tmp, work_sz);

I get LAPACKE_dsytrf_work fails with "Parameter 3 was incorrect":

Major version:           11
Minor version:           3
Update version:          3
Product status:          Product
Build:                   20160413
Processor optimization:  Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors
================================================================

Intel MKL ERROR: Parameter 3 was incorrect on entry to DSYTRF.
info=-4 tmp=-92559631349317830736831783200707727132248687965119994463780864.0000

When doing a workspace query, NULL for a and ipiv should be valid parameters, right? It seems that passing a dummy pointer workaround the issue only on the surface. Visual Studio reports a stack corruption around ipiv:

Run-Time Check Failure #2 - Stack around the variable 'ipiv' was corrupted.

As the OP mentioned, passing some allocated space (e.g. int ipiv[10]) kinda works but I would prefer a better option.

Thanks, Samuel

0 Kudos
2 Replies
Zhen_Z_Intel
Employee
321 Views

Hi Samuel,

This function is not mkl function, it is function defined by Netlib as open source library. If you are going to use netlib, it should not be problem with MKL. The 'LAPACKE_dsytrf_work' call "LAPACK_dsytrf" inside of function. Please read LAPACK_dsytrf_work.c in netlib official website. Try to call function "LAPACK_dsytrf" directly or choose to use mkl function 'dsytrf' defined in mkl_lapack.h.

Best regards,

Fiona

0 Kudos
Samuel_D_1
Beginner
321 Views

Hi Fiona,

Could you clarify this sentence in the MKL developer reference of the LAPACK C convention:

If you prefer to allocate workspace arrays yourself, the LAPACK C interface provides alternate interfaces with work parameters. The name of the alternate interface is the same as the LAPACK C interface with _work appended.

for what I understand, LAPACKE_sbdsdc_work is part of the LAPACK C interface available in MKL.

Thanks,

Samuel

0 Kudos
Reply