<?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 Jacob, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Wrong-results-from-cblas-sgemm/m-p/1099960#M23813</link>
    <description>&lt;P&gt;Hi Jacob,&lt;/P&gt;

&lt;P&gt;There was a known {S,D}GEMM issue (beta=0 on Intel AVX2) in MKL 11.3&amp;nbsp;that was fixed in MKL 11.3.1. Please see MKL 11.3.1 release notes here for more details on the issue: &lt;A href="https://software.intel.com/en-us/articles/intel-mkl-113-release-notes"&gt;https://software.intel.com/en-us/articles/intel-mkl-113-release-notes&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I verified that your tester fails with MKL 11.3, and switching to MKL 11.3.1 gives correct results.&lt;/P&gt;

&lt;P&gt;If you are using MKL 11.3.0 version, could you update your MKL version and run your tester again? You can check your MKL version by setting:&lt;/P&gt;

&lt;P&gt;export MKL_VERBOSE=1&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Efe&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2016 00:43:00 GMT</pubDate>
    <dc:creator>Murat_G_Intel</dc:creator>
    <dc:date>2016-08-17T00:43:00Z</dc:date>
    <item>
      <title>Wrong results from cblas_sgemm</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Wrong-results-from-cblas-sgemm/m-p/1099959#M23812</link>
      <description>&lt;P&gt;Here is the code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;float max_val(const float * vec, size_t sz)
{
    
    float result = 0.0f;
    for (size_t i = 0; i &amp;lt; sz; ++i)
    {
        float val = abs(vec&lt;I&gt;);
        if (val &amp;gt; result)
            result = val;
    }
    
    return result;
    
}

int main()
{
    const int M = 64;
    const int N = 50176;
    const int K = 576;
    const float alpha = 1.0;
    const float beta = 0.0;


    float *A, *B, *C;
    A = (float *)mkl_malloc( M*K*sizeof( float ), 32 );
    B = (float *)mkl_malloc( K*N*sizeof( float ), 32 );
    C = (float *)mkl_malloc( M*N*sizeof( float ), 32 );
    
    for (size_t i = 0; i &amp;lt; M*K; ++i)
        A&lt;I&gt; = 1.0;
    for (size_t i = 0; i &amp;lt; K*N; ++i)
        B&lt;I&gt; = 2.0;
    for (size_t i = 0; i &amp;lt; M*N; ++i)
        C&lt;I&gt; = 1.0;

    cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, M, N, K, alpha, A, K, B,
       N, beta, C, N);
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;PRE class="brush:cpp;" style="font-size: 13.008px; line-height: 19.512px;"&gt;    printf("%f\n", max_val(C,M*N));&lt;/PRE&gt;

&lt;PRE class="brush:cpp;"&gt;    mkl_free(A);
    mkl_free(B);
    mkl_free(C);

}&lt;/PRE&gt;

&lt;P&gt;Compile:&lt;/P&gt;

&lt;P&gt;icc -I/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/include -L/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64_lin test.cpp -o test_cblas -lmkl_rt&lt;/P&gt;

&lt;P&gt;The array C should end up being all values of 1152. However, when I run this, I get an output of 1153.&lt;/P&gt;

&lt;P&gt;Upon looking closer, it turns out that most of the values in C are 1152 except for a bunch of contiguous chunks that are 1153, or more generally, 1152+(initial_value_of_C_array).&lt;/P&gt;

&lt;P&gt;If I do this instead with CblasColMajor (and change the stride values accordingly), everything works fine.&lt;/P&gt;

&lt;P&gt;What is going on??&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 23:58:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Wrong-results-from-cblas-sgemm/m-p/1099959#M23812</guid>
      <dc:creator>Jacob_R_</dc:creator>
      <dc:date>2016-08-16T23:58:18Z</dc:date>
    </item>
    <item>
      <title>Hi Jacob,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Wrong-results-from-cblas-sgemm/m-p/1099960#M23813</link>
      <description>&lt;P&gt;Hi Jacob,&lt;/P&gt;

&lt;P&gt;There was a known {S,D}GEMM issue (beta=0 on Intel AVX2) in MKL 11.3&amp;nbsp;that was fixed in MKL 11.3.1. Please see MKL 11.3.1 release notes here for more details on the issue: &lt;A href="https://software.intel.com/en-us/articles/intel-mkl-113-release-notes"&gt;https://software.intel.com/en-us/articles/intel-mkl-113-release-notes&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I verified that your tester fails with MKL 11.3, and switching to MKL 11.3.1 gives correct results.&lt;/P&gt;

&lt;P&gt;If you are using MKL 11.3.0 version, could you update your MKL version and run your tester again? You can check your MKL version by setting:&lt;/P&gt;

&lt;P&gt;export MKL_VERBOSE=1&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Efe&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 00:43:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Wrong-results-from-cblas-sgemm/m-p/1099960#M23813</guid>
      <dc:creator>Murat_G_Intel</dc:creator>
      <dc:date>2016-08-17T00:43:00Z</dc:date>
    </item>
  </channel>
</rss>

