<?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: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271742#M31155</link>
    <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/153494"&gt;@AlphaF20&lt;/a&gt;&amp;nbsp;Which entries in c6 are incorrect? (all of them?)&lt;/P&gt;</description>
    <pubDate>Wed, 07 Apr 2021 20:02:25 GMT</pubDate>
    <dc:creator>Peter_C_Intel</dc:creator>
    <dc:date>2021-04-07T20:02:25Z</dc:date>
    <item>
      <title>Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1270942#M31125</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I came cross a type of tensor contraction with symmetry in individual tensor(s) in Fortran.&amp;nbsp; I heard it is related to MKL. Hence, I posted this question here.&lt;/P&gt;
&lt;P&gt;The question is, is there a way to utilize such symmetries in BLAS?&lt;/P&gt;
&lt;P&gt;For instance, for a tensor contraction&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;A[a,b] * B[b,c,d] = C[a,c,d]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where the Einstein summation rule was assumed, repeated index, b, stands for summation. i.e., \sum_b in the above equation. Tensor/array A,B,C are all real. The tensor/array b has a symmetry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;B[b,c,d] = B[b,d,c]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which leads to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;C[a,c,d] = C[a,d,c]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In BLAS, there are some subroutines about symmetric matrix, but not higher rank tensor/array as far as I know. Is there any way to utilize the above symmetries in DGEMM or any other subroutines?&lt;/P&gt;
&lt;P&gt;I heard to first do loops over indices c and d, then do DGEMM with array with fewer indices. If I define new arrays&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;B_small(:) = B(:,c,d), C_small(:) = C(:,c,d)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that would take a bit time (I think I tested the wall time at some stage). Hence, I would like to know any efficient solution. My attempt code is following&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Program blas_symm_tensor

  Use, Intrinsic :: iso_fortran_env, Only :  wp =&amp;gt; real64, li =&amp;gt; int64

  Implicit None

  Real( wp ), Dimension( :, :    ), Allocatable :: a
  Real( wp ), Dimension( :, :, : ), Allocatable :: b
  Real( wp ), Dimension( :, :, : ), Allocatable :: c1, c2, c3, c4, c5

  Integer :: na, nb, nc, nd, ne
  Integer :: la, lb, lc, ld  
  Integer( li ) :: start, finish, rate, numthreads
  
  Write( *, * ) 'na, nb, nc, nd ?'
  Read( *, * ) na, nb, nc, nd
  
  ne = nc * nd
  
  Allocate( a ( 1:na, 1:nb ) ) 
  Allocate( b ( 1:nb, 1:nc, 1:nd ) ) 
  Allocate( c1( 1:na, 1:nc, 1:nd ) ) 
  Allocate( c2( 1:na, 1:nc, 1:nd ) ) 
  Allocate( c3( 1:na, 1:nc, 1:nd ) )
  Allocate( c4( 1:na, 1:nc, 1:nd ) )
  Allocate( c5( 1:na, 1:nc, 1:nd ) )
  
  ! Set up some data
  Call Random_number( a )
  Call Random_number( b )
  
  ! symmetrize tensor b
  do la = 1, na 
    do lc = 1, nc
      do ld = lc+1, nd
         b(la,lc,ld) = b(la,ld,lc)
      enddo
    enddo
  enddo
  
  Call System_clock( start, rate )
  c1 = 0.0_wp
  
  do ld = 1, nd  
    do lc = 1, nc
      do lb = 1, nb
        do la = 1, na    
          c1(la,lc,ld) = c1(la,lc,ld)  + a(la,lb) * b(lb, lc, ld)
        enddo  
      enddo
    enddo
  enddo  
 
  Call System_clock( finish, rate )
  Write( *, * ) 'Time for loop', Real( finish - start, wp ) / rate  
 
  Call System_clock( start, rate )
  c2 = 0.0_wp
  
  do ld = 1, nd  
    do lc = 1, ld
      do lb = 1, nb
        do la = 1, na    
          c2(la,lc,ld) = c2(la,lc,ld)  + a(la,lb) * b(lb, lc, ld)
        enddo  
      enddo
    enddo
  enddo  
 
  do ld = 1, nd  
    do lc = ld+1, nc 
      do la = 1, na     
        c2(la,lc,ld) = c2(la,ld,lc)
      end do  
    enddo
  enddo  

  Call System_clock( finish, rate )
  Write( *, * ) 'Time for symmetric loop', Real( finish - start, wp ) / rate  

  Call System_clock( start, rate )
  c3 = 0.0_wp
  
  do ld = 1, nd  
    do lc = 1, ld  
       Call dgemm( 'N', 'N', na, 1, nb, 1.0_wp, a , Size( a , Dim = 1 ), &amp;amp;
                                            b(:,lc,ld) , Size( b , Dim = 1 ), &amp;amp;
                                            0.0_wp, c3, Size( c3, Dim = 1 ) )      
    enddo
  enddo  
  
  do ld = 1, nd  
    do lc = ld+1, nc 
      do la = 1, na     
        c3(la,lc,ld) = c3(la,ld,lc)
      end do  
    enddo
  enddo  
  Call System_clock( finish, rate )
  
  Write( *, * ) 'Time for symmetric dgemm', Real( finish - start, wp ) / rate
  
  ! Direct
  Call System_clock( start, rate )
  Call dgemm( 'N', 'N', na, ne, nb, 1.0_wp, a , Size( a , Dim = 1 ), &amp;amp;
                                            b , Size( b , Dim = 1 ), &amp;amp;
                                            0.0_wp, c4, Size( c4, Dim = 1 ) )
  Call System_clock( finish, rate )
  Write( *, * ) 'Time for straight dgemm', Real( finish - start, wp ) / rate

  Call System_clock( start, rate )
  c5 = 0.0_wp
  do ld = 1, nd  
    do lc = 1, ld  
       Call dgemv( 'N', na,  nb, 1.0_wp,  a, na, b(1,lc,ld), 1, 0.0_wp,  c5, 1 )      
    enddo
  enddo  
   
  do ld = 1, nd  
    do lc = ld+1, nc 
      do la = 1, na     
        c5(la,lc,ld) = c5(la,ld,lc)
      end do  
    enddo
  enddo  
  Call System_clock( finish, rate )
  Write( *, * ) 'Time for symmetric dgemv', Real( finish - start, wp ) / rate
  
  do la = 1, na 
    do lc = 1, nc
      do ld = 1, nd
      
         if ( dabs(c1(la,lc,ld) - c2(la,lc,ld))  &amp;gt; 1.e-6 ) then 
           write (*,*) '!!! c2', la,lc,ld, c1(la,lc,ld) - c2(la,lc,ld)
         endif               
                  
         if ( dabs(c1(la,lc,ld) - c3(la,lc,ld))  &amp;gt; 1.e-6 ) then 
           write (*,*) '!!! c3', la,lc,ld, c1(la,lc,ld) - c3(la,lc,ld)
         endif         
 
         if ( dabs(c1(la,lc,ld) - c4(la,lc,ld))  &amp;gt; 1.e-6 ) then 
           write (*,*) '!!! c4', la,lc,ld, c1(la,lc,ld) - c4(la,lc,ld)
         endif        
 
         if ( dabs(c1(la,lc,ld) - c5(la,lc,ld))  &amp;gt; 1.e-6 ) then 
           write (*,*) '!!! c5', la,lc,ld, c1(la,lc,ld) - c5(la,lc,ld)
         endif   
 
      enddo
    enddo
  enddo  
  
