<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic I get different results from MKL and LAPACK.  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141954#M26367</link>
    <description>Has anybody experienced getting different results from -mkl and -llapack?

I've developed a fortran code that uses zgeev as in

LWORK=-1
call zgeev('N','N',Ndim,U,Ndim,Eig,VL,1,VR,1,WORKdummy,LWORK,RWORK,Info)
LWORK=INT(DBLE(WORKdummy(1)))
allocate (WORK(LWORK))
call zgeev('N','N',Ndim,U,Ndim,Eig,VL,1,VR,1,WORK,LWORK,RWORK,INFO)

For some parameters (NOT always), I get different results when I linked mkl and lapack.
Here are the compiling commands:
ifort -O3 -mkl -heap_arrays QWrandomEig.f90 
ifort -O3 -heap_arrays -llapack QWrandomEig.f90 

I'm attaching the source code as well as the input file and the output files,
QWrandomEig_output_mkl.dat
QWrandomEig_output_lapack.dat
respectively, which are different from each other. From the anticipated behavior,
I believe the latter (with lapack) is the correct result. More disturbingly, when
I compile the code with -O0 -mkl as in
ifort -O0 -heap_arrays -mkl QWrandomEig.f90 
I get the following error message when I run it:
Intel MKL ERROR: Parameter 2 was incorrect on entry to ZGEHD2.
although the code runs till the end and the result 
QWrandomEig_output_mkl_O0.dat
seems basically the same as the one with -O3 -mkl.

I do not get this problem for other parameter sets, which is very annoying.
Could someone guess what can be wrong with the code (or compiler for that matter)?
OS is Mac OS 10.13.4 and the fortran version is ifort version 18.0.2

I appreciate your opinions.</description>
    <pubDate>Sat, 16 Jun 2018 11:48:24 GMT</pubDate>
    <dc:creator>Naomichi_H_</dc:creator>
    <dc:date>2018-06-16T11:48:24Z</dc:date>
    <item>
      <title>I get different results from MKL and LAPACK.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141954#M26367</link>
      <description>Has anybody experienced getting different results from -mkl and -llapack?

I've developed a fortran code that uses zgeev as in

LWORK=-1
call zgeev('N','N',Ndim,U,Ndim,Eig,VL,1,VR,1,WORKdummy,LWORK,RWORK,Info)
LWORK=INT(DBLE(WORKdummy(1)))
allocate (WORK(LWORK))
call zgeev('N','N',Ndim,U,Ndim,Eig,VL,1,VR,1,WORK,LWORK,RWORK,INFO)

For some parameters (NOT always), I get different results when I linked mkl and lapack.
Here are the compiling commands:
ifort -O3 -mkl -heap_arrays QWrandomEig.f90 
ifort -O3 -heap_arrays -llapack QWrandomEig.f90 

I'm attaching the source code as well as the input file and the output files,
QWrandomEig_output_mkl.dat
QWrandomEig_output_lapack.dat
respectively, which are different from each other. From the anticipated behavior,
I believe the latter (with lapack) is the correct result. More disturbingly, when
I compile the code with -O0 -mkl as in
ifort -O0 -heap_arrays -mkl QWrandomEig.f90 
I get the following error message when I run it:
Intel MKL ERROR: Parameter 2 was incorrect on entry to ZGEHD2.
although the code runs till the end and the result 
QWrandomEig_output_mkl_O0.dat
seems basically the same as the one with -O3 -mkl.

I do not get this problem for other parameter sets, which is very annoying.
Could someone guess what can be wrong with the code (or compiler for that matter)?
OS is Mac OS 10.13.4 and the fortran version is ifort version 18.0.2

I appreciate your opinions.</description>
      <pubDate>Sat, 16 Jun 2018 11:48:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141954#M26367</guid>
      <dc:creator>Naomichi_H_</dc:creator>
      <dc:date>2018-06-16T11:48:24Z</dc:date>
    </item>
    <item>
      <title>Hi Naomichi H.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141955#M26368</link>
      <description>&lt;P&gt;Hi &lt;A href="https://software.intel.com/en-us/user/303717"&gt;&lt;U&gt;&lt;FONT color="#0066cc"&gt;Naomichi H.&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;&lt;/P&gt;

