Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Zhang__Simon
Beginner
136 Views

Possible issue in MKL LAPACKE interface when using LAPACK_ROW_MAJOR

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
136 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

zhang__simon1
Beginner
136 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.

Khang_N_Intel
Employee
136 Views

Hi Simon,

I am glad that I was able to help.

Best regards,

Khang

Reply