[Insight-developers] numerics code optimization issue
Simon Warfield
warfield at bwh.harvard.edu
Thu Aug 11 23:28:17 EDT 2005
It turns out that some of the calculations of numerical limits such as
machine precision in
Insight/Utilities/vxl/v3p/netlib/slamch.c and dlamch.c
are susceptible to failing when compiled with optimization on, as
would occur if you compile all of ITK in 'Release' mode.
The symptom I observed when I did this was test_qsvd entering an
infinite loop due to the calculation in
Insight/Utilities/vxl/v3p/netlib/slarfg.c around line 86-106 going bad.
The do { } while loop was not exiting due to the numerical issues.
I observed this issue when using the intel compiler, but other compilers
could also trigger it.
This issue is apparently well known as a google search turns up several
references e.g. http://web.mit.edu/lapack/www/faq.html 1.14 says:
> *NOTE:* Be careful. Many PC compilers often perform optimization by
> default at compile time! Thus, for routines such as
> LAPACK/SRC/slamch.f and LAPACK/SRC/dlamch.f, you will need to
> explicitly set a compile flag to turn OFF optimization.
I was wondering if it would be possible to have some kind of cmake rule
that would ensure that those special files are compiled not with the
flags for release mode but with regular flags.
Otherwise people would need to recognize the issue, go in and compile
those files specially without optimization, or else turn off high end
optimization for the rest of ITK.
--
Simon
More information about the Insight-developers
mailing list