&lt;DIV class="forum-post-date"&gt;&lt;SPAN content="2018-06-16T04:48:24-07:00" property="dc:date dc:created" datatype="xsd:dateTime"&gt;I can reproduce the problem even under Linux. But i can't get same result as yours with liblapack. maybe different version.&lt;BR /&gt;
	​we will further investigate and update you if any news.&lt;BR /&gt;
	​if possible, could you please submit the issue to intel on-line service center:&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://supporttickets.intel.com/" target="_blank"&gt;http://supporttickets.intel.com/&lt;/A&gt;, where for your private information.&lt;BR /&gt;
	&lt;BR /&gt;
	Best Regards,&lt;BR /&gt;
	​Ying&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Jun 2018 06:17:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141955#M26368</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2018-06-25T06:17:08Z</dc:date>
    </item>
    <item>
      <title>Thank you very much for</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141956#M26369</link>
      <description>&lt;P&gt;Thank you very much for checking! I really appreciate it.&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;I don't know how to check the versions of my mkl and lapack, though I'm sure the mkl is the latest version. &lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;I will submit the issue to intel.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Naomichi&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 10:14:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141956#M26369</guid>
      <dc:creator>Naomichi_H_</dc:creator>
      <dc:date>2018-06-25T10:14:31Z</dc:date>
    </item>
    <item>
      <title>Hi Naomichi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141957#M26370</link>
      <description>&lt;P&gt;Hi Naomichi,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;We reproduced the issue reported by you. Many thanks for catching the issue.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;As concerns as the deviation in eigenvalues, unlike symmetric eigenvalue problems, eigenvalues and eigenvectors of non-symmetric problems are quite sensitive to round-off errors when the &amp;nbsp;associated sets of eigenvectors are ill-conditioned. You can find many examples in the literature (see for example the book “Matrix algorithm”, Vol 2 “Eigensystems”, pp 37-38 by G.W.Stewart), showing that even tiny perturbations of a matrix can &amp;nbsp;cause serious deviations of eigenvalues from the expected results. Because of this, the reference LAPACK and the MKL LAPACK cannot guarantee the repeatable results in the case of ill-conditioned eigensystems if the user changes compiler or compiler flags or platform or slightly perturbs systems. So all deviations in eigenvalues reported &amp;nbsp;by you and other peoples in the thread are expected. Intel &amp;nbsp;MKL can only guarantee the bit-to-bit correspondence of eigenvalues under the certain conditions. Please visit &lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/articles/introduction-to-the-conditional-numerical-reproducibility-cnr" style="font-size: 1em;"&gt;https://software.intel.com/en-us/articles/introduction-to-the-conditional-numerical-reproducibility-cnr&lt;/A&gt;&lt;SPAN style="font-size: 1em;"&gt; for more details about conditional numerical results.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;So one could ask which of the computed&amp;nbsp;eigenvalues are correct (MKL or reference) and which are not. In my opinion the best way to answer the question is to draw the so-called pseudospectra (please visit&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://www.cs.ox.ac.uk/pseudospectra/quickstart.html" style="font-size: 1em;"&gt;http://www.cs.ox.ac.uk/pseudospectra/quickstart.html&lt;/A&gt;&lt;SPAN style="font-size: 1em;"&gt; or &lt;/SPAN&gt;&lt;A href="https://math.nist.gov/MatrixMarket/spectral.html" style="font-size: 1em;"&gt;https://math.nist.gov/MatrixMarket/spectral.html&lt;/A&gt;&lt;SPAN style="font-size: 1em;"&gt; &amp;nbsp;for the definition of pseudospectra, software tools and examples). The pseudospectra is analytical and graphical tool for investigating the spectrum of non-hermitian matrices and operators. Using these resources you can also find a lot of beautiful pictures showing that deviation from expected results can be very high. In other words, if we draw the region on the complex plane corresponding to 10^-16-pseudospectra, any complex number from the region can be considered as an eigenvalues.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;So I believe that all results are provided by you are correct.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;All the best&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Sergey&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 22:52:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141957#M26370</guid>
      <dc:creator>Sergey_K_Intel1</dc:creator>
      <dc:date>2018-07-06T22:52:01Z</dc:date>
    </item>
    <item>
      <title>iDear Sergey</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141958#M26371</link>
      <description>&lt;P&gt;Dear Sergey Thank you for the reply, but I still wonder what the following error message means. &amp;gt;Intel MKL ERROR: Parameter 2 was incorrect on entry to ZGEHD2. which I got by compiling with -O0 option: &amp;gt;ifort -O0 -heap_arrays -mkl QWrandomEig.f90 Why does this message appear? I understand your point of the numerical instabilities. I can only tell you that the result of MKL LAPACK is certainly wrong from the point of view of my research. I was under the impression that it was somehow related to the error message above. best, Naomichi&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2018 05:22:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141958#M26371</guid>
      <dc:creator>Naomichi_H_</dc:creator>
      <dc:date>2018-07-07T05:22:27Z</dc:date>
    </item>
    <item>
      <title>Dear Naomichi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141959#M26372</link>
      <description>&lt;P&gt;Dear Naomichi,&lt;/P&gt;

&lt;P&gt;The error message mentioned by you doesn't have any impact on eigenvalues or eigenvectors. In order to find eigenvalues, the matrix is being reduced to the upper Hessenberg form and the reduction in MKL as in LAPACK is done by two methods: most&amp;nbsp; of work is done by a block version and the rest of&amp;nbsp; work by ZGEHD2. The last routine might issue an error message if all computational work is done by the block version. Of course we will fix the issue with this redundant error message.&lt;/P&gt;

&lt;P&gt;By the way, we see the similar eigenvalues with the latest versions of the reference LAPACK. So probably&amp;nbsp; the deviation is in due to changes in the reference LAPACK and&amp;nbsp; we assume that&amp;nbsp; you used an old version of the reference LAPACK for comparison. We would be much obliged to you if you let us know the version of reference LAPACK, compiler version and compiler flags used for building of LAPACK and BLAS binaries.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I also forgot to mention in the previous message, that the regular way to check correctness of non-symmetric eigenproblem is to compute eigenvalues and say the right&amp;nbsp; eigenvectors by calling ZGEEV('N', 'V', ...).&amp;nbsp; Then for each eigenpair (lambda(j) -eigenvalue, v(j) is the right eigenvector)&amp;nbsp; you need to compute || A*v(j) - lambda(j)*v(j) || / || A||.&amp;nbsp; &amp;nbsp; If this norm&amp;nbsp; is small enough for all eigenpairs, ZGEEV works correctly.&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;&amp;nbsp;Would you please check&amp;nbsp; correctness&amp;nbsp; on your system by computing these values?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Sergey&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 01:37:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-get-different-results-from-MKL-and-LAPACK/m-p/1141959#M26372</guid>
      <dc:creator>Sergey_K_Intel1</dc:creator>
      <dc:date>2018-07-10T01:37:24Z</dc:date>
    </item>
  </channel>
</rss>

