<?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 I didn't quite understand the in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157418#M27670</link>
    <description>&lt;P style="font-size: 13.008px;"&gt;I didn't quite understand the reply, sorry.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;I tried compiling the code using g++ with the -fopenmp option (with the appropriate installation of Armadillo) and it seemed to work&amp;nbsp; setting MKL_NUM_THREADS to 2. But the same error happened again with 4.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;I can do that. How do you want me to send it? Do you need any other information on the MKL and armadillo configuration?&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;--&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Maxime&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jul 2018 15:18:00 GMT</pubDate>
    <dc:creator>Garnier__Maxime</dc:creator>
    <dc:date>2018-07-18T15:18:00Z</dc:date>
    <item>
      <title>Using Intel MKL with Armadillo: segmentation fault</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157409#M27661</link>
      <description>&lt;P&gt;I have been searching for a while now and nothing allowed me to solve my problem.&lt;/P&gt;

&lt;P&gt;I installed the Intel MKL libraries on my Ubuntu 18.04 machine and it is correctly linked to Numpy and Scipy. Now, I wanted to do the same thing using Armadillo in the C++ language. I installed it using the readme.txt instructions provided by the Armadillo project (using `cmake`). I checked that it correctly detected the presence of MKL and it did.&lt;BR /&gt;
	Now I want to check that it works well so I just build a matrix and diagonalize it using the following code&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;    #include &amp;lt;iostream&amp;gt;
    #include &amp;lt;armadillo&amp;gt;

    using namespace std;
    using namespace arma;

    int main()
      {
        wall_clock timer;
        int dim = 100;

        cx_mat C = randu&amp;lt;cx_mat&amp;gt;(dim,dim);
        cx_mat D = C.t()*C;

        vec eigval2;
        cx_mat eigvec2;

        timer.tic(); // Initialize clock

        eig_sym(eigval2, eigvec2, D);
    
        double n = timer.toc();

        cout &amp;lt;&amp;lt; "Elapsed time: " &amp;lt;&amp;lt; n &amp;lt;&amp;lt; " seconds" &amp;lt;&amp;lt; endl;
        cout &amp;lt;&amp;lt; eigval2 &amp;lt;&amp;lt; endl;

      return 0;
      }&lt;/PRE&gt;

&lt;P&gt;which is very basic. The problem is that when I try to run it with a matrix dimension of 500. I get a segmentation error (core dumped) and nothing else. I don't know if this has to do with the linking to MKL or just the Armadillo install. Notice that I don't know how Armadillo "knows" that I want to compile and run using MKL since I also have openBLAS, Lapack and BLAS installed since I just use&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt; `g++ example.cpp -o example -O2 -larmadillo &amp;amp;&amp;amp; ./example`.&lt;/PRE&gt;

&lt;P&gt;I also tried commenting the `#define ARMA_USE_LAPACK` and `#define ARMA_USE_BLAS` in the "include/armadillo_bits/config.hpp" file and rebuilding everything but nothing has changed.&lt;/P&gt;

&lt;P&gt;I see a lot of answers pointing to a linking problem with MKL and redirecting to the Intel Link Line Advisor but I have no clue what half of the parameters are nor where I have to implement the necessary changes.&lt;/P&gt;

&lt;P&gt;I would appreciate any hints/advice/references to solve that problem.&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 11:17:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157409#M27661</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-17T11:17:24Z</dc:date>
    </item>
    <item>
      <title>Maxime, could you please try</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157410#M27662</link>
      <description>&lt;P&gt;Maxime, could you please try to set environment variable MKL_VERBOSE( export MKL_VERBOSE=1) and run your executable again. If MKL eigen routine has been called, you will see this info into output log file.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 12:36:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157410#M27662</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2018-07-17T12:36:41Z</dc:date>
    </item>
    <item>
      <title>Thanks for the quick answer.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157411#M27663</link>
      <description>&lt;P&gt;Thanks for the quick answer. Doing that yields&lt;/P&gt;

&lt;PRE class="brush:bash; class-name:dark;"&gt;MKL_VERBOSE Intel(R) MKL 2018.0 Update 3 Product build 20180406 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) enabled processors, Lnx 1.70GHz lp64 intel_thread
MKL_VERBOSE ZHERK(U,C,500,500,0x7fffb6753810,0x7f3d148b3040,500,0x7fffb6753820,0x7f3d124e2040,500) 158.61ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:16
&lt;/PRE&gt;

&lt;P&gt;which I guess means nothing happened on the MKL side.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 12:39:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157411#M27663</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-17T12:39:19Z</dc:date>
    </item>
    <item>
      <title>yes I think so. If mkl prints</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157412#M27664</link>
      <description>&lt;P&gt;yes I think so. If mkl prints this output, that means the problem happen later....&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 09:21:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157412#M27664</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2018-07-18T09:21:30Z</dc:date>
    </item>
    <item>
      <title>You think that MKL has not</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157413#M27665</link>
      <description>&lt;P&gt;You think that MKL has not even been called by the program or that it has been correctly called and no problem was detected?&lt;/P&gt;