End Program blas_symm_tensor&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got different number in resulting array c3 (DGEMM) and c5 (DGEMV)&lt;/P&gt;
&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 17:11:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1270942#M31125</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-05T17:11:51Z</dc:date>
    </item>
    <item>
      <title>Re:Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271183#M31129</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We are working on your query internally and will get back to you.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2021 10:54:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271183#M31129</guid>
      <dc:creator>RahulV_intel</dc:creator>
      <dc:date>2021-04-06T10:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271609#M31146</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/153494"&gt;@AlphaF20&lt;/a&gt;&amp;nbsp;, thanks for your question!&lt;/P&gt;
&lt;P&gt;As you mentioned, you can use DGEMM to perform this contraction, and in fact you can do it with a single DGEMM call if you'd like. Going back to your original operation:&lt;/P&gt;
&lt;P&gt;C[a,c,d] &amp;lt;- A[a,b] * B[b,c,d]&lt;/P&gt;
&lt;P&gt;notice you can flatten the last two indices (c,d) into a single linear index f without rearranging the data:&lt;/P&gt;
&lt;P&gt;C'[a,f] &amp;lt;- A[a,b] * B'[b,f]&lt;/P&gt;
&lt;P&gt;Here I've reinterpreted C, B as matrices C', B' of size la x (lc*ld) and lb x (lc*ld) respectively. The single index f replaces the two indices c, d (f = c + d *lc), and ranges from 1...lc*ld. This is a plain matrix multiply, so you can call MKL DGEMM.&lt;/P&gt;
&lt;P&gt;So far we haven't taken any advantage of the symmetry of B. If it works for the rest of the application, you could only store the unique elements of B' by keeping only the unique columns, say where c &amp;lt;= d. In this way, f becomes a linear index into the "upper triangles" of B,&amp;nbsp;ranging from 1...(lc*(lc + 1)/2).&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 14:12:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271609#M31146</guid>
      <dc:creator>Peter_C_Intel</dc:creator>
      <dc:date>2021-04-07T14:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271628#M31147</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/114618"&gt;@Peter_C_Intel&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Thank you so much for your answer!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; About &amp;gt;you could only store the unique elements of B' by keeping only the unique columns, say where c &amp;lt;= d.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; May I know how to realize it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I can define new arrays with smaller dimensions, e.g., B''(:,:), and using the second dimension to store the upper triangle indices. My experience from other cases is that, introducing new arrays take some time. It may compensate for the advantage of utilizing the symmetry. Hence, I would like to know if there is any method can do DGEMM without using any additional arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Maybe I should try to test more cases with new arrays such as B''(:,:) and comparing the timing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 14:56:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271628#M31147</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-07T14:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271630#M31148</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/153494"&gt;@AlphaF20&lt;/a&gt;&amp;nbsp;-- At the moment I can't think of a clever way to avoid copying data if you need the full 3D tensor in other parts of your code. How large are la/lb/lc/ld typically for your use case?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 14:58:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271630#M31148</guid>
      <dc:creator>Peter_C_Intel</dc:creator>
      <dc:date>2021-04-07T14:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271634#M31149</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/114618"&gt;@Peter_C_Intel&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Thank you so much for your prompt reply.&amp;nbsp; My la is about 20~30, lb~ld about 30~60. In some cases, I need to deal with higher dimensional arrays and the calculation needs to be done multiple times. The accumulate wall time can be high.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 15:30:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271634#M31149</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-07T15:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271642#M31150</link>
      <description>&lt;P&gt;Another option, if you only need e.g. the "upper triangle" of C to be stored, is to do a loop in the d dimension around DGEMM:&lt;/P&gt;
