- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm new to MKL so please bare with me. We're moving a project from 32 to 64 bit and we've encountered some inconsistencies between 32 & 64 bit vdExp.
I have the following code
double value = 0.027771918023383080;
double result;
vdExp( 1, &value, &result );
In 32 bit mode, the value in result is 1.0281611526482297 whilst when I run it in 64 bit mode I get 1.0281611526482299.
Any ideas why this is? I've double checked and I'm definitely compiling with the correct libraries. I used the Intel MKL link advisor.
Regards
Mark.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those results are so close that the function results may be identical. It may be a difference in the library used by your debugger or compiler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the response but it may seem like a tiny difference and I've replicated it across several other double values but it makes a big difference as we're already dealing with large numbers and when you multiply or use other maths with an incorrect, no, inconsistent value then it makes most of our unit tests fail and presents a burden on our porting effort.
I'd really like to get to the bottom of it if possible so we can come up with a strategy.
Btw, we've also noticed the same inconsistencies using the normal std::exp function albeit with different values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It turns out, after reading a bit more on the MKL that if I use
mkl_cbwr_set( MKL_CBWR_SSE2);
which I gleaned from this intel documentation https://software.intel.com/en-us/node/528731
then I get consistent results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you running the ia32 and intel64 executables on the same CPU? I tried your test case with the latest Intel compiler (16.0.3 20160415) and I got the same result on most platforms I tried, for both 32bit and 64bit:
input = 0.027771918023383080 = 0x3f9c703ddea16800
result = 1.028161152648229715 = 0x3ff073591bda44db
I see different result on Penryn processors:
input = 0.027771918023383080 = 0x3f9c703ddea16800
result = 1.028161152648229937 = 0x3ff073591bda44dc
For vector math functions in MKL, the result should usually be the same for ia32 and intel64 on the same CPU. However, on different CPUs we cannot guarantee the same result, since we are optimizing for different instruction sets. For that, you should use conditional numerical reproducibility (CBWR) setting of MKL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jingwei, I found that out and you're right that using the CBWR does indeed produce correct results across our machines.
We are definitely using Intel x86/x64 machines for our testing. One of the machines we saw no problems with but the others all exhibited this issue. the one which didn't have the issue was an intel i7-3840QM, the others were intel i5's.
Anyway, I'm happy to report we're getting consistent results now.
Thanks for all your comments.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page