@@ -69,12 +69,12 @@ use IO; // enable access to the readln() call that we use below
6969 performance mistake <common-loop-mistake>`.
7070
7171 Serial Loops
72- ============
72+ ------------
7373
7474 .. _While Loops:
7575
7676 While Loops
77- -----------
77+ ~~~~~~~~~~~
7878
7979 We'll start with Chapel's *while-loops*, which execute as long as a
8080 boolean condition remains true. While loops come in two forms, the
@@ -139,7 +139,7 @@ use IO; // enable access to the readln() call that we use below
139139 .. _For Loops:
140140
141141 For Loops
142- ---------
142+ ~~~~~~~~~
143143
144144 Chapel's other serial loop form is the *for-loop*. Here is a simple
145145 for-loop that iterates over the integers 1 through 3, inclusive:
@@ -214,7 +214,7 @@ use IO; // enable access to the readln() call that we use below
214214 .. _loops-arrs-doms:
215215
216216 Loops over Arrays and Domains
217- -----------------------------
217+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218218
219219 In addition to looping over ranges and explicit iterators, loops in
220220 Chapel are commonly used to iterate over arrays or domains (see the
@@ -278,7 +278,7 @@ use IO; // enable access to the readln() call that we use below
278278 .. _zip-iter:
279279
280280 Zippered For-Loops
281- ------------------
281+ ~~~~~~~~~~~~~~~~~~
282282
283283 For-loops also support *zippered* iteration, in which multiple
284284 iterand expressions are invoked in a coordinated manner, yielding
@@ -320,7 +320,7 @@ use IO; // enable access to the readln() call that we use below
320320 .. _param-for-loops:
321321
322322 Statically Varying (Unrolled) For-Loops
323- ---------------------------------------
323+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324324
325325 One last case to know about is that Chapel has a few for-loop forms
326326 that support the ability to have distinct static types or values per
@@ -356,7 +356,7 @@ use IO; // enable access to the readln() call that we use below
356356 This concludes this primer's introduction to Chapel's serial loop forms.
357357
358358 Parallel Loops
359- ==============
359+ --------------
360360
361361 Next, let's look at Chapel's parallel loop forms, all of which are
362362 written very similarly to the serial for-loops shown above, simply
@@ -381,7 +381,7 @@ use IO; // enable access to the readln() call that we use below
381381
382382
383383 Data-Parallel Loops
384- ===================
384+ -------------------
385385
386386 Data-parallel loops in Chapel can be thought of as indicating "the
387387 iterations of this loop can, and should, be performed in parallel."
@@ -404,7 +404,7 @@ use IO; // enable access to the readln() call that we use below
404404 .. _Foreach Loops:
405405
406406 Foreach Loops
407- -------------
407+ ~~~~~~~~~~~~~
408408
409409 The first, and simplest, data-parallel loop is the ``foreach`` loop.
410410 This loop form asserts that the loop meets the order-independent and
@@ -465,7 +465,7 @@ use IO; // enable access to the readln() call that we use below
465465 .. _Forall Loops:
466466
467467 Forall Loops
468- ------------
468+ ~~~~~~~~~~~~
469469
470470 Forall-loops are similar to foreach-loops, except that they have the
471471 potential to be implemented using multiple Chapel tasks. This
@@ -593,7 +593,7 @@ use IO; // enable access to the readln() call that we use below
593593 .. _Square-Bracket Loops:
594594
595595 Square-Bracket Loops
596- --------------------
596+ ~~~~~~~~~~~~~~~~~~~~
597597
598598 A third data-parallel loop form uses square brackets to define the
599599 loop instead of the ``foreach`` or ``forall`` keywords. For
@@ -621,7 +621,7 @@ use IO; // enable access to the readln() call that we use below
621621 .. _loops-promotion:
622622
623623 Promotion and Data-Parallel Loops
624- ---------------------------------
624+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
625625
626626 In Chapel, an operator or procedure accepting a formal argument of
627627 type ``t`` can be *promoted* by invoking the procedure with:
@@ -671,7 +671,7 @@ use IO; // enable access to the readln() call that we use below
671671 .. _race-conditions:
672672
673673 A final note on data-parallel loops and legality / races
674- --------------------------------------------------------
674+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
675675
676676 As mentioned previously, the Chapel compiler and language are not
677677 responsible for making sure that a data-parallel loop is safe to
@@ -757,14 +757,14 @@ use IO; // enable access to the readln() call that we use below
757757
758758
759759 Task-Parallel Loops
760- ===================
760+ -------------------
761761
762762 Chapel has a single task-parallel loop form, the ``coforall`` loop:
763763
764764 .. _Coforall Loops:
765765
766766 Coforall Loops
767- --------------
767+ ~~~~~~~~~~~~~~
768768
769769 In most respects, the coforall-loop is the simplest parallel loop
770770 form to explain in Chapel. It literally creates a distinct Chapel
@@ -827,7 +827,7 @@ use IO; // enable access to the readln() call that we use below
827827
828828
829829 Closing Discussions
830- ===================
830+ -------------------
831831
832832 At this point, you've learned about all of Chapel's loop forms. The
833833 remaining sections cover some loop-related topics that may come up
@@ -836,7 +836,7 @@ use IO; // enable access to the readln() call that we use below
836836 .. _loop-nests:
837837
838838 Nesting Loops
839- -------------
839+ ~~~~~~~~~~~~~
840840
841841 The loop forms discussed here can be nested arbitrarily, and their
842842 definitions are the same whether they are an outer or inner loop. A
@@ -921,7 +921,7 @@ use IO; // enable access to the readln() call that we use below
921921 .. _loop-choice:
922922
923923 When to Use Which Loop Form?
924- ----------------------------
924+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
925925
926926 Given these various loop forms, which ones should you use when?
927927
@@ -969,7 +969,7 @@ use IO; // enable access to the readln() call that we use below
969969 .. _common-loop-mistake:
970970
971971 A Common Performance Mistake
972- ----------------------------
972+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
973973
974974 Wrapping up, one of Chapel's most powerful features — the fact that
975975 forall loops can generate distributed memory parallelism in addition
@@ -1098,7 +1098,7 @@ use IO; // enable access to the readln() call that we use below
10981098 number of locales greater than the number of local cores.
10991099
11001100 Conclusion
1101- ==========
1101+ ----------
11021102
11031103 That wraps up this primer introducing Chapel's various loop types.
11041104 For further details, refer to the Chapel language specification
0 commit comments