&lt;P&gt;for d = 1...ld&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C(:, 1:d, d) &amp;lt;- A * B(:, 1:d, d)&lt;/P&gt;
&lt;P&gt;The inner matrix multiplications can be performed with DGEMM.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 15:37:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271642#M31150</guid>
      <dc:creator>Peter_C_Intel</dc:creator>
      <dc:date>2021-04-07T15:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271668#M31151</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/114618"&gt;@Peter_C_Intel&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Thank you so much for your wonderful suggestion! I appreciate it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I tried the following code to implement your idea&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  Real( wp ), Dimension( :, :, : ), Allocatable :: c6

  Allocate( c6( 1:na, 1:nc, 1:nd ) )


  c6 = 0.0_wp
  do ld = 1, nd  
     Call dgemm( 'N', 'N', na, 1, nb, 1.0_wp, a , Size( a , Dim = 1 ), &amp;amp;
                                            b(:,1:ld,ld) , Size( b , Dim = 1 ), &amp;amp;
                                            0.0_wp, c6, Size( c6, Dim = 1 ) )      
  enddo  
     
  do ld = 1, nd  
    do lc = ld+1, nc 
      do la = 1, na     
        c6(la,lc,ld) = c6(la,ld,lc)
      end do  
    enddo
  enddo    
  

  
    do la = 1, na 
      do lc = 1, nc
        do ld = 1, nd
      
         if ( dabs(c1(la,lc,ld) - c6(la,lc,ld))  &amp;gt; 1.e-6 ) then 
           write (*,*) '!!! c6 symmetric dgemm-2', la,lc,ld, c1(la,lc,ld) - c5(la,lc,ld)
         endif            
 
      enddo
    enddo
  enddo  
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got different numbers than the nested loop value c1 (in the code of the first post). Perhaps I made some mistake in using DGEMM &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; How to do DGEMM correctly here? I am sorry for bothering you so many times.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 16:33:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271668#M31151</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-07T16:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271671#M31152</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/153494"&gt;@AlphaF20&lt;/a&gt;&amp;nbsp;-- your code looks mostly good; remember to also index into C:&lt;/P&gt;
&lt;P&gt;dgemm(..., c6(:,1:ld,ld), ...)&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 16:42:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271671#M31152</guid>
      <dc:creator>Peter_C_Intel</dc:creator>
      <dc:date>2021-04-07T16:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271680#M31153</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/114618"&gt;@Peter_C_Intel&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;Thank you so much!&lt;/P&gt;
