Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
706 Discussions

Numeric stability across compiler versions and C++ standards

grantroch
Beginner
736 Views

Hello. We are upgrading our DPC++/C++ Compiler on Windows from 2023.2 to 2024.2 and C++ standard from 14 to 20 and wanted to understand what guarantees Intel makes around changes in versions and/or standards. Does Intel guarantee that numeric values across compiler versions but the same C++ standard will be the same or if there are differences these will be explicitly mentioned in the release notes? Further, what can one expect when upgrading the C++ standard from one version to another? Are there numeric differences expected in these cases? We've done a a couple experiments and found that keeping the standard at 14 and updating the compiler resulted in the same benchmarks, but changing the standard and the compiler resulted in different benchmarks. This suggests that the standard is driving the change but I wanted to check that understanding with the expectations around changing compiler and standard versions.

 

Regards,
Grant

0 Kudos
1 Solution
jcranmer
Employee
622 Views

When compiling with -ffp-model=fast (which is the default with the Intel compiler) or similar options, numerical consistency is generally not expected. To expect numerical consistency, you need to start by using a precise, consistent, or strict -ffp-model. Even with these options, factors such as the math library version or the specific hardware target may impact numerical consistency, and there are some subtle differences across language standard versions (particularly around C++ constexpr evaluation) that can affect results.

For a fuller discussion of numerical consistency, please read this detailed guide.

View solution in original post

0 Kudos
3 Replies
grantroch
Beginner
652 Views

I double-checked the analysis and found an error in how the first one was run. After correcting, the change in standard did not actually cause a change in numbers but the changing the compiler from 2023.2 to 2024.2 did. So that puts more weight on the open question about any guarantees on number stability across compiler changes. Any insight into this would be great.

 

Thanks

0 Kudos
jcranmer
Employee
623 Views

When compiling with -ffp-model=fast (which is the default with the Intel compiler) or similar options, numerical consistency is generally not expected. To expect numerical consistency, you need to start by using a precise, consistent, or strict -ffp-model. Even with these options, factors such as the math library version or the specific hardware target may impact numerical consistency, and there are some subtle differences across language standard versions (particularly around C++ constexpr evaluation) that can affect results.

For a fuller discussion of numerical consistency, please read this detailed guide.

0 Kudos
grantroch
Beginner
538 Views

Thank you @jcranmer. That is a helpful document.

0 Kudos
Reply