&lt;P&gt;Do you have a clue of how to diagnose and cure this? Maybe do the linking manually? I have seen people change one of their makefiles. But I don't know how to do that precisely.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 09:53:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157413#M27665</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-18T09:53:29Z</dc:date>
    </item>
    <item>
      <title>A short update: for smaller</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157414#M27666</link>
      <description>&lt;P&gt;A short update: for smaller matrices, there is not segmentation fault and everything works correctly. MKL says&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:bash; class-name:dark;"&gt;MKL_VERBOSE Intel(R) MKL 2018.0 Update 3 Product build 20180406 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) enabled processors, Lnx 1.70GHz lp64 intel_thread
MKL_VERBOSE ZHERK(U,C,100,100,0x7ffc12cb6cf0,0x7fd9aad66040,100,0x7ffc12cb6d00,0x7fd9aad3e040,100) 22.54ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:16
MKL_VERBOSE ZHEEVD(V,U,100,0x7fd9aacc6040,100,0x55e38ede2e60,0x7fd9aac76040,20400,0x7fd9aac25040,41002,0x55e38ede31c0,1509,0) 57.25ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:16
&lt;/PRE&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 11:19:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157414#M27666</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-18T11:19:43Z</dc:date>
    </item>
    <item>
      <title>ok, then could you please try</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157415#M27667</link>
      <description>&lt;P&gt;ok, then could you please try to make the sequential call!&amp;nbsp; &amp;nbsp;export MKL_NUM_THREADS=1 and check how this code would work on your side.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 14:46:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157415#M27667</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2018-07-18T14:46:00Z</dc:date>
    </item>
    <item>
      <title>Thanks for your answer.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157416#M27668</link>
      <description>&lt;P&gt;Thanks for your answer.&lt;/P&gt;

&lt;P&gt;Doing this solves the problem indeed. Should I then be using some OpenMP option to allow the use of all threads?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 14:52:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157416#M27668</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-18T14:52:16Z</dc:date>
    </item>
    <item>
      <title>1) this will affect only on</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157417#M27669</link>
      <description>&lt;P&gt;1) this will affect only on mkl functions only: all mkl's functons would execute in 1 thread.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;2) In the case of C/C++ code, as a temporarily work around the problem&amp;nbsp; you may&amp;nbsp; make&lt;/P&gt;

&lt;P&gt;mkl_set_num_threads(1);&lt;/P&gt;

&lt;P&gt;zheevd(...)&lt;/P&gt;

&lt;P&gt;mkl_set_num_threads( number of threads you used before the first call of mkl_set_num_threads);&lt;/P&gt;

&lt;P&gt;3) but nevertheless, these symptoms indicate some problem with ?heev but we don't know about some problem with this function in MKL 2018 u3. If that possible, you may try to create C or C++ based reproducer and share with us. We will take&amp;nbsp; look.&lt;/P&gt;

&lt;P&gt;--Gennady&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 15:14:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157417#M27669</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2018-07-18T15:14:34Z</dc:date>
    </item>
    <item>
      <title>I didn't quite understand the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157418#M27670</link>
      <description>&lt;P style="font-size: 13.008px;"&gt;I didn't quite understand the reply, sorry.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;I tried compiling the code using g++ with the -fopenmp option (with the appropriate installation of Armadillo) and it seemed to work&amp;nbsp; setting MKL_NUM_THREADS to 2. But the same error happened again with 4.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;I can do that. How do you want me to send it? Do you need any other information on the MKL and armadillo configuration?&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;--&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Maxime&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 15:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157418#M27670</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-18T15:18:00Z</dc:date>
    </item>
    <item>
      <title>it seems zgeev seq faulted in</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157419#M27671</link>
      <description>&lt;P&gt;it seems zgeev seq faulted in the case of many threads (&amp;gt; 1) and problem sizes ~500. We don't see similar problem on our side. how could we check your case?&amp;nbsp; We need to have C or Fortran code which we may compile and execute on our side to check if the problem exists on our side too.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 03:13:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157419#M27671</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2018-07-19T03:13:27Z</dc:date>
    </item>
    <item>
      <title>The C++ code I use is the one</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157420#M27672</link>
      <description>&lt;P&gt;The C++ code I use is the one I attached to my original post. There is also the compilation step.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 08:38:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157420#M27672</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-19T08:38:03Z</dc:date>
    </item>
    <item>
      <title>the original post contains</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157421#M27673</link>
      <description>&lt;P&gt;the original post contains Armalinio calls which we couldn't manage. we need to have the code without this library calls, just pure C/C++ code.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 04:18:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157421#M27673</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2018-07-20T04:18:33Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157422#M27674</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; -webkit-text-size-adjust: 100%;"&gt;Ok but I have no clue of how to do that. Sorry but how will we detect problems if armadillo is not called?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 05:55:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-Armadillo-segmentation-fault/m-p/1157422#M27674</guid>
      <dc:creator>Garnier__Maxime</dc:creator>
      <dc:date>2018-07-20T05:55:40Z</dc:date>
    </item>
  </channel>
</rss>

