Next: Range loops, Previous: Iterating, Up: Iterating [Contents][Index]
The simplest form of iteration in coNCePTuaL repeats a
<simple_stmt> a given number of times. In its most
basic form the syntax is simply “ FOR
<expr>
REPETITIONS
<simple_stmt>”. As
could be expected, the <expr> term (see Arithmetic
expressions) specifies the number of repetitions to perform.
Hence, the following <simple_stmt>
outputs the phrase “I will not talk in class” 100 times:
FOR 100 REPETITIONS ALL TASKS OUTPUT "I will not talk in class."
FOR
… REPETITIONS
can optionally
specify a number of “warmup” repetitions to perform in addition to
the base number of repetitions. The syntax is “ FOR
<expr>
REPETITIONS
PLUS
<expr>
WARMUP REPETITIONS
<simple_stmt>”.
During warmup repetitions, the OUTPUTS
statement (see Writing
to standard output), the LOGS
statement (see Writing to a log
file), and the COMPUTES AGGREGATES
statement (see Computing
aggregates) are all suppressed (i.e., they have no effect) and
none of the special variables predeclared by coNCePTuaL (see
Predeclared
variables) are updated. Many benchmarks synchronize all tasks
after performing a set of warmup repetitions. This behavior can be
expressed conveniently as part of a coNCePTuaL FOR
loop by
appending the AND A
SYNCHRONIZATION
clause:
FOR 1000 REPETITIONS PLUS 3 WARMUP REPETITIONS AND A SYNCHRONIZATION TASK 0 MULTICASTS A 1 MEGABYTE MESSAGE TO ALL OTHER TASKS
coNCePTuaL also provides a separate
SYNCHRONIZES
statement. This is described in Synchronizing.
The importance of performing warmup repetitions is that many communication layers give atypically poor performance on the first few transmissions. This may be because the messages miss in the cache; because the communication layer needs to establish connections between pairs of communicating tasks; or, because the operating system needs to “register” message buffers with the network interface. Regardless of the reason, specifying warmup repetitions helps make performance measurements less variable.
Next: Range loops, Previous: Iterating, Up: Iterating [Contents][Index]