<?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 &amp;gt;&amp;gt; Can't I link w/ gcc using  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/syrk-mkl-armadillo-wrong-output/m-p/1133919#M25837</link>
    <description>&lt;P&gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;SPAN style="font-size: 12px;"&gt;Can't I link w/ gcc using -lmkl_rt?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;this is valid option to link with MKL. &amp;nbsp;This looks like some problem with armadillio package. &amp;nbsp;You may try to call mkl's syrk directly and play with different compiling/linking options.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2017 10:48:23 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2017-06-23T10:48:23Z</dc:date>
    <item>
      <title>syrk mkl armadillo wrong output</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/syrk-mkl-armadillo-wrong-output/m-p/1133918#M25836</link>
      <description>&lt;P&gt;I have written the following simple program for syrk using armadillo (arma.sourceforge.net).&lt;/P&gt;

&lt;P&gt;Environment : Rhea from OLCF.&amp;nbsp;https://www.olcf.ornl.gov/computing-resources/rhea/&lt;/P&gt;

&lt;P&gt;MKL : Tried with version 16 and 17. Problem occurs in both.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#define ARMA_DONT_USE_WRAPPER
#define ARMA_USE_BLAS

#include &amp;lt;iostream&amp;gt;
#include &amp;lt;armadillo&amp;gt;
using namespace std;
using namespace arma;
int main() {
  int m = 10000;
  int n = 50; 
  fmat A;
  A.load("H_init.csv");
  cout &amp;lt;&amp;lt; "A::" &amp;lt;&amp;lt; A.n_rows &amp;lt;&amp;lt; "x" &amp;lt;&amp;lt; A.n_cols &amp;lt;&amp;lt; endl;
  fmat AtA = arma::zeros&amp;lt;fmat&amp;gt;(n, n); 
  AtA = A.t() * A;
  cout &amp;lt;&amp;lt; "AtA " &amp;lt;&amp;lt; endl;
  cout &amp;lt;&amp;lt; max(max(AtA)) &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; min(min(AtA)) &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; norm(AtA, "fro") &amp;lt;&amp;lt; endl;
  return 0;
}

&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;I have also attached the H_init.csv along with this email. I compile using the following three procedure.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Compilation 1 (gcc with mkl): Based on the article&amp;nbsp;https://software.intel.com/en-us/articles/a-new-linking-model-single-dynamic-library-mkl_rt-since-intel-mkl-103. I compile as&lt;SPAN style="font-variant-ligatures: no-common-ligatures; color: rgb(83, 48, 225); font-family: Menlo; font-size: 14px;"&gt;&amp;nbsp;"&lt;/SPAN&gt;g++ hth.cpp -o hth -O2 -I ~/armadillo-7.800.1/include/ -fopenmp -lmkl_rt"&lt;/P&gt;

&lt;P&gt;Compilation 2 (with icc and mkl): icc hth.cpp -o hth -O2 -I ~/armadillo-7.800.1/include/ -fopenmp -mkl&lt;/P&gt;

&lt;P&gt;Compilation 3 (gcc with intel linker recommendation):&amp;nbsp;g++ hth.cpp -o hth -O2 -I ~/armadillo-7.800.1/include/ -fopenmp -lmkl_rt &amp;nbsp;-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl&lt;/P&gt;

&lt;P&gt;Compilation based on method compilation 1 is producing wrong output on HtH. Compilation 2 and 3 works fine. Infact in the case of compilation 3, even the ordering of the libraries appears important. If the ordering is change a bit, it is producing wrong output.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Output of compile 1: (Wrong)&lt;/P&gt;

&lt;P&gt;
	&lt;STYLE type="text/css"&gt;p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo}
span.s1 {font-variant-ligatures: no-common-ligatures}
	&lt;/STYLE&gt;
&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;A::10000x50&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;AtA&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;24044.6 3697.91 350951&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Output out of compile 2: (Right)
	&lt;STYLE type="text/css"&gt;p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo}
span.s1 {font-variant-ligatures: no-common-ligatures}
	&lt;/STYLE&gt;
&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;A::10000x50&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;AtA&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;3436.05 2437.46 126222&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P class="p1"&gt;Output out of compile 3: (Right)&lt;/P&gt;

&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P class="p1"&gt;
	&lt;STYLE type="text/css"&gt;p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo}
span.s1 {font-variant-ligatures: no-common-ligatures}
	&lt;/STYLE&gt;
&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;A::10000x50&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;AtA&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;3436.05 2437.46 126222&lt;/SPAN&gt;&lt;/P&gt;

&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Am I making any mistake on this? Can't I link w/ gcc using -lmkl_rt?&lt;/P&gt;
&lt;STYLE type="text/css"&gt;p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #5330e1}
span.s1 {font-variant-ligatures: no-common-ligatures}
&lt;/STYLE&gt;</description>
      <pubDate>Thu, 22 Jun 2017 21:48:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/syrk-mkl-armadillo-wrong-output/m-p/1133918#M25836</guid>
      <dc:creator>Ramakrishnan_K_</dc:creator>
      <dc:date>2017-06-22T21:48:36Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt; Can't I link w/ gcc using</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/syrk-mkl-armadillo-wrong-output/m-p/1133919#M25837</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;SPAN style="font-size: 12px;"&gt;Can't I link w/ gcc using -lmkl_rt?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;this is valid option to link with MKL. &amp;nbsp;This looks like some problem with armadillio package. &amp;nbsp;You may try to call mkl's syrk directly and play with different compiling/linking options.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 10:48:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/syrk-mkl-armadillo-wrong-output/m-p/1133919#M25837</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2017-06-23T10:48:23Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/syrk-mkl-armadillo-wrong-output/m-p/1133920#M25838</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I changed my code to directly call syrk. With the new change, compilation 1, intermittently works fine and compilation 3 is always right. Attached is the source code for reference.&lt;/P&gt;

&lt;P&gt;Incorrect Output and compile 1:g++ hthexp.cpp -o hthexp -O2 -I ~/armadillo-7.800.1/include/ -fopenmp -lmkl_rt&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;[seswar@rhea-login1g ~/scratch]$ ./hthexp&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;AtA&amp;nbsp;&lt;BR /&gt;
	6716.41 4864.58&lt;/P&gt;

&lt;P&gt;Correct output compile 3 :&amp;nbsp;g++ hthexp.cpp -o hthexp -O2 -I ~/armadillo-7.800.1/include/ -fopenmp -lmkl_rt &amp;nbsp;-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl&lt;/P&gt;

&lt;P&gt;[seswar@rhea-login1g ~/scratch]$ ./hthexp&amp;nbsp;&lt;BR /&gt;
	AtA&amp;nbsp;&lt;BR /&gt;
	3381.87 2457.73&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 19:05:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/syrk-mkl-armadillo-wrong-output/m-p/1133920#M25838</guid>
      <dc:creator>Ramakrishnan_K_</dc:creator>
      <dc:date>2017-06-23T19:05:45Z</dc:date>
    </item>
  </channel>
</rss>

