FADDS_GEMM and FMULS_GEMM in flops.h do same operation

Open discussion for MAGMA

FADDS_GEMM and FMULS_GEMM in flops.h do same operation

Postby luiceur » Wed Jul 11, 2012 5:10 am

Hi,

I am trying to understand how magma is measuring the number of flops in a matrix multiplication. it defines a

FLOPS(m,n,k) (FMULS_GEMM(m,n,k) + FADDS_GEMM(m,n,k))

FMULS_GEMM and FADDS_GEMM do the same operation -> m*n*k. I think the number of operations is right for single precision, but why 2 macros doing the same with different names?
luiceur
 
Posts: 26
Joined: Tue Jul 10, 2012 4:38 am

Re: FADDS_GEMM and FMULS_GEMM in flops.h do same operation

Postby Stan Tomov » Tue Jul 17, 2012 6:22 pm

Hi,
This is just for convenience in maintaining the codes in different precisions. We keep one version in double complex and generate all the rest with a python script. Besides this there is no other reason to have two macros.
Stan
Stan Tomov
 
Posts: 253
Joined: Fri Aug 21, 2009 10:39 pm

Re: FADDS_GEMM and FMULS_GEMM in flops.h do same operation

Postby mgates3 » Tue Jul 24, 2012 11:14 am

As the macro names state, one is the number of multiplies, the other is the number of adds. For gemm, these are the same, but for other functions, these are different formulas. E.g.,

#define FMULS_SYR2K( k, n ) ((k) * (n) * (n) )
#define FADDS_SYR2K( k, n ) ((k) * (n) * (n) + (n))

Then, as Stan stated, we need multiplies and adds separately to deal with complex arithmetic. Note the difference between flops for a complex cgemm and real sgemm:

#define FLOPS_CGEMM(m, n, k) (6.0 * FMULS_GEMM(m, n, k) + 2.0 * FADDS_GEMM(m, n, k) )
#define FLOPS_SGEMM(m, n, k) ( FMULS_GEMM(m, n, k) + FADDS_GEMM(m, n, k) )

-mark
mgates3
 
Posts: 438
Joined: Fri Jan 06, 2012 2:13 pm


Return to User discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron