<?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 The wrong result when using Pardiso solver to solve linear equations in parallel (OpenMP) in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1414332#M33644</link>
    <description>&lt;DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;I recently found a strange phenomenon&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;when calling the pardiso solver to solve a linear&amp;nbsp;equation, the details are as follows:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;For a linear equation with multiple right-hand sides: AX=B, where A is an n*n matrix, B is an n*m matrix, and m is the number of right-hand sides.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;When I solve the equation in the following way (pseudo code), the result is correct.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;do i=1,m&lt;BR /&gt;&amp;nbsp; &amp;nbsp;call pardiso(A,B(i),X(i))&lt;BR /&gt;end do&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;correct result:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ewigstern_3-1663030537380.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33310i33863042F2EFF2FF/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Ewigstern_3-1663030537380.png" alt="Ewigstern_3-1663030537380.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, when I solve the equation in the following way (pseudo code), all or some of the threads compute the same result, i.e. all or some of the columns of X are the same. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Notice:&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;1. I have confirmed that the B(i) entered in each loop is correct.&lt;BR /&gt;2. These same calculation results may be the correct result of a certain thread, or may be the initial 0 value.&lt;BR /&gt;3. In rare cases, all threads can get different calculation results, and the results are correct.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;!$OMP Parallel Do Num_Threads(p)&lt;BR /&gt;do i=1,m&lt;BR /&gt;&amp;nbsp; &amp;nbsp;call pardiso(A,B(i),X(i))&lt;BR /&gt;end do&lt;BR /&gt;!$OMP end Parallel Do&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;wrong or unexpected result:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ewigstern_4-1663030713611.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33311iC67CD9BCBC766C3D/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Ewigstern_4-1663030713611.png" alt="Ewigstern_4-1663030713611.png" /&gt;&lt;/span&gt;
&lt;P&gt;&lt;SPAN&gt;Note: Parallel results are&amp;nbsp;not repeatable (i.e.,&amp;nbsp;every time you run the code, you get a different result, and most of the time the results are&amp;nbsp;unexpected).&amp;nbsp; In addtion,&amp;nbsp;parallel results are often wrong or unexpected whether I use sequential or parallel MKL library.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Such a phenomenon is very strange, and it has puzzled me for a long time. I would like to know what is causing this? Is it not possible to call the pardiso solver in the OpenMP way? Or do I need to adjust the input parameters of the pardiso solver when calling the pardiso solver in OpenMP?&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Any help would be greatly appreciated!&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Some information that may be helpful in solving the problem is as follows：&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;1.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;MKL Version:&amp;nbsp;Intel(R) oneAPI Math Kernel Library Version 2022.1-Product Build 20220311 for Intel(R) 64 architecture applications.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;2.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Attachment is the simple test code I used.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Note: This test code works in VS Enterprise 2019.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;3.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;OS environment details:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Windows 10 v1909, i7 7700K,&amp;nbsp;Visual Studio Enterprise 2019.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;PS: Vidya, thank you so much for getting back to me, but for some reason I don't know, I can't get back to you under the original post. I'm so sorry about that, and the only thing I can do is post it again. I hope you can see it.&lt;/SPAN&gt;&lt;SPAN&gt; @VidyalathaB_Int&lt;WBR /&gt;el&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ewigstern&lt;/SPAN&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 13 Sep 2022 01:41:28 GMT</pubDate>
    <dc:creator>Ewigstern</dc:creator>
    <dc:date>2022-09-13T01:41:28Z</dc:date>
    <item>
      <title>The wrong result when using Pardiso solver to solve linear equations in parallel (OpenMP)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1414332#M33644</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;I recently found a strange phenomenon&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;when calling the pardiso solver to solve a linear&amp;nbsp;equation, the details are as follows:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;For a linear equation with multiple right-hand sides: AX=B, where A is an n*n matrix, B is an n*m matrix, and m is the number of right-hand sides.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;When I solve the equation in the following way (pseudo code), the result is correct.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;do i=1,m&lt;BR /&gt;&amp;nbsp; &amp;nbsp;call pardiso(A,B(i),X(i))&lt;BR /&gt;end do&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;correct result:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ewigstern_3-1663030537380.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33310i33863042F2EFF2FF/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Ewigstern_3-1663030537380.png" alt="Ewigstern_3-1663030537380.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, when I solve the equation in the following way (pseudo code), all or some of the threads compute the same result, i.e. all or some of the columns of X are the same. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Notice:&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;1. I have confirmed that the B(i) entered in each loop is correct.&lt;BR /&gt;2. These same calculation results may be the correct result of a certain thread, or may be the initial 0 value.&lt;BR /&gt;3. In rare cases, all threads can get different calculation results, and the results are correct.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;!$OMP Parallel Do Num_Threads(p)&lt;BR /&gt;do i=1,m&lt;BR /&gt;&amp;nbsp; &amp;nbsp;call pardiso(A,B(i),X(i))&lt;BR /&gt;end do&lt;BR /&gt;!$OMP end Parallel Do&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;wrong or unexpected result:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ewigstern_4-1663030713611.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33311iC67CD9BCBC766C3D/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Ewigstern_4-1663030713611.png" alt="Ewigstern_4-1663030713611.png" /&gt;&lt;/span&gt;
