Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
7234 Discussions

Possible issue in MKL LAPACKE interface when using LAPACK_ROW_MAJOR

Zhang__Simon
Beginner
1,118 Views

MKL provided by Intel parallel studio xe 2019.3.

The minimal reproducing code is below:

#include <stdlib.h>
#include <stdio.h>
#include "mkl_lapacke.h"

#define N 2

int main(){
double m;
MKL_INT n1=N, n2=N;
MKL_INT info;
double a[N*N] = {0, 1,
                 1, 0};
info = LAPACKE_dsyevd(LAPACK_ROW_MAJOR, 'V','U', n1, a, n2, m);
printf("the eigenvalue is: %f,%f\n", m[0],m[1]);
printf("the first eigenvector is: %f,%f\n",a[0],a[2]);
printf("the second eigenvector is: %f,%f\n",a[1],a[3]);
return 0;
}

The returned eigenvectors is somehow wrong when LAPACK_ROW_MAJOR is specified, however, everything is fine when changing to LAPACK_COL_MAJOR.

The stdout with export MKL_VERBOSE=1 is shown below:

1. COL_MAJOR (correct results)

MKL_VERBOSE Intel(R) MKL 2019.0 Update 3 Product build 20190125 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) enabled processors, Lnx 2.20GHz lp64 intel_thread
MKL_VERBOSE DSYEVD(V,U,2,0x7ffee9463680,2,0x7ffee94636a0,0x7ffee9463620,-1,0x7ffee9463628,-1,0) 27.85ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:28
MKL_VERBOSE DSYEVD(V,U,2,0x7ffee9463680,2,0x7ffee94636a0,0x22ce000,21,0x22cdf00,13,0) 243.59us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:28
the eigenvalue is: -1.000000,1.000000
the first eigenvector is: -0.707107,0.707107
the second eigenvector is: 0.707107,0.707107

2. ROW_MAJOR (wrong results)

MKL_VERBOSE Intel(R) MKL 2019.0 Update 3 Product build 20190125 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) enabled processors, Lnx 2.20GHz lp64 intel_thread
MKL_VERBOSE DSYEVD(V,U,2,0x7ffd6a6a3000,2,0x7ffd6a6a3020,0x7ffd6a6a2fa0,-1,0x7ffd6a6a2fa8,-1,0) 27.70ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:28
MKL_VERBOSE DSYEVD(V,U,2,0xd26100,2,0x7ffd6a6a3020,0xd26000,21,0xd25f00,13,0) 247.73us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:28
the eigenvalue is: -1.000000,1.000000
the first eigenvector is: -0.707107,1.000000
the second eigenvector is: 0.707107,0.707107

Pay attention to the difference on the first eigenvector.

0 Kudos
3 Replies
Khang_N_Intel
Employee
1,118 Views

Hi Simon,

Please upgrade to Intel(R) PSXE 2019 Update 4.  That would fix the issue.   

I was able to reproduce the issue when using the 2019 Update 3 version.  .

Hope this helps!

Khang

0 Kudos
zhang__simon1
Beginner
1,118 Views

Nguyen, Khang T (Intel) wrote:

Hi Simon,

Please upgrade to Intel(R) PSXE 2019 Update 4.  That would fix the issue.   

I was able to reproduce the issue when using the 2019 Update 3 version.  .

Hope this helps!

Khang

Thank you for your advice. Update 4 indeed fix this problem.

0 Kudos
Khang_N_Intel
Employee
1,118 Views

Hi Simon,

I am glad that I was able to help.

Best regards,

Khang

0 Kudos
Reply