Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

MKL function cblas_sgemv gives different results each time

XUE__Xingyuan
Beginner
507 Views

Hi, I have used cblas_sgemv but this function gives different results each time and I have checked the inputs which are always the same. Sometimes the result is correct (with 1e-6 L2 norm error compared to the correct result). Could someone tell me why I have this?

 

Thanks,

Cindy

0 Kudos
4 Replies
Gennady_F_Intel
Moderator
507 Views

What do you mean by the different results? Do you expect to see bit to bit outputs? if yes, then you may try to use the CNR feature which will allow you to get the same output from run to run.

0 Kudos
XUE__Xingyuan
Beginner
507 Views

I have solved the problem. By running the following two commands, the results are correct. 

export MKL_INTERFACE_LAYER=GNU
export MKL_THREADING_LAYER=GNU

More details can be found here.

It seems a linking problem. I just could not figure out why this works. Can anyone explain it to me?

0 Kudos
Gennady_F_Intel
Moderator
507 Views

all info you may find out into mkl user's guide.

0 Kudos
XUE__Xingyuan
Beginner
507 Views

Thanks for your help. 

0 Kudos
Reply