Community
cancel
Showing results for 
Search instead for 
Did you mean: 
SRG
Beginner
51 Views

Possible bug using DGEMM beta parameter


Good afternoon,

I've been trying to solve a bug in my C code for some time and I ended up discovering that dgemm_() doesn't seem to use the beta value :S. According to Intel's MKL Documentation and BLAS reference documentation, the expected behaviour for this function is:

C = alpha*A*B + beta*C

If beta is set to 0, then it's not expected to give C as input of the operation and will only work as output. But if beta is set to another value (e.g., -1.0), the product will take place and the result will be added to alpha*A*B.

For some reason, I can set beta to any value and it's like dgemm_() never uses it. Have you tested this function using the latest version of the MKL?

To check if it was me calling this function in a wrong way, I manually did alpha*A*B product and the result was equivalent to the one given by dgemm_() with a random beta value.

Thank you in advance.
 

0 Kudos
3 Replies
SRG
Beginner
51 Views


Excuse me for my post, the function works perfectly as expected. I tested the code in another machine with an older version of the MKL library and the behaviour was the same, so the error is in my code for sure.

Again, excuse me :).

mecej4
Black Belt
51 Views

If you post a code example that shows the arguments that you passed to DGEMM, someone here could help you to spot the error. Note that dgemm_() is intended to be called from Fortran, and that if you call it from C you need to follow Fortran conventions. In particular, you have to pass the addresses of even scalar arguments. Consider using the CBLAS variant, cblas_dgemm().

SRG
Beginner
51 Views

Thank you for your reply mecej4. I didn't know that dgemm_() result was column-major, even if you specify "T" to transpose the input matrices. So, using cblas_dgemm() everything was solved :).

I thought that it was about the beta value, but it was just a simple coincidence.

Thank you again.

Reply