Differences between revisions 1 and 2
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Describe MorphoOptimizationProjectConsistentSerialAlgorithms here. Parent: MorphoOptimizationProject

There are many reasons why source code compiled for and running on different platforms might not get the same result, even when single threaded.

 1. Floating point - compiler might chose a different binary pattern for a decimal number (unlikely), order of evaluation (likely), precision (using double for some intermediate results), implementation of functions such as asin or sqrt.
 1. Sorting algorithms - most sorting algorithms are not stable - items with equal keys may be sorted into either order.
 1. Random number generators - these are obviously unstable.

''Platform'' here refers to a combination of hardware, compiler version, compiler switches, libraries, and operating systems.

For our purposes we are mostly concerned with only changing the number of threads, which is discussed elsewhere [where?].

However we have seen differences between Linux and OSX caused by these kinds of issues, and we also see them when trying to replace one algorithm with a supposedly equivalent one.

=== Floating point operations ===
Most h/w these days uses IEEE floating, so that is not usually the problem.

Most numbers have an closest binary representation, and compilers are good at using it.

Order of evaluation is a big problem. This can change depending on compiler switches. Summing large numbers of floating point and switching between multiply-by-inverse and divide are both suspect.

Parent: MorphoOptimizationProject

There are many reasons why source code compiled for and running on different platforms might not get the same result, even when single threaded.

  1. Floating point - compiler might chose a different binary pattern for a decimal number (unlikely), order of evaluation (likely), precision (using double for some intermediate results), implementation of functions such as asin or sqrt.
  2. Sorting algorithms - most sorting algorithms are not stable - items with equal keys may be sorted into either order.
  3. Random number generators - these are obviously unstable.

Platform here refers to a combination of hardware, compiler version, compiler switches, libraries, and operating systems.

For our purposes we are mostly concerned with only changing the number of threads, which is discussed elsewhere [where?].

However we have seen differences between Linux and OSX caused by these kinds of issues, and we also see them when trying to replace one algorithm with a supposedly equivalent one.

Floating point operations

Most h/w these days uses IEEE floating, so that is not usually the problem.

Most numbers have an closest binary representation, and compilers are good at using it.

Order of evaluation is a big problem. This can change depending on compiler switches. Summing large numbers of floating point and switching between multiply-by-inverse and divide are both suspect.

MorphoOptimizationProjectConsistentSerialAlgorithms (last edited 2021-09-22 09:45:39 by DevaniCordero)