&lt;P&gt;&lt;SPAN&gt;Note: Parallel results are&amp;nbsp;not repeatable (i.e.,&amp;nbsp;every time you run the code, you get a different result, and most of the time the results are&amp;nbsp;unexpected).&amp;nbsp; In addtion,&amp;nbsp;parallel results are often wrong or unexpected whether I use sequential or parallel MKL library.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Such a phenomenon is very strange, and it has puzzled me for a long time. I would like to know what is causing this? Is it not possible to call the pardiso solver in the OpenMP way? Or do I need to adjust the input parameters of the pardiso solver when calling the pardiso solver in OpenMP?&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Any help would be greatly appreciated!&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Some information that may be helpful in solving the problem is as follows：&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;1.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;MKL Version:&amp;nbsp;Intel(R) oneAPI Math Kernel Library Version 2022.1-Product Build 20220311 for Intel(R) 64 architecture applications.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;2.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Attachment is the simple test code I used.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Note: This test code works in VS Enterprise 2019.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;3.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;OS environment details:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Windows 10 v1909, i7 7700K,&amp;nbsp;Visual Studio Enterprise 2019.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;PS: Vidya, thank you so much for getting back to me, but for some reason I don't know, I can't get back to you under the original post. I'm so sorry about that, and the only thing I can do is post it again. I hope you can see it.&lt;/SPAN&gt;&lt;SPAN&gt; @VidyalathaB_Int&lt;WBR /&gt;el&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ewigstern&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Sep 2022 01:41:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1414332#M33644</guid>
      <dc:creator>Ewigstern</dc:creator>
      <dc:date>2022-09-13T01:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: The wrong result when using Pardiso solver to solve linear equations in parallel (OpenMP)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1414686#M33651</link>
      <description>&lt;P&gt;Hi Ewigstern,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please let us know the reason/use case behind calling pardiso in OpenMP parallel region? Because according to the MKL manual&lt;/P&gt;
&lt;P&gt;"By default, Intel® oneAPI Math Kernel Library uses the number of OpenMP threads equal to the number of physical cores on the system."&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.intel.com/content/www/us/en/develop/documentation/onemkl-windows-developer-guide/top/managing-performance-and-memory/improving-performance-with-threading.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/develop/documentation/onemkl-windows-developer-guide/top/managing-performance-and-memory/improving-performance-with-threading.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;To do that you can run the code by setting MKL to the /Qmkl: Parallel option.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;I need to adjust the input parameters of the pardiso solver when calling the pardiso solver in OpenMP&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Maybe you can refer to the below link which might help you&amp;nbsp;&lt;A href="https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/sparse-solver-routines/onemkl-pardiso-parallel-direct-sparse-solver-iface/pardiso-iparm-parameter.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/sparse-solver-routines/onemkl-pardiso-parallel-direct-sparse-solver-iface/pardiso-iparm-parameter.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vidya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 13:03:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1414686#M33651</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2022-09-14T13:03:22Z</dc:date>
    </item>
    <item>
      <title>Re:The wrong result when using Pardiso solver to solve linear equations in parallel (OpenMP)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1416197#M33687</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Reminder: &lt;/P&gt;&lt;P&gt;As we haven't back from you, could you please provide us with an update regarding the issue ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vidya.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Sep 2022 09:10:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1416197#M33687</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2022-09-21T09:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: The wrong result when using Pardiso solver to solve linear equations in parallel (OpenMP)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1670458#M36962</link>
      <description>&lt;P&gt;Calling oneMKL Pardiso in a parallel region with the same handle pt is not valid usage. Because pt is the handle to some internal data structures that are shared by all the threads. We will add a note about it in the 2025.1 developer reference.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2025 23:38:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/The-wrong-result-when-using-Pardiso-solver-to-solve-linear/m-p/1670458#M36962</guid>
      <dc:creator>Fengrui</dc:creator>
      <dc:date>2025-02-26T23:38:46Z</dc:date>
    </item>
  </channel>
</rss>

