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

IEEE 754 Compliance

sicb0161
Beginner
1,295 Views
Hi,

Does the BLAS of the Intel MKL comply with the IEEE 754 standard ? If not, can you tell how big the ulps or relative errors are ?

Thx in advance.
0 Kudos
4 Replies
TimP
Honored Contributor III
1,295 Views
Quoting - sicb0161
Does the BLAS of the Intel MKL comply with the IEEE 754 standard ? If not, can you tell how big the ulps or relative errors are ?
You control in your application whether you are running with gradual underflow enabled, in case that bears on your question. The question about relative errors would make little sense to me except with respect to a specific test case.
While the BLAS is functionally the same as what you get with the netlib source code, I expect there are optimizations which batch sums, for example, usually giving more accuracy than the original. Where the netlib source skips operations on zeros, MKL may perform those operations.
Depending on the BLAS function, you may find vectorized code which was compiled with the equivalent of ifort -noprec-div -noprec-sqrt, which could produce variations of 1 ULP from IEEE 754, and those could grow, e.g. with ill-conditioned matrices.
To summarize, if this is important, you may want to run your test cases with netlib source compiled with the options you consider important for IEEE compliance, and compare with MKL results.
0 Kudos
sicb0161
Beginner
1,295 Views
Thx for your answer,

however, when transforming Matlab code to C Code with MKL BLAS , I get different results. To be more precise, I have rebuilt the LSQR method. In the first iteration, there is almost no error (rel error ~ 10e-7). After few iteration steps, there is a noticable error.

I am just wondering if there is such a non compliance.



Quoting - tim18
You control in your application whether you are running with gradual underflow enabled, in case that bears on your question. The question about relative errors would make little sense to me except with respect to a specific test case.
While the BLAS is functionally the same as what you get with the netlib source code, I expect there are optimizations which batch sums, for example, usually giving more accuracy than the original. Where the netlib source skips operations on zeros, MKL may perform those operations.
Depending on the BLAS function, you may find vectorized code which was compiled with the equivalent of ifort -noprec-div -noprec-sqrt, which could produce variations of 1 ULP from IEEE 754, and those could grow, e.g. with ill-conditioned matrices.
To summarize, if this is important, you may want to run your test cases with netlib source compiled with the options you consider important for IEEE compliance, and compare with MKL results.

0 Kudos
TimP
Honored Contributor III
1,295 Views
matlab, of course, uses double precision BLAS. If you use float data types, IEEE754 requires that you get different results.
0 Kudos
sicb0161
Beginner
1,295 Views
Quoting - tim18
matlab, of course, uses double precision BLAS. If you use float data types, IEEE754 requires that you get different results.

I of course converted my data into float data types.
0 Kudos
Reply