<?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 Hi Adam, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100306#M23838</link>
    <description>&lt;P&gt;Hi Adam,&lt;/P&gt;

&lt;P&gt;Thank you for reporting the issue. I reproduced DGELSD low performance.&lt;/P&gt;

&lt;P&gt;Let our team look in more details what we can do. We will keep you updated on any progress.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Konstantin&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2016 10:18:20 GMT</pubDate>
    <dc:creator>Konstantin_A_Intel</dc:creator>
    <dc:date>2016-10-06T10:18:20Z</dc:date>
    <item>
      <title>MKL lapack slow on Xeon Phi KNL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100303#M23835</link>
      <description>&lt;P style="font-size: 13.008px;"&gt;I'm running a Xeon Phi Knights Landing (64 core) and an Intel&amp;nbsp;i7-6900K side by side for speed comparisons. &amp;nbsp;I'm in Python3, with latest Numpy (1.11.1) linked with all the latest MKL (11.3.3) libraries on both (via Anaconda installation).&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;The operation in question is a call to numpy.linalg.lstsq, which in turn calls lapack. &amp;nbsp;With MKL_NUM_THREADS=1, and vector dimension ranging from 100 to 1,000, I observe about 5x faster performance by the i7. &amp;nbsp;Increasing the number of threads scales better on the i7. &amp;nbsp;Without setting MKL_NUM_THREADS, the difference can be about 8x in favor of the i7.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;This is surprising to me, since I have done speed tests of matrix multiply (using Theano's check_blas.py), in which performance is either roughly comparable or even favorable to the KNL, on a per core basis, and can be 10x in favor of KNL with no thread limit.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;I'm not fully knowledgeable on least squares solving routines, but t&lt;SPAN style="font-size: 13.008px;"&gt;he majority&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;(4/5)&amp;nbsp;of counts during the lstsq routine do report using vectorization &amp;nbsp;(using perf stat -e r20C2,r40C2 ...). &amp;nbsp;&lt;/SPAN&gt;Maybe it's not really utilizing the full register width (8 double precision) most of the time? &amp;nbsp;Could this alone explain the difference? &amp;nbsp;Of course, the matrix multiply reports an overwhelming majority of operations being vectorized.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Is there any hope of improvement? &amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Happy to provide more numbers or test scripts.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Thanks,&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Adam&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 06:20:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100303#M23835</guid>
      <dc:creator>Adam_S_5</dc:creator>
      <dc:date>2016-10-04T06:20:53Z</dc:date>
    </item>
    <item>
      <title>Adam, it seems that some of</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100304#M23836</link>
      <description>&lt;P&gt;Adam, it seems that some of LLS routines ( i am not sure which of them are called from numpy&amp;nbsp;lstsq ) are not well optimized for KNL for these problem sizes. When do you increase the problem size, what perf gap do you see?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 12:14:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100304#M23836</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2016-10-05T12:14:07Z</dc:date>
    </item>
    <item>
      <title>Hi Gennady,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100305#M23837</link>
      <description>&lt;P&gt;Hi Gennady,&lt;/P&gt;

&lt;P&gt;&amp;nbsp; Thanks for writing. &amp;nbsp;I've run with some larger problem sizes, and I've dug a little deeper to see which routines are being called.&lt;/P&gt;

&lt;P&gt;Timing results for problem sizes 1,000, 2,000, and 3,000 are attached. &amp;nbsp;Generally seeing a 2x-5x advantage to the i7 across the board. &amp;nbsp;The timing script is also attached (as a "lstsq_speed.txt", although really it's a ".py" extension, which this website does not accept). &amp;nbsp;Note this is using a positive definite matrix, as in my original problem, not sure if this is relevant.&lt;/P&gt;

&lt;P&gt;For context, in my original problem, I had a vector size 756 being solved. &amp;nbsp;On the i7, this solves in about 0.2 s each time, but on the KNL it takes about 1.0 s (using one core on either). &amp;nbsp;It's enough to turn it into a significant performance factor in this particular problem.&lt;/P&gt;

&lt;P&gt;The &lt;A href="https://github.com/numpy/numpy/blob/v1.11.0/numpy/linalg/linalg.py#L1785-L1943"&gt;Numpy lstsq function&lt;/A&gt; calls the lapack routine dgelsd. &amp;nbsp;When I run using "perf record python lstsq_speed.py -t 1", then observe "perf report", it appears that the majority of time is spent in libmkl_avx2.so on the i7 and correspondingly libmkl_avx512_mic.so on the KNL. &amp;nbsp;Most of the time is split between dgemv and dgemm, which annotating shows spend most of their time manipulating ymm (on i7) and zmm (on KNL) registers, as expected. &amp;nbsp;A smaller amount of time is spent in lapack: mkl_lapack_ps_avx[2/512_mic]_dlasd4 from libmkl_avx[2/512_mic].so and both mkl_lapack_dlals0 and mkl_lapack_dlasd8 from libmkl_core.so, all of which operate on xmm registers in both machines. &amp;nbsp;The percent of time spent in these altogether is about 8% on i7 and 24% on KNL, which makes sense due to clock rate. &amp;nbsp;Maybe I'm not capturing or analyzing correctly, but it doesn't seem like vectorization alone explains it.&lt;/P&gt;

&lt;P&gt;Any chance this can be addressed and KNL brought up to speed?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Adam&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 02:34:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100305#M23837</guid>
      <dc:creator>Adam_S_5</dc:creator>
      <dc:date>2016-10-06T02:34:00Z</dc:date>
    </item>
    <item>
      <title>Hi Adam,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100306#M23838</link>
      <description>&lt;P&gt;Hi Adam,&lt;/P&gt;

&lt;P&gt;Thank you for reporting the issue. I reproduced DGELSD low performance.&lt;/P&gt;

&lt;P&gt;Let our team look in more details what we can do. We will keep you updated on any progress.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Konstantin&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 10:18:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-lapack-slow-on-Xeon-Phi-KNL/m-p/1100306#M23838</guid>
      <dc:creator>Konstantin_A_Intel</dc:creator>
      <dc:date>2016-10-06T10:18:20Z</dc:date>
    </item>
  </channel>
</rss>