&lt;P&gt;I revised to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  do ld = 1, nd  
     Call dgemm( 'N', 'N', na, 1, nb, 1.0_wp, a , Size( a , Dim = 1 ), &amp;amp;
                                            b(:,1:ld,ld) , Size( b , Dim = 1 ), &amp;amp;
                                            0.0_wp,  c6(:,1:ld,ld), Size( c6, Dim = 1 ) )      
  enddo  &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;still got different value than c1 from nested loops. &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp; I used ifort (IFORT) 19.0.3.199 20190206 and compile the f90 file using ifort -mkl.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 17:21:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271680#M31153</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-07T17:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271742#M31155</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/153494"&gt;@AlphaF20&lt;/a&gt;&amp;nbsp;Which entries in c6 are incorrect? (all of them?)&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 20:02:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271742#M31155</guid>
      <dc:creator>Peter_C_Intel</dc:creator>
      <dc:date>2021-04-07T20:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271759#M31156</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/114618"&gt;@Peter_C_Intel&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thank you once again for your reply. I appreciate your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Many entries, not exactly upper triangle. By the printing code&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  do la = 1, na 
    do lc = 1, nc
      do ld = 1, nd
      
         if ( dabs(c1(la,lc,ld) - c6(la,lc,ld))  &amp;gt; 1.e-6 ) then 
           write (*,*) '!!! c6 symmetric dgemm-2', la,lc,ld, c1(la,lc,ld), c6(la,lc,ld)
         endif            
 
      enddo
    enddo
  enddo  &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;led to (na=nb=nc=nd=5)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;!!! c6 symmetric dgemm-2           1           2           2
   1.31348887015712       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           2           3
  0.837588080628633       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           2           4
  0.753232695495532       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           2           5
  0.478117026507440       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           3           2
  0.837588080628633       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           3           3
   1.60546094997582       0.000000000000000E+000
