<?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: Tension between C++'s complex and MKL (ZGEMM) in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913875#M12395</link>
    <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/334681"&gt;Gennady Fedorov (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; Barak,&lt;BR /&gt;please look at the &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=67011"&gt;post &lt;/A&gt;disccused earlier. &lt;BR /&gt;you can find zgemm_bug_small.cpp example there... will it help you?&lt;BR /&gt;--Gennady&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hi Gennady,&lt;BR /&gt;&lt;BR /&gt;I'm not sure it does. I am comparing the results of calling ZGEMM from C++ to those obtained with MTL, and am getting results which are _not_ exact at machine precision. Then, when I iterate the multiplications these small errors become significant.&lt;BR /&gt;&lt;BR /&gt;I'm not sure how to debug this... &lt;BR /&gt;&lt;BR /&gt;Do you know of any alternatives to ZGEMM? I actually only need to multiply ywo complex matrices together...&lt;BR /&gt;</description>
    <pubDate>Tue, 12 Jan 2010 09:49:40 GMT</pubDate>
    <dc:creator>barakb</dc:creator>
    <dc:date>2010-01-12T09:49:40Z</dc:date>
    <item>
      <title>Tension between C++'s complex and MKL (ZGEMM)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913873#M12393</link>
      <description>Hi there, &lt;BR /&gt;&lt;BR /&gt;I am developing a code in C++ and need to multiply complex matrices together. I want to use BLAS's ZGEMM, but am getting strange results which, I think, are due to precisions issues:&lt;BR /&gt;&lt;BR /&gt;My matrices are defined with complex&lt;DOUBLE&gt; and I use ZGEMM as an external function: I define it with either&lt;BR /&gt;&lt;BR /&gt;extern "C" {void zgemm(const char*, const char*, const int*, const int*, const int*,const complex&lt;DOUBLE&gt; *, const complex&lt;DOUBLE&gt; *, const int*, const complex&lt;DOUBLE&gt; *, const int*, const complex&lt;DOUBLE&gt;*, complex&lt;DOUBLE&gt; *,const int*);}&lt;BR /&gt;&lt;BR /&gt;or, due to possible inconsistencies between complex&lt;DOUBLE&gt; and MKL_Complex16, with&lt;BR /&gt;&lt;BR /&gt;extern "C" {void zgemm_(const char*, const char*, const int*, const int*, const int*,const void*, void*&lt;BR /&gt;, const int*, void*, const int*, const void*, void*,const int*);}&lt;BR /&gt;&lt;BR /&gt;and while the code compiles, I find that when I use ZGEMM iteratively (i.e. put as input matrices that were obtained as output before hand), then after many iterations (depending on the size of the matrices), results are wrong.&lt;BR /&gt;&lt;BR /&gt;This leads me to suspect that the way I define zgemm above leads to incompatibilities in the way complex variables are defined in C++ and MKL. &lt;BR /&gt;&lt;BR /&gt;To fix this I tried to follow the MKL's user manual suggestion and to add&lt;BR /&gt;&lt;BR /&gt;#define MKL_Complex16 complex&lt;DOUBLE&gt;&lt;BR /&gt;#include "mkl.h"&lt;BR /&gt;&lt;BR /&gt;to my code, but this does not compile! I get the compilation error&lt;BR /&gt;&lt;BR /&gt;/local/opt/intel/mkl/10.0.2.018/include/mkl_types.h(43): error: expected a ";"&lt;BR /&gt; } MKL_Complex16;&lt;BR /&gt; ^&lt;BR /&gt;&lt;BR /&gt;So, does anyone know how to properly call from C++ MKL functions with complex variables ?&lt;BR /&gt;&lt;BR /&gt;I don't think I do ;-)&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Barak&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;</description>
      <pubDate>Sat, 09 Jan 2010 00:24:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913873#M12393</guid>
      <dc:creator>barakb</dc:creator>
      <dc:date>2010-01-09T00:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Tension between C++'s complex and MKL (ZGEMM)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913874#M12394</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Barak,&lt;BR /&gt;please look at the &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=67011"&gt;post &lt;/A&gt;disccused earlier. &lt;BR /&gt;you can find zgemm_bug_small.cpp example there... will it help you?&lt;BR /&gt;--Gennady&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Jan 2010 08:43:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913874#M12394</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2010-01-09T08:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Tension between C++'s complex and MKL (ZGEMM)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913875#M12395</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/334681"&gt;Gennady Fedorov (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; Barak,&lt;BR /&gt;please look at the &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=67011"&gt;post &lt;/A&gt;disccused earlier. &lt;BR /&gt;you can find zgemm_bug_small.cpp example there... will it help you?&lt;BR /&gt;--Gennady&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hi Gennady,&lt;BR /&gt;&lt;BR /&gt;I'm not sure it does. I am comparing the results of calling ZGEMM from C++ to those obtained with MTL, and am getting results which are _not_ exact at machine precision. Then, when I iterate the multiplications these small errors become significant.&lt;BR /&gt;&lt;BR /&gt;I'm not sure how to debug this... &lt;BR /&gt;&lt;BR /&gt;Do you know of any alternatives to ZGEMM? I actually only need to multiply ywo complex matrices together...&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jan 2010 09:49:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913875#M12395</guid>
      <dc:creator>barakb</dc:creator>
      <dc:date>2010-01-12T09:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Tension between C++'s complex and MKL (ZGEMM)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913876#M12396</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Hi barakb,&lt;BR /&gt;&lt;BR /&gt;That ZGEMM from MKL and similar functionfrom MTL produce results that are not identical to the last bit is expected. Moreover, ZGEMM may produce non-identical results from run to run on the same machine if it is run in threaded mode (see for example a discussion on&lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=70105"&gt;MKL numerical stability and threading&lt;/A&gt;). That the iterative algorithm diverges is more the property of that algorithm rather than deficiency of matrix-matrix multiplication. You may observedifferent resultsiterating even simpler logistics equation: x = lambda*x*(1 - x).&lt;BR /&gt;&lt;BR /&gt;Regarding compilation error, the version of MKL you use (10.0.2) doesn't contain sentinels that check if MKL_Complex16 is already defined. They are introduced in a later MKL release. However, you may solve this compile problem with this trick:&lt;BR /&gt;&lt;BR /&gt;#define MKL_Complex16 forget_this_name&lt;BR /&gt;#include "mkl_types.h"&lt;BR /&gt;#undef MKL_Complex16&lt;BR /&gt;&lt;BR /&gt;#define MKL_Complex16 complex&lt;DOUBLE&gt;&lt;BR /&gt;#include "mkl.h"&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Dima&lt;BR /&gt;&lt;/DOUBLE&gt;</description>
      <pubDate>Tue, 12 Jan 2010 10:09:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Tension-between-C-s-complex-and-MKL-ZGEMM/m-p/913876#M12396</guid>
      <dc:creator>Dmitry_B_Intel</dc:creator>
      <dc:date>2010-01-12T10:09:25Z</dc:date>
    </item>
  </channel>
</rss>

