<?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: Problems with ifort: GEMM matrix multiplication in BLAS in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754546#M10033</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/421622"&gt;kevinkarin&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;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Currently, my program only achieved 5Gflop/s on an ATI GPU which has 2Tflop/s in theory. I will fail the course if I cannot achieve a decent result in two weeks. =( I have to find out what is the problem with the GEMM running on GPUs.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;But then why are you using MKL? Shouldnt you be using ACML-GPU.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://developer.amd.com/gpu/acmlgpu/Pages/default.aspx"&gt;http://developer.amd.com/gpu/acmlgpu/Pages/default.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or did I miss something?&lt;BR /&gt;</description>
    <pubDate>Mon, 06 Apr 2009 15:54:37 GMT</pubDate>
    <dc:creator>Tabrez_Ali</dc:creator>
    <dc:date>2009-04-06T15:54:37Z</dc:date>
    <item>
      <title>Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754540#M10027</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;In the subroutine sgemm in BLAS,&lt;BR /&gt;&lt;BR /&gt;sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)&lt;BR /&gt;&lt;BR /&gt;What is ``transa'' and ``transb''?&lt;BR /&gt;&lt;BR /&gt;It says&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;transa    CHARACTER*1. Specifies the form of op(A) used in the matrix&lt;BR /&gt; multiplication:&lt;BR /&gt;&lt;BR /&gt; if transa = 'N' or 'n', then op(A) = A;&lt;BR /&gt;&lt;BR /&gt; if transa = 'T' or 't', then op(A) = A';&lt;BR /&gt;&lt;BR /&gt; if transa = 'C' or 'c', then op(A) = conjg(A').&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;I didn't understand this.&lt;BR /&gt;&lt;BR /&gt;I wrote a program to test sgemm:&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;[cpp]c matrix multiplication c=a*b&lt;BR /&gt;c using sgemm(transa, transb, m, n, k,&lt;BR /&gt;c           alpha, a, lda, b, ldb, beta, c, ldc)&lt;BR /&gt;&lt;BR /&gt;      program bar&lt;BR /&gt;      real a(3,2),b(2,3),c(3,3)&lt;BR /&gt;&lt;BR /&gt;      data a / 1,2,3,4,5,6 /&lt;BR /&gt;      data b / 7,8,9,10,11,12 /&lt;BR /&gt;&lt;BR /&gt;      write(*,*) a(1,1), a(1,2)&lt;BR /&gt;      write(*,*) a(2,1), a(2,2)&lt;BR /&gt;      write(*,*) a(3,1), a(3,2)&lt;BR /&gt;      write(*,*) '-------------------------------------'&lt;BR /&gt;      write(*,*) b(1,1), b(1,2), b(1,3)&lt;BR /&gt;      write(*,*) b(2,1), b(2,2), b(2,3)&lt;BR /&gt;      write(*,*) '-------------------------------------'&lt;BR /&gt;&lt;BR /&gt;      call sgemm('N','N',3,3,2,1,a,3,b,2,1,c,3)&lt;BR /&gt;&lt;BR /&gt;      write(*,*) c(1,1), c(1,2), c(1,3)&lt;BR /&gt;      write(*,*) c(2,1), c(2,2), c(2,3)&lt;BR /&gt;      write(*,*) c(3,1), c(3,2), c(3,3)&lt;BR /&gt;&lt;BR /&gt;      stop&lt;BR /&gt;      end&lt;BR /&gt;[/cpp]&lt;/PRE&gt;
&lt;BR /&gt;and the result is weird, c!=a*b at all, instead, c=0:&lt;BR /&gt;&lt;BR /&gt;$  ifort data.f -lmkl -lguide -liomp5 -lpthread&lt;BR /&gt;&lt;BR /&gt;$ ./a.out&lt;BR /&gt; 1.000000       4.000000&lt;BR /&gt; 2.000000       5.000000&lt;BR /&gt; 3.000000       6.000000&lt;BR /&gt; -------------------------------------&lt;BR /&gt; 7.000000       9.000000       11.00000&lt;BR /&gt; 8.000000       10.00000       12.00000&lt;BR /&gt; -------------------------------------&lt;BR /&gt; 0.0000000E+00  0.0000000E+00  0.0000000E+00&lt;BR /&gt; 0.0000000E+00  0.0000000E+00  0.0000000E+00&lt;BR /&gt; 0.0000000E+00  0.0000000E+00  0.0000000E+00&lt;BR /&gt;&lt;BR /&gt;I am quite sure it's because of my misuse of gemm, but I don't know where my&lt;BR /&gt;mistake is.&lt;BR /&gt;&lt;BR /&gt;Any suggestion?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Sun, 05 Apr 2009 15:59:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754540#M10027</guid>
      <dc:creator>kevinkarin</dc:creator>
      <dc:date>2009-04-05T15:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754541#M10028</link>
      <description>&lt;DIV style="margin: 0px; height: auto;"&gt;&lt;/DIV&gt;
&lt;BR /&gt; program main&lt;BR /&gt; !use mkl95_blas&lt;BR /&gt; real :: a(3,2), b(2,3), c(3,3)&lt;BR /&gt; &lt;BR /&gt; a=reshape((/ 1.00, 2.00, 3.00, 4.00, 5.00, 6.00 /), shape=(/3,2/))&lt;BR /&gt; b=reshape((/ 7.00, 8.00, 9.00, 10.0, 11.0, 12.0 /), shape=(/2,3/))&lt;BR /&gt; &lt;BR /&gt; !call gemm(a,b,c)&lt;BR /&gt; call sgemm('N','N',3,3,2,1.0,a,3,b,2,1.0,c,3)&lt;BR /&gt; print'(3F10.3)', c&lt;BR /&gt; end&lt;BR /&gt;&lt;BR /&gt;stali@dell-4300:~$ ./a.out &lt;BR /&gt; 39.000 54.000 69.000&lt;BR /&gt; 49.000 68.000 87.000&lt;BR /&gt; 59.000 82.000 105.000&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Apr 2009 00:38:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754541#M10028</guid>
      <dc:creator>Tabrez_Ali</dc:creator>
      <dc:date>2009-04-06T00:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754542#M10029</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/239104"&gt;Tabrez Ali&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; &lt;BR /&gt; call sgemm('N','N',3,3,2,1.0,a,3,b,2,1.0,c,3)&lt;BR /&gt; &lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
