chapel-lang/chapel — pull request #1034 by thomasvandoren (2014-12-18 19:49:18+00:00)
Title: When OPTIMIZE!=1, use the -hdevelop feature on CCE.

From the CCE team:

If you compile with -hdevelop at our default optimization level (i.e. no
other command line options), then the compiler attempts the usual -O2
optimizations but throttles back some things that are known to increase
compile time. For example, we may run certain optimization passes once
instead of multiple times, we may take a fixed-point optimization and have
it loop once instead of two or three times, we may adjust thresholds of
heuristics, etc. These changes are targeted at reducing compile time
without affecting optimization quality in the majority of cases. The
-hdevelop option has a completely different philosophy than -O1 or -O0,
which do not run certain optimizations at all and are not specifically
intended to reduce compile time, although they may as side effect.

Basically -hdevelop is to be used in situations where you're compiling
frequently (i.e. developing), you want to reduce compile time, and either:

(A) Using -O0 or -O1 happens to increase compile time, which actually can
happen in some scenarios, since the compiler doesn't remove as much dead
code and spends a bunch of time analyzing and generating useless code.

-or-

(B) Using -O0 or -O1 caused your runtime performance to reduce
significantly. Presumably even if you are recompiling a lot, you
still run your code occasionally to make sure that it works correctly.
If the runtime increased so dramatically with -O0 or -O1 that it
overwhelmed your compile-time savings, then -O0 or -O1 didn't speedup
your development cycle.

### How much of a difference does -hdevelop make?

On a Cray system, using the quickstart configuration and CHPL_LAUCHER=none, using `-hdevelop` is ~20% faster when compiling `hello.chpl`.

I did this with master and this branch to get the above results:

```bash
git checkout
source util/quickstart/setchplenv.bash
export CHPL_LAUNCHER=none
make -j
make check # verify things work

# verify -hdevelop is present, or not
chpl --print-commands test/release/examples/hello.chpl
# -hdevelop should never be present with --fast
chpl --fast --print-commands test/release/examples/hello.chpl

# test it
for i in $(seq 1 5) ; do echo $i ; time chpl test/release/examples/hello.chpl ; done
```

For this branch, with -hdevelop, the real time for each of the compiles was 8.0 seconds (+/- some hundredths). For the master branch, without -hdevelop, the real time for each of the compiles was 9.8-10.3 seconds.

I did not test compile time for bigger codes or other configurations.