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

oneMKL LAPACK error: incorrect parameter on entry to SSYEVD

mfasi
Beginner
3,241 Views

I am trying to run the code below.

#include <vector>
#include <iostream>
#include <mkl_lapack.h>
#include <mkl.h>

int main() {
    MKL_INT n = 10000;
    std::vector<float> A(n * n);
    std::vector<float> eigenvalues(n);
    std::vector<float> work;
    std::vector<MKL_INT> iwork;

    for (MKL_INT i = 0; i < n*n; ++i) {
        A[i] = rand() % 100;
    }

    char jobz = 'V';
    char uplo = 'U';
    MKL_INT lda = n;
    MKL_INT info;

    float lwork_query = 0.0f;
    MKL_INT liwork_query = 0;
    MKL_INT neg_one = -1;

    ssyevd_(&jobz, &uplo, &n, A.data(), &lda, eigenvalues.data(),
            &lwork_query, &neg_one, &liwork_query, &neg_one, &info);

    MKL_INT lwork_actual = static_cast<MKL_INT>(lwork_query);
    MKL_INT liwork_actual = liwork_query;

    work.assign(lwork_actual, 0.0f);
    iwork.assign(liwork_actual, 0);

    ssyevd_(&jobz, &uplo, &n, A.data(), &lda, eigenvalues.data(),
            work.data(), &lwork_actual, iwork.data(), &liwork_actual, &info);

    if (info == 0) {
        std::cout << "SSYEVD successful. First eigenvalue: " << eigenvalues[0] << std::endl;
    } else {
        std::cerr << "SSYEVD failed with info: " << info << std::endl;
    }

    return 0;
}

The program compiles correctly with icpx (I'm using version 2024.2.0.20240602), but when I try to run it I get the error:

    Intel oneMKL ERROR: Parameter 8 was incorrect on entry to SSYEVD.
    SSYEVD failed with info: -8

The code runs without errors if I reduce n (to 2500 or below), if I change jobz to 'N', or if I replace ssyevd_ with ssyev_.

Any suggestions that could help me debug this issue would be much appreciated!

0 Kudos
1 Solution
Fengrui
Moderator
3,107 Views

Thank you for posting this issue! 

It looks the size of the working array is not big enough. The return value for lwork is 200060000 which is smaller than the minimum value needed, 2*n2+6*n +1=200060001. It is a regression. I will report it as a bug.

 

Thanks,

Fengrui

 

View solution in original post

0 Kudos
2 Replies
Fengrui
Moderator
3,108 Views

Thank you for posting this issue! 

It looks the size of the working array is not big enough. The return value for lwork is 200060000 which is smaller than the minimum value needed, 2*n2+6*n +1=200060001. It is a regression. I will report it as a bug.

 

Thanks,

Fengrui

 

0 Kudos
mfasi
Beginner
3,006 Views

@Fengrui – thanks a lot for debugging this program.

This is to confirm that the code above works if I change line 29 to:

MKL_INT lwork_actual = static_cast<MKL_INT>(lwork_query) + 1;

Hopefully this will be fixed in a future release of MKL, but this workaround works well for now.

0 Kudos
Reply