<?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 Re: GNU Octave gives different results with MKL in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1199329#M29896</link>
    <description>&lt;P&gt;So, the cause is an inconsistency/clash between two different threading models -- GNU Openmp vs. Intel Openmp. Thanks for reporting the workaround.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I agree that users of MKL on Linux should be informed about this somewhere (e.g., in the installation instructions for MKL). Unfortunately, as the years go by such information may become out of date or invalid, and the links may cease to point to an existing page.&lt;/P&gt;
&lt;P&gt;After looking at your post and the responses at savannah.gnu.org, I must say that the people there are very knowledgeable and helpful!&lt;/P&gt;</description>
    <pubDate>Tue, 11 Aug 2020 11:18:40 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2020-08-11T11:18:40Z</dc:date>
    <item>
      <title>GNU Octave gives different results with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198797#M29884</link>
      <description>&lt;P&gt;I am using GNU Octave 4.2.2 in Linux Mint 19.3 (which is based on Ubuntu 18.04).&lt;/P&gt;
&lt;P&gt;When I use Octave with MKL ( I downloaded the online installer, installed in /opt directory, and followed &lt;A href="https://askubuntu.com/a/913029/124466" target="_blank" rel="noopener"&gt;https://askubuntu.com/a/913029/124466&lt;/A&gt;), I get wrong results when working with big matrices.&lt;/P&gt;
&lt;P&gt;This is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for a = 1:500&lt;BR /&gt;for b = 1:500&lt;BR /&gt;c(a,b) = sin(a + b^2);&lt;BR /&gt;endfor&lt;BR /&gt;endfor&lt;/P&gt;
&lt;P&gt;g = eig(c);&lt;BR /&gt;max(real(g))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without MKL (using default openblas), the output is&amp;nbsp; "ans = 16.915"&lt;BR /&gt;With MKL, the output is "ans = 1.5922e+06" (but this answer keeps changing everytime the code is run!!!).&lt;/P&gt;
&lt;P&gt;I also checked some of my other codes (calculating eigenvalues and eigenvectors of certain matrices), and MKL always gives wrong results when the system size is big. MKL seems to diagonalize sparce matrices much faster, but it has become useless.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Aug 2020 16:23:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198797#M29884</guid>
      <dc:creator>ArchismanPanigrahi</dc:creator>
      <dc:date>2020-08-09T16:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: GNU Octave gives different results with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198890#M29885</link>
      <description>&lt;P&gt;You are probably blaming MKL without justification. I have not used Octave in two decades, and do not have it installed. Here, however, is a simple Fortran program that when compiled and linked with MKL gives the expected result.&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program archi
use lapack95
implicit none
integer i,j
double precision g(500,500)
double precision wr(500),wi(500)
do i=1,500
   do j=1,500
      g(i,j) = sin(dble(i)+j*j)
   end do
end do
call gees(g,wr,wi)
print *,maxval(wr)
end program&lt;/LI-CODE&gt;
&lt;P&gt;The output:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;   16.9148864979302&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 03:02:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198890#M29885</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-08-10T03:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: GNU Octave gives different results with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198900#M29886</link>
      <description>&lt;P&gt;It is still present with the `intel-mkl` packages from the default Ubuntu repositories in Xubuntu 20.04.&lt;/P&gt;
&lt;P&gt;Is this related to this Debian Bug? &lt;A href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921207" target="_blank" rel="noopener"&gt;https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921207&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/41971"&gt;@mecej4&lt;/a&gt;&amp;nbsp;By the way, I want to double check whether the bug is only present in Octave+MKL, or always with MKL. How do I compile your Fortran code with MKL in Ubuntu?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 05:14:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198900#M29886</guid>
      <dc:creator>ArchismanPanigrahi</dc:creator>
      <dc:date>2020-08-10T05:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: GNU Octave gives different results with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198934#M29887</link>
      <description>&lt;P&gt;Use the MKL link advisor at&amp;nbsp;&lt;A href="https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html&lt;/A&gt;&amp;nbsp; to find out the command line to compile and link a Fortran program. I have used the Lapack95 interface layer, and used Ifort 19.1U2 on Windows 10.&lt;/P&gt;
&lt;P&gt;You can also write the equivalent C code to solve the same problem. Whether you use C, Fortran and whether you use the GNU or Intel compilers, the underlying computational routines of MKL will be the same, so the results should match.&lt;/P&gt;
&lt;P&gt;I do not think that you will find any errors in a mature product such as MKL when you use direct calls in Fortran or C to MKL routines and the calls are correctly formulated and the arguments passed are correct.&lt;/P&gt;
&lt;P&gt;Lots of problems can occur when a package such as Matlab or Octave is used with MKL, and those problems are best addressed in places such as an Octave users' forum.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 07:30:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1198934#M29887</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-08-10T07:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: GNU Octave gives different results with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1199300#M29894</link>
      <description>&lt;P&gt;I have opened a bug report with Octave, and someone provided an &lt;A href="https://savannah.gnu.org/bugs/index.php?58926#comment6" target="_blank" rel="noopener"&gt;workaround&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Enter the command&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;export MKL_THREADING_LAYER=gnu&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and run "octave" from Terminal. Now it should work, and the speedup of MKL still remains!!&lt;/P&gt;
&lt;P&gt;To make this fix permanent, add the "export" line to the .bashrc file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this workaround should be at &lt;A href="https://software.intel.com/content/www/us/en/develop/articles/using-intel-mkl-in-gnu-octave.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/articles/using-intel-mkl-in-gnu-octave.html&lt;/A&gt; so that user's will know about it. This issue is absent for small matrices, so it might go unnoticed by the users, and they might get totally wrong results.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 08:49:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1199300#M29894</guid>
      <dc:creator>ArchismanPanigrahi</dc:creator>
      <dc:date>2020-08-11T08:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: GNU Octave gives different results with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1199329#M29896</link>
      <description>&lt;P&gt;So, the cause is an inconsistency/clash between two different threading models -- GNU Openmp vs. Intel Openmp. Thanks for reporting the workaround.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I agree that users of MKL on Linux should be informed about this somewhere (e.g., in the installation instructions for MKL). Unfortunately, as the years go by such information may become out of date or invalid, and the links may cease to point to an existing page.&lt;/P&gt;
&lt;P&gt;After looking at your post and the responses at savannah.gnu.org, I must say that the people there are very knowledgeable and helpful!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 11:18:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1199329#M29896</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-08-11T11:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: GNU Octave gives different results with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1200116#M29916</link>
      <description>&lt;P&gt;This test script has been updated with results from Python, Julia, Scilab, R and Octave&amp;nbsp; &lt;A href="https://gist.github.com/N0rbert/cfda101b8f0aa326df1edb6beee0076d#gistcomment-3415773" target="_blank" rel="noopener"&gt;https://gist.github.com/N0rbert/cfda101b8f0aa326df1edb6beee0076d&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It has been found that both Octave and R require the environment variable to be set, in order to produce correct results in the test script.&lt;/P&gt;
&lt;P&gt;However, even after setting environment variable, Octave undergoes segmentation fault (see &lt;A href="https://savannah.gnu.org/bugs/?58926#comment10" target="_blank" rel="noopener"&gt;https://savannah.gnu.org/bugs/?58926#comment10&lt;/A&gt;) when &lt;CODE&gt;__run_test_suite__&lt;/CODE&gt; is executed.&lt;/P&gt;
&lt;P&gt;It &lt;A href="https://gist.github.com/N0rbert/cfda101b8f0aa326df1edb6beee0076d#gistcomment-3415773" target="_self"&gt;has been reported&lt;/A&gt; by Norbert (author of the gist) that scilab has more test fails under MKL than under OpenBLAS.&lt;/P&gt;
&lt;P&gt;Softwares like Octave, Scilab and R give correct results with OpenBLAS, but they sometimes fail with MKL in Ubuntu and Debian.&lt;/P&gt;
&lt;P&gt;I am not saying MKL has bugs. Most likely there is some issue in the interfacing (e.g. the clash between GNU Openmp vs. Intel Openmp, but Octave still shows segmentation fault in its test run after using the workaround).&lt;/P&gt;
&lt;P&gt;Maybe only prebuilt binaries (installed from repositories) are affected, and maybe this issue won't arise when these softwares are built from source (I don't know, I am only speculating), but this is a very serious issue, and should be documented somewhere, because most users would tend to use the prebuilt binaries in distros like Ubuntu.&lt;/P&gt;
&lt;P&gt;Now that R is also affected, I would like to request the MKL community to investigate the issue further, and document it in pages like &lt;A href="https://software.intel.com/content/www/us/en/develop/articles/using-intel-mkl-in-gnu-octave.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/articles/using-intel-mkl-in-gnu-octave.html&lt;/A&gt; so that more users can avoid this bug.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 18:26:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/GNU-Octave-gives-different-results-with-MKL/m-p/1200116#M29916</guid>
      <dc:creator>ArchismanPanigrahi</dc:creator>
      <dc:date>2020-08-13T18:26:43Z</dc:date>
    </item>
  </channel>
</rss>

