<?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 DGEMM is not working in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/DGEMM-is-not-working/m-p/807650#M3530</link>
    <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;I amd trying to use DGEMM subroutine from BLAS to multiply two large matrices.&lt;BR /&gt;However my test code is not working. What am I doing wrong? Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;The code:&lt;BR /&gt;program test_blas&lt;BR /&gt;use mkl95_precision, only: wp =&amp;gt; dp ! in program head&lt;BR /&gt;USE mkl95_LAPACK, ONLY: GETRF, GETRI, SYTRF, SYTRI, POTRF, POTRI&lt;BR /&gt;USE mkl95_BLAS, ONLY: GEMM&lt;BR /&gt;&lt;BR /&gt;!implicit none&lt;BR /&gt;integer :: i, j, k, l, m, n, lda, ldb, ldc&lt;BR /&gt;real(8), DIMENSION(:,:), ALLOCATABLE :: A, B, C, S&lt;BR /&gt;character(len = 1) :: transa, transb&lt;BR /&gt;real(8)::alfa,beta&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;transa = 'N'; transb = 'N'&lt;BR /&gt;m = 2&lt;BR /&gt;n = 2&lt;BR /&gt;k = 2&lt;BR /&gt;alfa=1.d0; beta=1.d0&lt;BR /&gt;&lt;BR /&gt;if ((transa.eq.'N').or.(transa.eq.'n')) then&lt;BR /&gt; lda = m&lt;BR /&gt; allocate(a(m, k))&lt;BR /&gt; else&lt;BR /&gt; lda = k&lt;BR /&gt; allocate(a(k, m))&lt;BR /&gt; end if&lt;BR /&gt; if ((transb.eq.'N').or.(transb.eq.'n')) then&lt;BR /&gt; ldb = k&lt;BR /&gt; allocate(b(k, n))&lt;BR /&gt; else&lt;BR /&gt; ldb = n&lt;BR /&gt; allocate(b(n, k))&lt;BR /&gt; end if&lt;BR /&gt; ldc = m&lt;BR /&gt; allocate(c(m, n))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;print*, " Dimensions of A : ", ubound(a)&lt;BR /&gt;print*, " Dimensions of B : ", ubound(b)&lt;BR /&gt;print*, " Dimensions of C : ", ubound(c)&lt;BR /&gt;&lt;BR /&gt;!A(1,1) = 1; A(1,2) = 2; A(1,3) = 3&lt;BR /&gt;!A(2,1) = 4; A(2,2) = 5; A(2,3) = 6&lt;BR /&gt;!&lt;BR /&gt;!B(1,1) = 2; B(1,2) = 3&lt;BR /&gt;!B(2,1) = 4; B(2,2) = 5&lt;BR /&gt;!B(3,1) = 6; B(3,2) = 7&lt;BR /&gt;&lt;BR /&gt;A(1,1) = 1; A(1,2) = 2&lt;BR /&gt;A(2,1) = 4; A(2,2) = 5&lt;BR /&gt;!&lt;BR /&gt;B(1,1) = 2; B(1,2) = 3&lt;BR /&gt;B(2,1) = 4; B(2,2) = 5&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;print*, " Original A : "&lt;BR /&gt;do i = 1, m&lt;BR /&gt;write(*,fmt='(13f10.3)') a(i,:)&lt;BR /&gt;enddo&lt;BR /&gt;print*, " Original B : "&lt;BR /&gt;do i = 1, n&lt;BR /&gt;write(*,fmt='(13f10.3)') b(i,:)&lt;BR /&gt;enddo&lt;BR /&gt;&lt;BR /&gt;! Call DGEMM subroutine&lt;BR /&gt;! call DGEMM(a, b, c, transa, transb, alpha, beta)&lt;BR /&gt;&lt;BR /&gt;call dgemm(transa, transb, m, n, k, alfa, a, lda, b, ldb, beta, c, ldc)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Print*, " Result matrix C = AxB "&lt;BR /&gt;do i = 1, ldc&lt;BR /&gt;write(*,fmt='(i8,13f10.3)') i,c(i,:)&lt;BR /&gt;enddo&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;end program test_blas&lt;BR /&gt;&lt;BR /&gt;The compilation:&lt;BR /&gt;&lt;BR /&gt;/opt/intel/bin/ifort construct_G.f90 -L/opt/intel/composerxe-2011.2.137/mkl/lib/intel64 -I/opt/intel/composerxe-2011.2.137/mkl/include/intel64/ilp64 -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -Wl,--start-group /opt/intel/composerxe-2011.2.137/mkl/lib/intel64/libmkl_intel_ilp64.a /opt/intel/composerxe-2011.2.137/mkl/lib/intel64/libmkl_intel_thread.a /opt/intel/composerxe-2011.2.137/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -openmp -lpthread -o construct_G&lt;BR /&gt;&lt;BR /&gt;The result:&lt;BR /&gt;&lt;BR /&gt;Dimensions of A : 2 2&lt;BR /&gt; Dimensions of B : 2 2&lt;BR /&gt; Dimensions of C : 2 2&lt;BR /&gt; Original A : &lt;BR /&gt; 1.000 2.000&lt;BR /&gt; 4.000 5.000&lt;BR /&gt; Original B : &lt;BR /&gt; 2.000 3.000&lt;BR /&gt; 4.000 5.000&lt;BR /&gt;&lt;BR /&gt;So I am getting nothing. &lt;BR /&gt;&lt;BR /&gt;Kon</description>
    <pubDate>Wed, 06 Jun 2012 05:53:38 GMT</pubDate>
    <dc:creator>kon-konstantinov</dc:creator>
    <dc:date>2012-06-06T05:53:38Z</dc:date>
    <item>
      <title>DGEMM is not working</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/DGEMM-is-not-working/m-p/807650#M3530</link>
      <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;I amd trying to use DGEMM subroutine from BLAS to multiply two large matrices.&lt;BR /&gt;However my test code is not working. What am I doing wrong? Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;The code:&lt;BR /&gt;program test_blas&lt;BR /&gt;use mkl95_precision, only: wp =&amp;gt; dp ! in program head&lt;BR /&gt;USE mkl95_LAPACK, ONLY: GETRF, GETRI, SYTRF, SYTRI, POTRF, POTRI&lt;BR /&gt;USE mkl95_BLAS, ONLY: GEMM&lt;BR /&gt;&lt;BR /&gt;!implicit none&lt;BR /&gt;integer :: i, j, k, l, m, n, lda, ldb, ldc&lt;BR /&gt;real(8), DIMENSION(:,:), ALLOCATABLE :: A, B, C, S&lt;BR /&gt;character(len = 1) :: transa, transb&lt;BR /&gt;real(8)::alfa,beta&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;transa = 'N'; transb = 'N'&lt;BR /&gt;m = 2&lt;BR /&gt;n = 2&lt;BR /&gt;k = 2&lt;BR /&gt;alfa=1.d0; beta=1.d0&lt;BR /&gt;&lt;BR /&gt;if ((transa.eq.'N').or.(transa.eq.'n')) then&lt;BR /&gt; lda = m&lt;BR /&gt; allocate(a(m, k))&lt;BR /&gt; else&lt;BR /&gt; lda = k&lt;BR /&gt; allocate(a(k, m))&lt;BR /&gt; end if&lt;BR /&gt; if ((transb.eq.'N').or.(transb.eq.'n')) then&lt;BR /&gt; ldb = k&lt;BR /&gt; allocate(b(k, n))&lt;BR /&gt; else&lt;BR /&gt; ldb = n&lt;BR /&gt; allocate(b(n, k))&lt;BR /&gt; end if&lt;BR /&gt; ldc = m&lt;BR /&gt; allocate(c(m, n))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;print*, " Dimensions of A : ", ubound(a)&lt;BR /&gt;print*, " Dimensions of B : ", ubound(b)&lt;BR /&gt;print*, " Dimensions of C : ", ubound(c)&lt;BR /&gt;&lt;BR /&gt;!A(1,1) = 1; A(1,2) = 2; A(1,3) = 3&lt;BR /&gt;!A(2,1) = 4; A(2,2) = 5; A(2,3) = 6&lt;BR /&gt;!&lt;BR /&gt;!B(1,1) = 2; B(1,2) = 3&lt;BR /&gt;!B(2,1) = 4; B(2,2) = 5&lt;BR /&gt;!B(3,1) = 6; B(3,2) = 7&lt;BR /&gt;&lt;BR /&gt;A(1,1) = 1; A(1,2) = 2&lt;BR /&gt;A(2,1) = 4; A(2,2) = 5&lt;BR /&gt;!&lt;BR /&gt;B(1,1) = 2; B(1,2) = 3&lt;BR /&gt;B(2,1) = 4; B(2,2) = 5&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;print*, " Original A : "&lt;BR /&gt;do i = 1, m&lt;BR /&gt;write(*,fmt='(13f10.3)') a(i,:)&lt;BR /&gt;enddo&lt;BR /&gt;print*, " Original B : "&lt;BR /&gt;do i = 1, n&lt;BR /&gt;write(*,fmt='(13f10.3)') b(i,:)&lt;BR /&gt;enddo&lt;BR /&gt;&lt;BR /&gt;! Call DGEMM subroutine&lt;BR /&gt;! call DGEMM(a, b, c, transa, transb, alpha, beta)&lt;BR /&gt;&lt;BR /&gt;call dgemm(transa, transb, m, n, k, alfa, a, lda, b, ldb, beta, c, ldc)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Print*, " Result matrix C = AxB "&lt;BR /&gt;do i = 1, ldc&lt;BR /&gt;write(*,fmt='(i8,13f10.3)') i,c(i,:)&lt;BR /&gt;enddo&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;end program test_blas&lt;BR /&gt;&lt;BR /&gt;The compilation:&lt;BR /&gt;&lt;BR /&gt;/opt/intel/bin/ifort construct_G.f90 -L/opt/intel/composerxe-2011.2.137/mkl/lib/intel64 -I/opt/intel/composerxe-2011.2.137/mkl/include/intel64/ilp64 -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -Wl,--start-group /opt/intel/composerxe-2011.2.137/mkl/lib/intel64/libmkl_intel_ilp64.a /opt/intel/composerxe-2011.2.137/mkl/lib/intel64/libmkl_intel_thread.a /opt/intel/composerxe-2011.2.137/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -openmp -lpthread -o construct_G&lt;BR /&gt;&lt;BR /&gt;The result:&lt;BR /&gt;&lt;BR /&gt;Dimensions of A : 2 2&lt;BR /&gt; Dimensions of B : 2 2&lt;BR /&gt; Dimensions of C : 2 2&lt;BR /&gt; Original A : &lt;BR /&gt; 1.000 2.000&lt;BR /&gt; 4.000 5.000&lt;BR /&gt; Original B : &lt;BR /&gt; 2.000 3.000&lt;BR /&gt; 4.000 5.000&lt;BR /&gt;&lt;BR /&gt;So I am getting nothing. &lt;BR /&gt;&lt;BR /&gt;Kon</description>
      <pubDate>Wed, 06 Jun 2012 05:53:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/DGEMM-is-not-working/m-p/807650#M3530</guid>
      <dc:creator>kon-konstantinov</dc:creator>
      <dc:date>2012-06-06T05:53:38Z</dc:date>
    </item>
    <item>
      <title>DGEMM is not working</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/DGEMM-is-not-working/m-p/807651#M3531</link>
      <description>You link with the ILP64 libraries, yet I do not see anything in your program or the compilation command to tell the compiler that default integers should be treated as eight-byte integers. Your USE statements did not do one of their intended functions since the MKL subroutine that you call is not declared in those modules.&lt;BR /&gt;&lt;BR /&gt;You can do one of:&lt;BR /&gt;&lt;BR /&gt; (i) Use LP64 libraries&lt;BR /&gt;&lt;BR /&gt; (ii) Use ILP64 libraries and change the declarations of the integer variables involved in the calls to 8-byte integers.&lt;BR /&gt;&lt;BR /&gt; (iii) Use ILP64 libraries and use a compiler option that promotes default integers to 8-byte integers.&lt;BR /&gt;&lt;BR /&gt; (iv) Change the DGEMM call to a call to the generic GEMM subroutine.</description>
      <pubDate>Wed, 06 Jun 2012 09:40:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/DGEMM-is-not-working/m-p/807651#M3531</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-06-06T09:40:27Z</dc:date>
    </item>
    <item>
      <title>DGEMM is not working</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/DGEMM-is-not-working/m-p/807652#M3532</link>
      <description>Thank you very much for your suggestions. I've change the dafault integers to 8-byte integers&lt;BR /&gt;and everything worked. As per using "USE mkl95_BLAS, ONLY: GEMM", changing to DGEMM is not working.&lt;BR /&gt;It requires the generic name gemm. Anyway thanks again.&lt;BR /&gt;&lt;BR /&gt;Kon&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jun 2012 00:13:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/DGEMM-is-not-working/m-p/807652#M3532</guid>
      <dc:creator>kon-konstantinov</dc:creator>
      <dc:date>2012-06-07T00:13:10Z</dc:date>
    </item>
  </channel>
</rss>

