Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Fix arithmetic error

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

Georgios_S_

New Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-17-2015
05:25 AM

87 Views

Fix arithmetic error

I am performing a distributed Cholesky factorization and inversion of a matrix. I assume that the serial versions of these routines give the correct result, thus I am trying to make my distributed version work like the serial version when it comes to the result, by reading this thread.

I called `mkl_cbwr_set(MKL_CBWR_AVX), but I got the very same result with and without it. Here are the last 5 cells of the result matrix:`

distributed:

-549902542.265857 -1477292588.419721 2940319034.042153 -21964970840.793980 35339699997.924484

serial:

-549902542.266553 -1477292588.419761 2940319034.042350 -21964970840.794662 35339699997.925011

What should I do to receive the same results?

I also used mkl_malloc() with 16, 32 and 64 as the 2nd argument, but that didn't help! I am now realizing that the thread I have linked to, talks about reproducable results, something that's already OK in my case.

So, can I get the same results in the distributed version, as in the serial version, or that's not possible?

Kind regards,

George

1 Solution

Alexander_K_Intel3

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2015
04:43 AM

87 Views

Hello George,

MKL LAPACK and ScaLAPACK implements a bit different algorithms (one is optimal for shared memory and another for distributed), so most likely results will be different due to round offs which happens in different order inside of algorithms.

Best recommendation is to check that matrices a numerically close to each other, like norm(A1-A2)/max(norm(A1),norm(A2))*size(A1)<C, where C is constant like 1.0E-14 (very accurate) or 1.0E-10(good enough) for double precision. Thus one do not need to rely on bitwise reproducibility, but will check actual mathematical properties. And this especially useful since variety of architectures and their properties will increase in future.

For validation purposes you also may try to use a matrix which doesn't require round offs to happen during computations, like one formed of integer numbers. Such a matrix with high portability will result bitwise same output, but there is still probability that after internal division a floating point number will appear which will later results a round off.

Best regards,

Alexander

Link Copied

3 Replies

Alexander_K_Intel3

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2015
04:43 AM

88 Views

Hello George,

MKL LAPACK and ScaLAPACK implements a bit different algorithms (one is optimal for shared memory and another for distributed), so most likely results will be different due to round offs which happens in different order inside of algorithms.

Best recommendation is to check that matrices a numerically close to each other, like norm(A1-A2)/max(norm(A1),norm(A2))*size(A1)<C, where C is constant like 1.0E-14 (very accurate) or 1.0E-10(good enough) for double precision. Thus one do not need to rely on bitwise reproducibility, but will check actual mathematical properties. And this especially useful since variety of architectures and their properties will increase in future.

For validation purposes you also may try to use a matrix which doesn't require round offs to happen during computations, like one formed of integer numbers. Such a matrix with high portability will result bitwise same output, but there is still probability that after internal division a floating point number will appear which will later results a round off.

Best regards,

Alexander

Georgios_S_

New Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2015
05:44 AM

87 Views

Hi Alexander,

thanks for the fine answer. Which is the mathematical property you mentioned (i.e. norm(A1-A2)/max(norm(A1),norm(A2))*size(A1)<C)? I mean, how it is called?

Best regards,

George

Alexander_K_Intel3

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-20-2015
05:07 AM

87 Views

It basically normalizes largest difference between two elements and compares it against machine precision. If the difference within last few bits these matrices could be treated as equal.

Best regards,

Alexander.

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

For more complete information about compiler optimizations, see our Optimization Notice.