<?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 getrf &amp; getrs caused a 'corrupted double-linked list' error in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/getrf-getrs-caused-a-corrupted-double-linked-list-error/m-p/1048936#M21063</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;We are using MKL calls dgetrf &amp;amp; dgetrs from MKL 11.2 Update 2 to solve linear systems of small size (typically 4 X 4 or 9 X 9 or 16 X 16). Here is how the program works - we need to perform computations with systems of different sizes. We allocate memory, compute, free and repeat as required. Eventually, after several allocate-compute-free cycles, when we free the dynamically allocated array 'a' in the documentation at&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/520892#642A8C07-088C-408D-BC89-D0F2A6E75416" target="_blank"&gt;https://software.intel.com/en-us/node/520892#642A8C07-088C-408D-BC89-D0F2A6E75416&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;we find that the program crashes with the error 'corrupted double-linked list' which suggests that 'ipiv' is over-writing/changing the malloc information for 'a'.&lt;/P&gt;

&lt;P&gt;When we avoid the dgetrf &amp;amp; dgetrs calls by using an alternative function (that does not require solving the system), we find that the code executes correctly and exits normally.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Furthermore, we have determined that allocating 'ipiv' to be of size 1 larger than suggested by the documentation at&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/520877#E4779E02-346C-4670-92AB-C67BD8559051" target="_blank"&gt;https://software.intel.com/en-us/node/520877#E4779E02-346C-4670-92AB-C67BD8559051&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;fixes the bug i.e. we do not see the 'corrupted double-linked list' error anymore and the program exits normally. Can you please confirm if the documentation is in error?&lt;/P&gt;

&lt;P&gt;We are happy to supply our codebase along with a makefile to help resolve the problem.&lt;/P&gt;

&lt;P&gt;Vishal Kasliwal &amp;amp; Michael Royster&lt;/P&gt;

&lt;P&gt;Department of Physics, Drexel University&lt;/P&gt;</description>
    <pubDate>Thu, 12 Mar 2015 19:07:14 GMT</pubDate>
    <dc:creator>Vishal1</dc:creator>
    <dc:date>2015-03-12T19:07:14Z</dc:date>
    <item>
      <title>getrf &amp; getrs caused a 'corrupted double-linked list' error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/getrf-getrs-caused-a-corrupted-double-linked-list-error/m-p/1048936#M21063</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;We are using MKL calls dgetrf &amp;amp; dgetrs from MKL 11.2 Update 2 to solve linear systems of small size (typically 4 X 4 or 9 X 9 or 16 X 16). Here is how the program works - we need to perform computations with systems of different sizes. We allocate memory, compute, free and repeat as required. Eventually, after several allocate-compute-free cycles, when we free the dynamically allocated array 'a' in the documentation at&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/520892#642A8C07-088C-408D-BC89-D0F2A6E75416" target="_blank"&gt;https://software.intel.com/en-us/node/520892#642A8C07-088C-408D-BC89-D0F2A6E75416&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;we find that the program crashes with the error 'corrupted double-linked list' which suggests that 'ipiv' is over-writing/changing the malloc information for 'a'.&lt;/P&gt;

&lt;P&gt;When we avoid the dgetrf &amp;amp; dgetrs calls by using an alternative function (that does not require solving the system), we find that the code executes correctly and exits normally.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Furthermore, we have determined that allocating 'ipiv' to be of size 1 larger than suggested by the documentation at&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/520877#E4779E02-346C-4670-92AB-C67BD8559051" target="_blank"&gt;https://software.intel.com/en-us/node/520877#E4779E02-346C-4670-92AB-C67BD8559051&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;fixes the bug i.e. we do not see the 'corrupted double-linked list' error anymore and the program exits normally. Can you please confirm if the documentation is in error?&lt;/P&gt;

&lt;P&gt;We are happy to supply our codebase along with a makefile to help resolve the problem.&lt;/P&gt;

&lt;P&gt;Vishal Kasliwal &amp;amp; Michael Royster&lt;/P&gt;

&lt;P&gt;Department of Physics, Drexel University&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 19:07:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/getrf-getrs-caused-a-corrupted-double-linked-list-error/m-p/1048936#M21063</guid>
      <dc:creator>Vishal1</dc:creator>
      <dc:date>2015-03-12T19:07:14Z</dc:date>
    </item>
    <item>
      <title>The information that you have</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/getrf-getrs-caused-a-corrupted-double-linked-list-error/m-p/1048937#M21064</link>
      <description>&lt;P&gt;The information that you have given is not sufficient to reproduce the problem. Here is a modified version of the DGETRS example distributed with MKL. It allocates, solves and deallocates the matrix, R.H.S. and IPIV arrays for a 4 X 4 matrix with NRHS=2, using the data provided with MKL for the DGETRS example. It does the allocate-factorize-solve-deallocate cycle 10,000 times. There were no errors (with the Windows version of MKL).&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;    Program xdgetrs
      Integer nin, nout
      Parameter (nin=5, nout=6)
      Integer nmax, lda, nrhmax, ldb
      Parameter (nmax=8, lda=nmax, nrhmax=nmax, ldb=nmax)
      Character trans
      Parameter (trans='N')
      Integer i, ifail, info, j, n, nrhs
      Double Precision, Allocatable :: a(:, :), b(:, :)
      Double Precision as(lda, nmax), bs(ldb, nrhmax)
      Integer, Allocatable :: ipiv(:)
      Double Precision pert(2)
      Integer astat
      External dgetrf, dgetrs
!
      Write (nout, *) 'DGETRS Example Program Results'
      Read (nin, *)
      Read (nin, *) n, nrhs
      If (n&amp;lt;=nmax .And. nrhs&amp;lt;=nrhmax) Then
        Read (nin, *)((as(i,j),j=1,n), i=1, n)
        Read (nin, *)((bs(i,j),j=1,nrhs), i=1, n)
        Do kiter = 1, 10000
          Allocate (a(n,n), b(n,nrhs), ipiv(n), Stat=astat)
          If (astat/=0) Stop 'Error allocating A, B and IPIV'
          Call random_number(pert)
          a(1:n, 1:n) = as(1:n, 1:n)*(1D0+0.01*pert(1))      !perturb
          b(1:n, 1:nrhs) = bs(1:n, 1:nrhs)*(1D0+0.01*pert(2))
          Call dgetrf(n, n, a, n, ipiv, info)
!
          If (info==0) Then
            Call dgetrs(trans, n, nrhs, a, n, ipiv, b, n, info)
            ifail = 0
            If (mod(kiter,1000)==0) Write (*, '(1x,i5,2x,2ES12.4)')  &amp;amp;
              kiter, (sum(b(:,i)), i=1, nrhs)
          Else
            Write (nout, *) 'The matrix factorization failed'
          End If
          Deallocate (a, b, ipiv)
        End Do
      End If
      Stop
!
    End Program xdgetrs&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2015 11:54:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/getrf-getrs-caused-a-corrupted-double-linked-list-error/m-p/1048937#M21064</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-03-13T11:54:44Z</dc:date>
    </item>
  </channel>
</rss>