&lt;/LI-CODE&gt;
&lt;P&gt;I don't know where I made the mistake with DGEMM &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;
&lt;P&gt;If you need any additional information, please let me know. I try to be as clear as I can.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 20:38:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271759#M31156</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-07T20:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271762#M31157</link>
      <description>&lt;P&gt;That's strange that e.g. the (1,2,4) entry is incorrect (zero), while the (1,4,2) entry is correct, since the (1,4,2) entry was copied from the (1,2,4) entry.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 20:46:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271762#M31157</guid>
      <dc:creator>Peter_C_Intel</dc:creator>
      <dc:date>2021-04-07T20:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271763#M31158</link>
      <description>&lt;P&gt;Oops, I did not paste all inconsistent entries&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt; !!! c6 symmetric dgemm-2           1           2           2
   1.31348887015712       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           2           3
  0.837588080628633       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           2           4
  0.753232695495532       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           2           5
  0.478117026507440       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           3           2
  0.837588080628633       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           3           3
   1.60546094997582       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           3           4
  0.635405154591089       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           3           5
  0.936981465066013       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           4           2
  0.753232695495532       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           4           3
  0.635405154591089       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           4           4
  0.951465241952073       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           4           5
   1.35589302240768       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           5           2
  0.478117026507440       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           5           3
  0.936981465066013       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           5           4
   1.35589302240768       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           1           5           5
  0.947407510599024       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           2           2
  0.982740142784391       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           2           3
  0.454261565081234       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           2           4
  0.379019697626723       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           2           5
  0.463878131907890       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           3           2
  0.454261565081234       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           3           3
   1.38584009273324       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           3           4
  0.772631816537492       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           3           5
  0.838583550164614       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           4           2
  0.379019697626723       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           4           3
  0.772631816537492       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           4           4
  0.801559198544687       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           4           5
  0.945483527728317       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           5           2
  0.463878131907890       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           5           3
  0.838583550164614       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           5           4
  0.945483527728317       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           2           5           5
   1.01922577710048       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           2           2
   1.21501967341257       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           2           3
  0.751368628288491       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           2           4
   1.20695111834953       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           2           5
  0.768640451902166       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           3           2
  0.751368628288491       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           3           3
   1.24850494613211       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           3           4
   1.02216928236875       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           3           5
   1.02297953612829       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           4           2
   1.20695111834953       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           4           3
   1.02216928236875       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           4           4
  0.854921457179884       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           4           5
   1.51419329132511       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           5           2
  0.768640451902166       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           5           3
   1.02297953612829       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           5           4
   1.51419329132511       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           3           5           5
   1.05841684139229       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           2           2
   2.42535630024303       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           2           3
   1.47908052253849       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           2           4
   1.92820282226805       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           2           5
   1.89486126875148       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           3           2
   1.47908052253849       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           3           3
   3.14610468834190       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           3           4
   2.08679999203636       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           3           5
   2.07491602246583       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           4           2
   1.92820282226805       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           4           3
   2.08679999203636       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           4           4
   1.56443083824290       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           4           5
   2.79345022032791       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           5           2
   1.89486126875148       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           5           3
   2.07491602246583       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           5           4
   2.79345022032791       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           4           5           5
   2.03919814673137       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           2           2
   1.37501064481411       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           2           3
   1.02125298029307       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           2           4
   1.50769866614544       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           2           5
  0.959930544467842       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           3           2
   1.02125298029307       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           3           3
   1.98036308866278       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           3           4
   1.18770561844815       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           3           5
   1.43258214875474       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           4           2
   1.50769866614544       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           4           3
   1.18770561844815       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           4           4
   1.19745384959945       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           4           5
   1.96112789765020       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           5           2
  0.959930544467842       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           5           3
   1.43258214875474       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           5           4
   1.96112789765020       0.000000000000000E+000
 !!! c6 symmetric dgemm-2           5           5           5
   1.32984150498105       0.000000000000000E+000
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;both 124 and 142 are there. I am very sorry for this issue.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 20:49:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271763#M31158</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-07T20:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to utilize BLAS with symmetry for high rank tensor/array in Fortran MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271780#M31160</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/114618"&gt;@Peter_C_Intel&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Seems I got a fix!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  do ld = 1, nd  
     Call dgemm( 'N', 'N', na, 1, nb, 1.0_wp, a , Size( a , Dim = 1 ), &amp;amp;
                                            b(:,1:ld,ld) , Size( b , Dim = 1 ), &amp;amp;
                                            0.0_wp,  c6(:,1:ld,ld), Size( c6, Dim = 1 ) )      
  enddo  
     &lt;/LI-CODE&gt;
&lt;P&gt;the index between na and nb should *not* be 1. Replace it as ld seems to work&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  do ld = 1, nd  
     Call dgemm( 'N', 'N', na, ld, nb, 1.0_wp, a , Size( a , Dim = 1 ), &amp;amp;
                                            b(:,1:ld,ld) , Size( b , Dim = 1 ), &amp;amp;
                                            0.0_wp,  c6(:,1:ld,ld), Size( c6, Dim = 1 ) )      
  enddo  
     &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and got faster&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt; na, nb, nc, nd ?
100 100 100 100
 Time for straight dgemm  2.426400000000000E-002
 Time for symmetric dgemm-2  6.451000000000000E-003&lt;/LI-CODE&gt;
&lt;P&gt;Thank you so much! You made my day!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 20:58:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Is-there-any-way-to-utilize-BLAS-with-symmetry-for-high-rank/m-p/1271780#M31160</guid>
      <dc:creator>AlphaF20</dc:creator>
      <dc:date>2021-04-07T20:58:02Z</dc:date>
    </item>
  </channel>
</rss>

