[Users] Test case requiring strict floating point operation ordering

Ian Hinder ian.hinder at aei.mpg.de
Tue May 12 15:30:21 CDT 2015


Hi,

The test case test_local_interp_2 in LocalInterp2 is only supposed to pass if the compiler generates code strictly conforming to the ordering dictated by the parentheses in the source code.  While this is a part of the C standard, we usually don't insist on this, and use optimisation settings which allow the compiler to reorder expressions if it can be made faster.  In a test of the McLachlan RHSs that I did in 2013, I measured a 25% speed reduction from insisting on source-level operation ordering.  The ordering of the expressions in the source is usually not meaningful, so reordering does not make it less correct, physically-speaking.  The test_local_interp_2 test is specifically testing code which is designed to exactly reproduce symmetries, even including floating point roundoff, and so needs to have strict ordering of operations to be correct.

Given that we do not require this ordering in general, having a test which only passes when it is respected is problematic.

This raises the question of what to do about this test.  I see the following options:

1. Force the compiler to use strict ordering on that section of the code or that file (I don't know how to do this)
2. Disable the test when strict ordering is not available
3. Remove the test entirely
4. Allow the test to fail on machines whose optionlists do not respect IEEE semantics

in decreasing order of my own preference.

-- 
Ian Hinder
http://members.aei.mpg.de/ianhin



More information about the Users mailing list