Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

A question about the comparison between DSYMM and DGEMM of Blas pacage

$
0
0

I want to compare the performance of DSYMM and DGEMM in calculating matrix multiplication C=A*B, where A is a double precision symmetric matrix.

I use two different versions of code.

The first version is:

!time of DGEMM
call date_and_time(date,time,zone,values1)
call dgemm('n','n',n,n,n,1.0d0,a,n,b,n,0.0d0,c,n)
call date_and_time(date,time,zone,values2)
time_ms1=values2(8)-values1(8)
time_ms1=1000*(values2(7)-values1(7))+time_ms1
time_ms1=60*1000*(values2(6)-values1(6))+time_ms1


!time DSYMM
call date_and_time(date,time,zone,values1)
call dsymm('L','U',n,n,1.0d0,a1,n,b1,n,0.0d0,c1,n)
call date_and_time(date,time,zone,values2)
time_ms2=values2(8)-values1(8)
time_ms2=1000*(values2(7)-values1(7))+time_ms2
time_ms2=60*1000*(values2(6)-values1(6))+time_ms2

!print out the time
print*,time_ms1,time_ms2

 

Different from the first one, in the second version, I call the DGEMM/DSYMM one time before I test their performances.

In detail, the second version is:

call dgemm('n','n',n,n,n,1.0d0,a,n,b,n,0.0d0,c,n)

call date_and_time(date,time,zone,values1)
call dgemm('n','n',n,n,n,1.0d0,a,n,b,n,0.0d0,c,n)
call date_and_time(date,time,zone,values2)
time_ms1=values2(8)-values1(8)
time_ms1=1000*(values2(7)-values1(7))+time_ms1
time_ms1=60*1000*(values2(6)-values1(6))+time_ms1


call dsymm('L','U',n,n,1.0d0,a1,n,b1,n,0.0d0,c1,n)


call date_and_time(date,time,zone,values1)
call dsymm('L','U',n,n,1.0d0,a1,n,b1,n,0.0d0,c1,n)
call date_and_time(date,time,zone,values2)
time_ms2=values2(8)-values1(8)
time_ms2=1000*(values2(7)-values1(7))+time_ms2
time_ms2=60*1000*(values2(6)-values1(6))+time_ms2
print*,time_ms1,time_ms2

 

When I set the number "n" in the coed as 600 and do the calculations on a 12 Kernels DELL PC,  in the first version, the time used by DGEMM and DSYMM are ~35 ms and ~11 ms, indicating the DSYMM is faster than DGEMM.

But in the second version, the time of DGEMM and DSYMM are not very stable, sometimes they are 21 ms V.S. 23 ms, sometimes 7 ms V.S. 8 ms. So in the second version, the DGEMM and DSYMM have similar performance.

I am confused why the two versions of codes offer different conclusions? Why the time reported by second version is not very stable? Which one should be the right answer to the question that which performs better in the calculations of matrix multiplication involving symmetric matrix.


Viewing all articles
Browse latest Browse all 2652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>