<?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: Issue with workspace size generated by DGEEV in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1662783#M36906</link>
    <description>&lt;P&gt;There are two different values of lwork used by all LAPACK routines and they behave differently depending on its value. First, all LAPACK routines always return the optimal size of the work array if lwork is set to -1. The optimal size depends on OneMKL or Reference LAPACK version and/or precision type and/or the type of OS and/or the number of threads and/or CPU. It’s not a constant and it may vary.&amp;nbsp; This value is recommended for getting the best performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the same time LAPACK routines are using the minimal required value of LWORK and online Reference LAPACK documentation always mentions the minimal value of LWORK. For example,&amp;nbsp;&amp;nbsp;&amp;nbsp; Netlib Reference LAPACK&amp;nbsp; for DGEEV says&lt;/P&gt;&lt;P&gt;“&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LWORK is INTEGER&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The dimension of the array WORK.&amp;nbsp; LWORK &amp;gt;= max(1,3*N), and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if JOBVL = 'V' or JOBVR = 'V', LWORK &amp;gt;= 4*N.&amp;nbsp; For good&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; performance, LWORK must generally be larger.”&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please also pay attention to the following sentence in OneMKL Developer Reference (&lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/geev.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/geev.html&lt;/A&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;“Note that if you set&amp;nbsp;&lt;SPAN&gt;lwork&lt;/SPAN&gt;&amp;nbsp;to less than the minimal required value and not -1, the routine exits immediately with an error and does not provide any information on the recommended workspace.“&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So DGEEV as well as any another LAPACK must work&amp;nbsp; if and only if LWORK is greater or equal to the minimal required value of LWORK&amp;nbsp; (6 in your case because of jobr=’N’ jobvl=”N”). If LWORK is less than the minimal required value, you get an error message.&lt;/P&gt;&lt;P&gt;By the way you can use the LAPACKE interface for DGEEV (please see &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-0/geev.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-0/geev.html&lt;/A&gt;). In the case of using LAPACKE_dgeev you don’t need to take care of the LWORK size.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;Sergey&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2025 22:37:24 GMT</pubDate>
    <dc:creator>Sergey_K_Intel1</dc:creator>
    <dc:date>2025-02-03T22:37:24Z</dc:date>
    <item>
      <title>Issue with workspace size generated by DGEEV</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1659614#M36860</link>
      <description>&lt;P&gt;When using DGEEV in the below example, the first element of work (supposed to be the optimal workspace size for the calculation) is computed as 1. The call requires a minimum value of 8, so if we do a call to compute the workspace size and then do a call with that size it fails. Older versions of MKL as well as when calling SGEEV with the same inputs all return 68 as the optimal workspace size.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I first noticed this when moving from a very old version of MKL 2018, to the 2024 version, but it is still present in the latest version (INTEL_MKL_VERSION 20250001)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#include "mkl.h"

typedef double dtype;

int main()
{
    const char* jobvl = "N";
    const char* jobvr = "N";
    const int n = 2;
    dtype a[] = {1,3,3,1};
    const int lda = 2;
    dtype wr[] = {0,0};
    dtype wi[] = {0,0};
    const int ldvl = 2;
    const int ldvr = 2;
    dtype w = 8;
    dtype* work = &amp;amp;w;
    int lwork = 8;
    int info = -1;

    DGEEV(
        jobvl,
        jobvr,
        &amp;amp;n,
        a,
        &amp;amp;lda,
        wr,
        wi,
        NULL,
        &amp;amp;ldvl,
        NULL,
        &amp;amp;ldvr,
        work,
        &amp;amp;lwork,
        &amp;amp;info
    );
    return work[0]; // returns 1
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 21:53:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1659614#M36860</guid>
      <dc:creator>david_engel</dc:creator>
      <dc:date>2025-01-22T21:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with workspace size generated by DGEEV</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1662222#M36897</link>
      <description>&lt;P&gt;There is a mistake in your code. Namely in order&amp;nbsp; to get the optimal size&amp;nbsp; of the work array, lwork (not info = -1 as you set) must be set to -1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we do this change (e.g.&amp;nbsp; replace&amp;nbsp;&lt;SPAN class=""&gt;int&lt;/SPAN&gt;&lt;SPAN&gt; lwork &lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;8&lt;/SPAN&gt;&lt;SPAN class=""&gt;; with&amp;nbsp;&lt;SPAN class=""&gt;int&lt;/SPAN&gt;&lt;SPAN&gt; lwork &lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&amp;nbsp;-1; )&lt;/SPAN&gt; , you code return 6 and 6 is the correct number&amp;nbsp; according to the documentation (please take a look at the Lapack User's Guide &lt;A href="https://www.netlib.org/lapack/lug/" target="_blank"&gt;https://www.netlib.org/lapack/lug/&lt;/A&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact,&amp;nbsp; the code you provided computes eigenvalue and it doesn't&amp;nbsp; return the optimal size, and if we insert&amp;nbsp; printing of the computed eigenvalue like this&lt;/P&gt;&lt;P&gt;printf( " first eigenvalue %15.8e +i %15.8e \n", wr[0], wi[0]);&lt;BR /&gt;printf( " second eigenvalue %15.8e +i %15.8e \n", wr[1], wi[1]);&lt;/P&gt;&lt;P&gt;we get&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ ./a.out&lt;/P&gt;&lt;P&gt;first eigenvalue 4.00000000e+00 + i 0.00000000e+00&lt;BR /&gt;second eigenvalue -2.00000000e+00 + i 0.00000000e+00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as it should be.&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;Sergey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2025 01:53:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1662222#M36897</guid>
      <dc:creator>Sergey_K_Intel1</dc:creator>
      <dc:date>2025-02-01T01:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with workspace size generated by DGEEV</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1662752#M36903</link>
      <description>&lt;P&gt;Hi Sergey,&lt;/P&gt;&lt;P&gt;I think there is some confusion here. If I supply -1 for lwork, then we return 6, which is a valid workspace size to be used in subsequent runs, but as per&amp;nbsp;the ?geev documentation:&lt;/P&gt;&lt;P&gt;"If you are in doubt how much workspace to supply, use a generous value of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;lwork&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for the first run or set&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;lwork&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= -1.&lt;/P&gt;&lt;P&gt;If you choose the first option and set any of admissible&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;lwork&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;sizes, which is no less than the minimal value described, the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;work&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;on exit. Use this value (&lt;SPAN class=""&gt;work&lt;/SPAN&gt;(1)) for subsequent runs."&lt;/P&gt;&lt;P&gt;So regardless of whether or not I set lwork to -1, this should complete the task, and then the optimal workspace size should be the first element of of the work array. The first element of the work array after the run is 1. Or if it means index 1, the result of work[1] is 3. For both of these values, if I use it as lwork in a subsequent run, the run fails.&lt;/P&gt;&lt;P&gt;Furthermore, if I do this exact same computation with SGEEV, it completes successfully and the first element of the work array is 68, which is the value it was in older versions of MKL.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 20:43:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1662752#M36903</guid>
      <dc:creator>david_engel</dc:creator>
      <dc:date>2025-02-03T20:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with workspace size generated by DGEEV</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1662783#M36906</link>
      <description>&lt;P&gt;There are two different values of lwork used by all LAPACK routines and they behave differently depending on its value. First, all LAPACK routines always return the optimal size of the work array if lwork is set to -1. The optimal size depends on OneMKL or Reference LAPACK version and/or precision type and/or the type of OS and/or the number of threads and/or CPU. It’s not a constant and it may vary.&amp;nbsp; This value is recommended for getting the best performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the same time LAPACK routines are using the minimal required value of LWORK and online Reference LAPACK documentation always mentions the minimal value of LWORK. For example,&amp;nbsp;&amp;nbsp;&amp;nbsp; Netlib Reference LAPACK&amp;nbsp; for DGEEV says&lt;/P&gt;&lt;P&gt;“&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LWORK is INTEGER&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The dimension of the array WORK.&amp;nbsp; LWORK &amp;gt;= max(1,3*N), and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if JOBVL = 'V' or JOBVR = 'V', LWORK &amp;gt;= 4*N.&amp;nbsp; For good&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; performance, LWORK must generally be larger.”&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please also pay attention to the following sentence in OneMKL Developer Reference (&lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/geev.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-0/geev.html&lt;/A&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;“Note that if you set&amp;nbsp;&lt;SPAN&gt;lwork&lt;/SPAN&gt;&amp;nbsp;to less than the minimal required value and not -1, the routine exits immediately with an error and does not provide any information on the recommended workspace.“&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So DGEEV as well as any another LAPACK must work&amp;nbsp; if and only if LWORK is greater or equal to the minimal required value of LWORK&amp;nbsp; (6 in your case because of jobr=’N’ jobvl=”N”). If LWORK is less than the minimal required value, you get an error message.&lt;/P&gt;&lt;P&gt;By the way you can use the LAPACKE interface for DGEEV (please see &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-0/geev.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-0/geev.html&lt;/A&gt;). In the case of using LAPACKE_dgeev you don’t need to take care of the LWORK size.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;Sergey&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 22:37:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issue-with-workspace-size-generated-by-DGEEV/m-p/1662783#M36906</guid>
      <dc:creator>Sergey_K_Intel1</dc:creator>
      <dc:date>2025-02-03T22:37:24Z</dc:date>
    </item>
  </channel>
</rss>

