<?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 Adding write statements to a subroutine breaks the MKL lib  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Adding-write-statements-to-a-subroutine-breaks-the-MKL-lib/m-p/1149859#M27019</link>
    <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi all,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Classic strange behaviour with write statements in a subroutine. Adding them breaks the MKL library.&lt;/P&gt;

&lt;P&gt;Without the writes, the dolfyn CFD code (written in f2003) runs:&lt;/P&gt;

&lt;PRE class="brush:;"&gt; Flag   Step    Res U     Res V     Res W     Mass      Res k     Res eps   Res T          U         V         W         P         k        eps        T
     :     1:  1.36E-04  7.41E-05  0.00E+00  5.71E-02  0.00E+00  0.00E+00  0.00E+00     4.58E+00 -1.65E+00  0.00E+00 -1.39E+01  0.00E+00  0.00E+00  0.00E+00
     :     2:  9.50E-04  1.02E-03  0.00E+00  3.35E-02  0.00E+00  0.00E+00  0.00E+00     4.73E+00 -1.57E+00  0.00E+00 -1.47E+01  0.00E+00  0.00E+00  0.00E+00
&lt;/PRE&gt;

&lt;P&gt;Adding them:&lt;/P&gt;

&lt;PRE class="brush:;"&gt; *** Error: Failed preconditioner of mkl solver         -103
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 Flag   Step    Res U     Res V     Res W     Mass      Res k     Res eps   Res T          U         V         W         P         k        eps        T
     :     1:  1.36E-04  7.41E-05  0.00E+00  3.61E-01  0.00E+00  0.00E+00  0.00E+00     4.68E+00 -2.52E+00  0.00E+00 -2.22E+01  0.00E+00  0.00E+00  0.00E+00
 *** Error: Failed preconditioner of mkl solver         -103
     :     2:  1.24E-03  1.54E-03  0.00E+00  6.94E-02  0.00E+00  0.00E+00  0.00E+00     4.92E+00 -1.41E+00  0.00E+00  1.13E+01  0.00E+00  0.00E+00  0.00E+00
 *** Error: Failed preconditioner of mkl solver         -103
&lt;/PRE&gt;

&lt;P&gt;The difference in the two subroutines is:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;$ diff solver_mkl_OK.f90 solver_mkl_FOUT.f90
199c199
&amp;lt;        write(IOdef,*)'*** Error: Failed preconditioner of mkl solver'
---
&amp;gt;        write(IOdef,*)'*** Error: Failed preconditioner of mkl solver ',IERR
238a239
&amp;gt;      write(IOdbg,*)'*** start solver dfgmres'
242a244
&amp;gt;        !    dfgmres( n,    x,  b,  RCI_request,    ipar,    dpar,    tmp)
243a246
&amp;gt;        write(IOdbg,*)'*** solver dfgmres returns with ',RCI_request
250a254,256
&amp;gt;          ! multiply the matrix by tmp(ipar(22)), put the result in tmp(ipar(23)), 
&amp;gt;          ! and return the control to the dfgmres routine
&amp;gt;          
259c265,266
&amp;lt;          write(iodef,*)'*** Error: Failed in mkl solver'
---
&amp;gt;          write(IOdbg,*)'*** Error: Failed in mkl solver dfgmres, i =',i,'RCI',RCI_request
&amp;gt;          write(iodef,*)'*** Error: Failed in mkl solver dfgmres, i =',i,'RCI',RCI_request
270c277
&amp;lt;      write(IOdbg,*)'Leave MKL solve P'
---
&amp;gt;      write(IOdbg,*)'Leave MKL solve P',RCI_request
&lt;/PRE&gt;

&lt;P&gt;As you can see no significant differences.&lt;/P&gt;

&lt;P&gt;The full code, with two versions of subroutines, is in the tarball along with a small demo data set. Unpack it on a linux box with ifort. Change into test and hit:&lt;/P&gt;

&lt;P&gt;$ ./go.sh&lt;/P&gt;

&lt;P&gt;To reproduce the bug (or not).&amp;nbsp;&lt;/P&gt;

&lt;P&gt;$ ifort --version&lt;BR /&gt;
	ifort (IFORT) 17.0.4 20170411&lt;BR /&gt;
	Copyright (C) 1985-2017 Intel Corporation. &amp;nbsp;All rights reserved.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;$ uname -a&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;Linux tennekes 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Ubuntu 16.04.2 LTS&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;Intel i7-6700HQ CPU @ 2.60GHz&lt;BR /&gt;
	Lenovo Y700 16GB&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Any hints or suggestions welcome, but this might interest the developers more.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;

&lt;P&gt;Henk&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jul 2017 17:35:34 GMT</pubDate>
    <dc:creator>Henk_K_</dc:creator>
    <dc:date>2017-07-18T17:35:34Z</dc:date>
    <item>
      <title>Adding write statements to a subroutine breaks the MKL lib</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Adding-write-statements-to-a-subroutine-breaks-the-MKL-lib/m-p/1149859#M27019</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi all,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Classic strange behaviour with write statements in a subroutine. Adding them breaks the MKL library.&lt;/P&gt;

&lt;P&gt;Without the writes, the dolfyn CFD code (written in f2003) runs:&lt;/P&gt;

&lt;PRE class="brush:;"&gt; Flag   Step    Res U     Res V     Res W     Mass      Res k     Res eps   Res T          U         V         W         P         k        eps        T
     :     1:  1.36E-04  7.41E-05  0.00E+00  5.71E-02  0.00E+00  0.00E+00  0.00E+00     4.58E+00 -1.65E+00  0.00E+00 -1.39E+01  0.00E+00  0.00E+00  0.00E+00
     :     2:  9.50E-04  1.02E-03  0.00E+00  3.35E-02  0.00E+00  0.00E+00  0.00E+00     4.73E+00 -1.57E+00  0.00E+00 -1.47E+01  0.00E+00  0.00E+00  0.00E+00