Thanks!&lt;BR /&gt;&lt;BR /&gt;I changed ``1'' on the alpha and beta position of sgemm to ``1.0'' and it works immediately.&lt;BR /&gt;&lt;BR /&gt;This is so weird. Shouldn't Fortran realize automatically that my ``1'' is a real ``1.0''?&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Apr 2009 00:55:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754542#M10029</guid>
      <dc:creator>kevinkarin</dc:creator>
      <dc:date>2009-04-06T00:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754543#M10030</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/421622"&gt;kevinkarin&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;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
I changed ``1'' on the alpha and beta position of sgemm to ``1.0'' and it works immediately.&lt;BR /&gt;&lt;BR /&gt;This is so weird. Shouldn't Fortran realize automatically that my ``1'' is a real ``1.0''?&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
No, in the absence of an interface block, such as you would get from the MKL include file, Fortran has to assume that 1 corresponds with a default integer. With the interface block, it would throw an error, but at least you know then where the problem is. If you write in the style of 20 years ago, you take on the corresponding responsibility.&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Apr 2009 04:26:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754543#M10030</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2009-04-06T04:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754544#M10031</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/367365"&gt;tim18&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; No, in the absence of an interface block, such as you would get from the MKL include file, Fortran has to assume that 1 corresponds with a default integer. With the interface block, it would throw an error, but at least you know then where the problem is. If you write in the style of 20 years ago, you take on the corresponding responsibility.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;I'm sorry. I've learned Fortran for only 3 days.&lt;BR /&gt;&lt;BR /&gt;I am working on a course project dealing with scientific computing on GPUs. I am not familiar with matrix computation at all, so I bought a very old book called ``Matrix Computation'' by Gene Golub. Then I found out that the time is so limited, so I skip that book and tried to use BLAS and LAPACK.&lt;BR /&gt;&lt;BR /&gt;Currently, my program only achieved 5Gflop/s on an ATI GPU which has 2Tflop/s in theory. I will fail the course if I cannot achieve a decent result in two weeks. =( I have to find out what is the problem with the GEMM running on GPUs.&lt;BR /&gt;&lt;BR /&gt;The only book I have about Fortran and LAPCK is ``LINPACK Users' Guide'' by J.J Dongarra,Published by SIAM, 1979. That's why I am writing Fortran in the old style. Is there any better book about Fortran and algorithms in LAPACK? Or any material that maybe helpful&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Apr 2009 08:45:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754544#M10031</guid>
      <dc:creator>kevinkarin</dc:creator>
      <dc:date>2009-04-06T08:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754545#M10032</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Surely, for a result to be expected in 2 weeks, your course material must give some guidance. If you are using a canned BLAS, you take what you get, and maybe do some preliminary research into why it doesn't match the advertisements. Those references are excellent, but the subject you raise is far off topic from the references and this forum.&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Apr 2009 12:57:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754545#M10032</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2009-04-06T12:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754546#M10033</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/421622"&gt;kevinkarin&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;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Currently, my program only achieved 5Gflop/s on an ATI GPU which has 2Tflop/s in theory. I will fail the course if I cannot achieve a decent result in two weeks. =( I have to find out what is the problem with the GEMM running on GPUs.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;But then why are you using MKL? Shouldnt you be using ACML-GPU.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://developer.amd.com/gpu/acmlgpu/Pages/default.aspx"&gt;http://developer.amd.com/gpu/acmlgpu/Pages/default.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or did I miss something?&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Apr 2009 15:54:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754546#M10033</guid>
      <dc:creator>Tabrez_Ali</dc:creator>
      <dc:date>2009-04-06T15:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754547#M10034</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/239104"&gt;Tabrez Ali&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;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;But then why are you using MKL? Shouldnt you be using ACML-GPU.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://developer.amd.com/gpu/acmlgpu/Pages/default.aspx"&gt;http://developer.amd.com/gpu/acmlgpu/Pages/default.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or did I miss something?&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Yes, thanks for the URL. I was learning fortran on my laptop with mkl so I used mkl instead to get familiar with LAPACK and BLAS.&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Apr 2009 06:46:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754547#M10034</guid>
      <dc:creator>kevinkarin</dc:creator>
      <dc:date>2009-04-09T06:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with ifort: GEMM matrix multiplication in BLAS</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754548#M10035</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/367365"&gt;tim18&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; Surely, for a result to be expected in 2 weeks, your course material must give some guidance. If you are using a canned BLAS, you take what you get, and maybe do some preliminary research into why it doesn't match the advertisements. Those references are excellent, but the subject you raise is far off topic from the references and this forum.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Thanks for the information. This project is expected to be implemented independently by oneself from scratch. My only guidance is Google. Anyway I will try my best.&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Apr 2009 06:52:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problems-with-ifort-GEMM-matrix-multiplication-in-BLAS/m-p/754548#M10035</guid>
      <dc:creator>kevinkarin</dc:creator>
      <dc:date>2009-04-09T06:52:56Z</dc:date>
    </item>
  </channel>
</rss>

