NERSC logo National Energy Research Scientific Computing Center
  A DOE Office of Science User Facility
  at Lawrence Berkeley National Laboratory
 

-qstrict

The -qstrict option ensures that any optimization done will not alter the semantics of a program, and that the numeric results of a program will be identical with those produced by an unoptimized program. This option actually limits the amount of optimization done when it is included with any other optimization argument.

Specifically, optimizations that perform operations like these are not done:

  • Loads and floating-point computations that may trigger an exception.
  • Relaxing conformance to IEEE rules.
  • Reassociating floating-point expressions.

With this option, a strict computational order is observed based on the language rules for operator precedence and left to right operation regardless of the potential negative effect on performance.

The following example of the potentially inhibiting effects of this argument on optimization is taken from the IBM document "Power3 Introduction and Tuning Guide", SG24-5155-00, which is available at the IBM Documentation website.

When evaluating an expression like this:

      A*B*C + B*C*D

an optimized compile would recognize that B*C is a "common sub-expression" and evaluate it only once. However, if -qstrict is specified, this optimization would not be done, since that would violate the left to right ordering rule on A*B*C. Since floating point arithmetic is not associative there is no guarantee the results of (A*B)*C would be bitwise identical to those of A*(B*C).

In practice, we have observed that compiling with this argument rarely has a negative impact on the performance of a code. It can even be the case a code compiled with -qstrict is actually faster at run time than it was when compiled without this argument.


LBNL Home
Page last modified: Mon, 24 May 2004 19:26:15 GMT
Page URL: http://www.nersc.gov/nusers/resources/software/ibm/opt_options/strict.php
Web contact: webmaster@nersc.gov
Computing questions: consult@nersc.gov

Privacy and Security Notice
DOE Office of Science