&lt;/PRE&gt;

&lt;P&gt;Adding them:&lt;/P&gt;

&lt;PRE class="brush:;"&gt; *** Error: Failed preconditioner of mkl solver         -103
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 *** Error: Failed in mkl solver dfgmres, i =         302 RCI          -1
 Flag   Step    Res U     Res V     Res W     Mass      Res k     Res eps   Res T          U         V         W         P         k        eps        T
     :     1:  1.36E-04  7.41E-05  0.00E+00  3.61E-01  0.00E+00  0.00E+00  0.00E+00     4.68E+00 -2.52E+00  0.00E+00 -2.22E+01  0.00E+00  0.00E+00  0.00E+00
 *** Error: Failed preconditioner of mkl solver         -103
     :     2:  1.24E-03  1.54E-03  0.00E+00  6.94E-02  0.00E+00  0.00E+00  0.00E+00     4.92E+00 -1.41E+00  0.00E+00  1.13E+01  0.00E+00  0.00E+00  0.00E+00
 *** Error: Failed preconditioner of mkl solver         -103
&lt;/PRE&gt;

&lt;P&gt;The difference in the two subroutines is:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;$ diff solver_mkl_OK.f90 solver_mkl_FOUT.f90
199c199
&amp;lt;        write(IOdef,*)'*** Error: Failed preconditioner of mkl solver'
---
&amp;gt;        write(IOdef,*)'*** Error: Failed preconditioner of mkl solver ',IERR
238a239
&amp;gt;      write(IOdbg,*)'*** start solver dfgmres'
242a244
&amp;gt;        !    dfgmres( n,    x,  b,  RCI_request,    ipar,    dpar,    tmp)
243a246
&amp;gt;        write(IOdbg,*)'*** solver dfgmres returns with ',RCI_request
250a254,256
&amp;gt;          ! multiply the matrix by tmp(ipar(22)), put the result in tmp(ipar(23)), 
&amp;gt;          ! and return the control to the dfgmres routine
&amp;gt;          
259c265,266
&amp;lt;          write(iodef,*)'*** Error: Failed in mkl solver'
---
&amp;gt;          write(IOdbg,*)'*** Error: Failed in mkl solver dfgmres, i =',i,'RCI',RCI_request
&amp;gt;          write(iodef,*)'*** Error: Failed in mkl solver dfgmres, i =',i,'RCI',RCI_request
270c277
&amp;lt;      write(IOdbg,*)'Leave MKL solve P'
---
&amp;gt;      write(IOdbg,*)'Leave MKL solve P',RCI_request
&lt;/PRE&gt;

&lt;P&gt;As you can see no significant differences.&lt;/P&gt;

&lt;P&gt;The full code, with two versions of subroutines, is in the tarball along with a small demo data set. Unpack it on a linux box with ifort. Change into test and hit:&lt;/P&gt;

&lt;P&gt;$ ./go.sh&lt;/P&gt;

&lt;P&gt;To reproduce the bug (or not).&amp;nbsp;&lt;/P&gt;

&lt;P&gt;$ ifort --version&lt;BR /&gt;
	ifort (IFORT) 17.0.4 20170411&lt;BR /&gt;
	Copyright (C) 1985-2017 Intel Corporation. &amp;nbsp;All rights reserved.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;$ uname -a&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;Linux tennekes 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Ubuntu 16.04.2 LTS&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;Intel i7-6700HQ CPU @ 2.60GHz&lt;BR /&gt;
	Lenovo Y700 16GB&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Any hints or suggestions welcome, but this might interest the developers more.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;

&lt;P&gt;Henk&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 17:35:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Adding-write-statements-to-a-subroutine-breaks-the-MKL-lib/m-p/1149859#M27019</guid>
      <dc:creator>Henk_K_</dc:creator>
      <dc:date>2017-07-18T17:35:34Z</dc:date>
    </item>
    <item>
      <title>I've tested your code using</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Adding-write-statements-to-a-subroutine-breaks-the-MKL-lib/m-p/1149860#M27020</link>
      <description>&lt;P&gt;I've tested your code using ifort 2018 and had no error. You can try to join our PS XE 2018 program as a workaround.&lt;/P&gt;

&lt;P&gt;I'm testing ifort 2017 for this issue.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 07:39:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Adding-write-statements-to-a-subroutine-breaks-the-MKL-lib/m-p/1149860#M27020</guid>
      <dc:creator>Jing_Xu</dc:creator>
      <dc:date>2017-07-21T07:39:42Z</dc:date>
    </item>
    <item>
      <title>Thank you for responding!</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Adding-write-statements-to-a-subroutine-breaks-the-MKL-lib/m-p/1149861#M27021</link>
      <description>&lt;P&gt;Thank you for responding!&lt;/P&gt;

&lt;P&gt;The workaround options are simple; as it is a calling (driver) subroutine only one can alter the compiler statements (-g and/or -O0 etc), or change the order of the write statements (and yes alter them as well).&lt;/P&gt;

&lt;P&gt;It is not a big issue, but somewhere the compiler (on Ubuntu 16.04.2) fails. I do agree that these are very annoying bugs :- )&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 10:26:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Adding-write-statements-to-a-subroutine-breaks-the-MKL-lib/m-p/1149861#M27021</guid>
      <dc:creator>Henk_K_</dc:creator>
      <dc:date>2017-07-21T10:26:52Z</dc:date>
    </item>
  </channel>
</rss>

