3 @c % /**-----------------------------------------------------------------**
5 @c % **-----------------------------------------------------------------**
7 @c % **-----------------------------------------------------------------**
8 @c % ** First version: july 6th 2002 **
9 @c % **-----------------------------------------------------------------**/
11 @c % release 1.0: September 17th 2002
12 @c % release 1.1: December 5th 2002
13 @c % release 1.2: April 22th 2003
14 @c % release 2.0: November 21th 2005 (and now in texinfo instead of LaTeX)
15 @c % release 2.1: October 15th 2007
17 @c %/**************************************************************************
18 @c % * CLooG : the Chunky Loop Generator (experimental) *
19 @c % **************************************************************************/
20 @c %/* CAUTION: the English used is probably the worst you ever read, please
21 @c % * feel free to correct and improve it !
24 @c %\textit{"I found the ultimate transformation functions, optimization for
25 @c %static control programs is now a closed problem, I have \textnormal{just}
26 @c %to generate the target code !"}
30 @c % /*************************************************************************
31 @c % * PART I: HEADER *
32 @c % *************************************************************************/
34 @setfilename cloog.info
35 @settitle CLooG - a loop generator for scanning polyhedra
38 @include gitversion.texi
39 @set UPDATED October 15th 2007
40 @setchapternewpage odd
44 @c % /*************************************************************************
45 @c % * PART II: SUMMARY DESCRIPTION AND COPYRIGHT *
46 @c % *************************************************************************/
49 This manual is for CLooG version @value{VERSION}, a software
50 which generates loops for scanning Z-polyhedra. That is, CLooG produces a
51 code visiting each integral point of a union of parametrized
52 polyhedra. CLooG is designed to avoid control overhead and to produce a very
55 It would be quite kind to refer the following paper in any publication that
56 results from the use of the CLooG software or its library:
59 @@InProceedings@{Bas04,
60 @ @ author =@ @ @ @ @{C. Bastoul@},
61 @ @ title =@ @ @ @ @ @{Code Generation in the Polyhedral Model
62 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ Is Easier Than You Think@},
63 @ @ booktitle = @{PACT'13 IEEE International Conference on
64 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ Parallel Architecture and Compilation Techniques@},
65 @ @ year =@ @ @ @ @ @ 2004,
66 @ @ pages =@ @ @ @ @ @{7--16@},
67 @ @ month =@ @ @ @ @ @{september@},
68 @ @ address =@ @ @ @{Juan-les-Pins@}
72 Copyright @copyright{} 2002-2005 C@'edric Bastoul.
75 Permission is granted to copy, distribute and/or modify this document under
76 the terms of the GNU Free Documentation License, Version 1.2
77 published by the Free Software Foundation. To receive a copy of the
78 GNU Free Documentation License, write to the Free Software Foundation, Inc.,
79 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
83 @c % /*************************************************************************
84 @c % * PART III: TITLEPAGE, CONTENTS, COPYRIGHT *
85 @c % *************************************************************************/
88 @subtitle A Loop Generator For Scanning Polyhedra
89 @subtitle Edition @value{EDITION}, for CLooG @value{VERSION}
90 @subtitle @value{UPDATED}
91 @author C@'edric Bastoul
93 @c The following two commands start the copyright page.
95 @noindent (September 2001)
97 @item C@'edric Bastoul
98 SCHEDULES GENERATE !!! I just need to apply them now, where can I find
99 a good code generator ?!
102 Hmmm. I fear that if you want something powerful enough, you'll have to
106 @vskip 0pt plus 1filll
110 @c Output the table of contents at the beginning.
113 @c % /*************************************************************************
114 @c % * PART IV: TOP NODE AND MASTER MENU *
115 @c % *************************************************************************/
135 @c % /*************************************************************************
136 @c % * PART V: BODY OF THE DOCUMENT *
137 @c % *************************************************************************/
139 @c % ****************************** INTRODUCTION ******************************
141 @chapter Introduction
142 CLooG is a free software and library generating loops for scanning Z-polyhedra.
143 That is, it finds a code (e.g. in C, FORTRAN...) that reaches each integral
144 point of one or more parameterized polyhedra. CLooG has been originally
145 written to solve the code generation problem for optimizing compilers based on
146 the polytope model. Nevertheless it is used now in various area, e.g., to build
147 control automata for high-level synthesis or to find the best polynomial
148 approximation of a function. CLooG may help in any situation where scanning
149 polyhedra matters. It uses the best state-of-the-art code generation
150 algorithm known as the Quiller@'e et al. algorithm (@pxref{Qui00})
151 with our own improvements and extensions (@pxref{Bas04}).
152 The user has full control on generated code quality.
153 On one hand, generated code size has to be tuned for sake of
154 readability or instruction cache use. On the other hand, we must ensure that
155 a bad control management does not hamper performance of the generated code,
156 for instance by producing redundant guards or complex loop bounds.
157 CLooG is specially designed to avoid control overhead and to produce a very
160 CLooG stands for @emph{Chunky Loop Generator}: it is a part of the Chunky
161 project, a research tool for data locality improvement (@pxref{Bas03a}).
163 also to be the back-end of automatic parallelizers like LooPo (@pxref{Gri04}).
165 compilable code oriented and provides powerful program transformation
166 facilities. Mainly, it allows the user to specify very general schedules where,
167 e.g., unimodularity or invertibility of the transformation doesn't matter.
169 The current version is still under
170 evaluation, and there is no guarantee that the upward compatibility
171 will be respected (but the previous API has been stable for two years,
172 we hope this one will be as successful -and we believe it-).
173 A lot of reports are necessary to freeze the library
174 API and the input file shape. Most API changes from 0.12.x to 0.14.x
175 have been requested by the users themselves.
176 Thus you are very welcome and encouraged
177 to post reports on bugs, wishes, critics, comments, suggestions or
178 successful experiences in the forum of @code{http://www.CLooG.org}
179 or to send them to cedric.bastoul@@inria.fr directly.
187 @section Basically, what's the point ?
188 If you want to use CLooG, this is because you want to scan or to find
189 something inside the integral points of a set of polyhedra. There are many
190 reasons for that. Maybe you need the generated code itself because it
191 actually implements a very smart program transformation you found.
192 Maybe you want to use the generated code
193 because you know that the solution of your problem belongs to the integral
194 points of those damned polyhedra and you don't know which one. Maybe you just
195 want to know if a polyhedron has integral points depending on some parameters,
196 which is the lexicographic minimum, maximum, the third on the basis of the
197 left etc. Probably you have your own reasons to use CLooG.
199 Let us illustrate a basic use of CLooG. Suppose we have a set of affine
200 constraints that describes a part of a whatever-dimensional space,
201 called a @strong{domain}, and we
202 want to scan it. Let us consider for instance the following set of constraints
204 and @samp{j} are the unknown (the two dimensions of the space) and
205 @samp{m} and @samp{n} are the parameters (some symbolic constants):
213 Let us also consider that we have a partial knowledge of the parameter values,
214 called the @strong{context}, expressed as affine constraints as well,
222 Note that using parameters is optional, if you are not comfortable with
223 parameter manipulation, just replace them with any scalar value that fits
224 @code{m>=2} and @code{n>=2}.
225 A graphical representation of this part of the 2-dimensional space, where
226 the integral points are represented using heavy dots would be for instance:
228 @image{images/basic,6cm}
230 The affine constraints of both the domain and the context are what we will
231 provide to CLooG as input (in a particular shape that will be described later).
232 The output of CLooG is a pseudo-code to scan the integral points of the
233 input domain according to the context:
236 for (i=2;i<=n;i++) @{
237 for (j=2;j<=min(m,-i+n+2);j++) @{
243 If you felt such a basic example is yet interesting, there is a good chance
244 that CLooG is appropriate for you. CLooG can do much more: scanning several
245 polyhedra or unions of polyhedra at the same time, applying general affine
246 transformations to the polyhedra, generate compilable code etc. Welcome
247 to the CLooG's user's guide !
250 @section Defining a Scanning Order: Scattering Functions
251 In CLooG, domains only define the set of integral points to scan and their
252 coordinates. In particular, CLooG is free to choose the scanning order for
253 generating the most efficient code. This means, for optimizing/parallelizing
254 compiler people, that CLooG doesn't make any speculation on dependences on and
255 between statements (by the way, it's not its job !).
256 For instance, if an user give to
257 CLooG only two domains @code{S1:1<=i<=n}, @code{S2:1<=i<=n} and the context
258 @code{n>=1}, the following pseudo-codes are considered to be equivalent:
262 /* A convenient target pseudo-code. */
263 for (i=1;i<=N;i++) @{
266 for (i=1;i<=N;i++) @{
274 /* Another convenient target pseudo-code. */
275 for (i=1;i<=N;i++) @{
282 The default behaviour
283 of CLooG is to generate the second one, since it is optimized in control.
284 It is right if there are no data dependences
285 between @code{S1} and @code{S2}, but wrong otherwise.
287 Thus it is often useful to force scanning to respect a given order. This can be
288 done in CLooG by using @strong{scattering functions}. Scattering is a
289 shortcut for scheduling, allocation, chunking functions and the like we can
290 find in the restructuring compilation literature. There are a lot of reasons
291 to scatter the integral points of the domains (i.e. the statement instances
292 of a program, for compilation people), parallelization or optimization are good
293 examples. For instance, if the user wants for any reason to set some
294 precedence constraints between the statements of our example above
295 in order to force the generation of the
296 first code, he can do it easily by setting (for example) the following
297 scheduling functions:
300 $$\theta _{S1}(i) = (1)$$
301 $$\theta _{S2}(j) = (2)$$
313 This scattering means that each integral point of the domain @code{S1}
314 is scanned at logical date @code{1} while each integral point of the domain
315 @code{S2} is scanned at logical date @code{2}. As a result, the whole
316 domain @code{S1} is scanned before domain @code{S2} and the first code in our
317 example is generated.
319 The user can set every kind of affine scanning order thanks to the
320 scattering functions. Each domain has its own scattering function and
321 each scattering function may be multi-dimensional. A multi-dimensional logical
322 date may be seen as classical date (year,month,day,hour,minute,etc.) where
323 the first dimensions are the most significant. Each scattering dimension
324 may depend linearly on the original dimensions (e.g., @code{i}), the
325 parameters (e.g., @code{n}) ans scalars (e.g., @code{2}).
327 A very useful example of multi-dimensional scattering functions is, for
328 compilation people, the scheduling of the original program.
329 The basic data to use for code generation are statement iteration domains.
330 As we saw, these data are not sufficient to rebuild the original
331 program (what is the ordering between instances of different statements ?).
332 The missing data can be put in the scattering functions as the original
333 scheduling. The method to compute it is quite simple (@pxref{Fea92}). The idea is to
334 build an abstract syntax tree of the program and to read the scheduling for
335 each statement. For instance, let us consider the following implementation of
336 a Cholesky factorization:
340 /* A Cholesky factorization kernel. */
341 for (i=1;i<=N;i++) @{
342 for (j=1;j<=i-1;j++) @{
343 a[i][i] -= a[i][j] ; /* S1 */
345 a[i][i] = sqrt(a[i][i]) ; /* S2 */
346 for (j=i+1;j<=N;j++) @{
347 for (k=1;k<=i-1;k++) @{
348 a[j][i] -= a[j][k]*a[i][k] ; /* S3 */
350 a[j][i] /= a[i][i] ; /* S4 */
357 The corresponding abstract syntax tree is given in the following figure.
358 It directly gives the scattering functions (schedules) for all the
359 statements of the program.
361 @image{images/tree,6cm}
365 \hbox{$ \cases{ \theta _{S1}(i,j)^T &$= (0,i,0,j,0)^T$\cr
366 \theta _{S2}(i) &$= (0,i,1)^T$\cr
367 \theta _{S3}(i,j,k)^T &$= (0,i,2,j,0,k,0)^T$\cr
368 \theta _{S4}(i,j)^T &$= (0,i,2,j,1)^T$}$}
375 T_S1(i,j)^T = (0,i,0,j,0)^T
377 T_S3(i,j,k)^T = (0,i,2,j,0,k,0)^T
378 T_S4(i,j)^T = (0,i,2,j,1)^T
383 These schedules depend on the iterators and give for each instance of each
384 statement a unique execution date. Using such scattering functions allow
385 CLooG to re-generate the input code.
391 @c % ***********************Using the CLooG Software **************************
393 @chapter Using the CLooG Software
398 * Writing The Input File::
404 @c %/*************************************************************************
405 @c % * A FIRST EXAMPLE *
406 @c % *************************************************************************/
407 @node A First Example
408 @section A First Example
409 CLooG takes as input a file that must be written accordingly to a grammar
410 described in depth in a further section (@pxref{Writing The Input File}).
411 Moreover it supports many options to tune the target code presentation or
412 quality as discussed in a dedicated section (@pxref{Calling CLooG}).
414 of CLooG is not very complex and we present in this section how to generate the
415 code corresponding to a basic example discussed earlier (@pxref{Basics}).
417 The problem is to find the code that scans a 2-dimensional polyhedron
418 where @samp{i} and @samp{j} are the unknown (the two dimensions of the space)
419 and @samp{m} and @samp{n} are the parameters (the symbolic constants),
420 defined by the following set of constraints:
428 @noindent We also consider a partial knowledge of the parameter values,
429 expressed thanks to the following affine constraints:
437 An input file that corresponds to this problem, and asks for a generated
438 code in C, may be the following. Note that we do not describe here precisely
439 the structure and the components of this file (@pxref{Writing The Input File}
440 for such information, if you feel it necessary):
443 # ---------------------- CONTEXT ----------------------
446 # Context (constraints on two parameters)
447 2 4 # 2 lines and 4 columns
448 # eq/in m n 1 eq/in: 1 for inequality >=0, 0 for equality =0
449 1 1 0 -2 # 1*m + 0*n -2*1 >= 0, i.e. m>=2
450 1 0 1 -2 # 0*m + 1*n -2*1 >= 0, i.e. n>=2
452 1 # We want to set manually the parameter names
453 m n # parameter names
455 # --------------------- STATEMENTS --------------------
456 1 # Number of statements
458 1 # First statement: one domain
460 5 6 # 5 lines and 6 columns
462 1 1 0 0 0 -2 # i >= 2
463 1 -1 0 0 1 0 # i <= n
464 1 0 1 0 0 -2 # j >= 2
465 1 0 -1 1 0 0 # j <= m
466 1 -1 -1 0 1 2 # n+2-i>=j
467 0 0 0 # for future options
469 1 # We want to set manually the iterator names
472 # --------------------- SCATTERING --------------------
473 0 # No scattering functions
476 This file may be called @samp{basic.cloog}
477 (this example is provided in the CLooG distribution as
478 @code{test/manual_basic.cloog}) and we can ask CLooG to process it
479 and to generate the code by a simple calling to CLooG with this file as input:
480 @samp{cloog basic.cloog}. By default, CLooG will print the generated code in
485 /* Generated by CLooG v@value{VERSION} in 0.00s. */
486 for (i=2;i<=n;i++) @{
487 for (j=2;j<=min(m,-i+n+2);j++) @{
494 @c %/*************************************************************************
496 @c % *************************************************************************/
497 @node Writing The Input File
498 @section Writing The Input File
499 The input text file contains a problem description, i.e. the context,
500 the domains and the scattering functions.
501 Because CLooG is very 'compilable code generation oriented', we can associate
502 some additional informations to each domain. We call this association a
503 @emph{statement}. The set of all informations is
504 called a @emph{program}. The input file respects the grammar below
505 (terminals are preceded by "_"):
509 Program ::= Context Statements Scattering
510 Context ::= Language Domain Naming
511 Statements ::= Nb_statements Statement_list Naming
512 Scattering ::= Nb_functions Domain_list Naming
513 Naming ::= Option Name_list
514 Name_list ::= _String Name_list | (void)
515 Statement_list ::= Statement Statement_list | (void)
516 Domain_list ::= _Domain Domain_list | (void)
517 Statement ::= Iteration_domain 0 0 0
518 Iteration_domain ::= Domain_union
519 Domain_union ::= Nb_domains Domain_list
522 Nb_statements ::= _Integer
523 Nb_domains ::= _Integer
524 Nb_functions ::= _Integer
528 @item @samp{Context} represents the informations that are
529 shared by all the statements. It consists on
530 the language used (which can be @samp{c} for C or @samp{f} for FORTRAN 90)
531 and the global constraints on parameters.
532 These constraints are essential
533 since they give to CLooG the number of parameters. If there is no
534 parameter or no constraints on parameters, just give a constraint
535 always satisfied like @math{1 \geq 0}. @samp{Naming} sets the parameter
537 If the naming option @samp{Option} is 1, parameter names will be read
538 on the next line. There must be exactly as many names as parameters.
539 If the naming option @samp{Option} is 0, parameter names are
540 automatically generated. The name of the first parameter will
541 be @samp{M}, and the name of the @math{(n+1)^{th}} parameter directly
542 follows the name of the @math{n^{th}} parameter in ASCII code.
543 It is the user responsibility to ensure that parameter names,
544 iterators and scattering dimension names are different.
545 @item @samp{Statements} represents the informations on the statements.
546 @samp{Nb_statements} is the number of statements in the program,
547 i.e. the number of @samp{Statement} items in the @samp{Statement_list}.
548 @samp{Statement} represents the informations on a given statement.
549 To each statement is associated a domain
550 (the statement iteration domain: @samp{Iteration_domain}) and three
551 zeroes that represents future options.
552 @samp{Naming} sets the iterator names. If the naming option
553 @samp{Option} is 1, the iterator names
554 will be read on the next line. There must be exactly as many names as
555 nesting level in the deepest iteration domain. If the naming option
556 @samp{Option} is 0, iterator names are automatically generated.
557 The iterator name of the outermost loop will be @samp{i}, and the
558 iterator name of the loop at level @math{n+1} directly follows the
559 iterator name of the loop at level @math{n} in ASCII code.
560 @item @samp{Scattering} represents the informations on scattering functions.
561 @samp{Nb_functions} is the number of functions (it must be
562 equal to the number of statements or 0 if there is no scattering
563 function). The function themselves are represented through
565 @samp{Naming} sets the scattering dimension names. If the naming option
566 @samp{Option} is 1, the scattering dimension names will be read on the
568 There must be exactly as many names as scattering dimensions. If the
569 naming option @samp{Option} is 0, scattering dimension names are automatically
570 generated. The name of the @math{n^{th}} scattering dimension
575 * Domain Representation::
576 * Scattering Representation::
579 @node Domain Representation
580 @subsection Domain Representation
581 As shown by the grammar, the input file describes the various informations
582 thanks to characters, integers and domains. Each domain is defined by a set of
583 constraints in the PolyLib format (@pxref{Wil93}). They have the
586 @item some optional comment lines beginning with @samp{#},
587 @item the row and column numbers, possibly followed by comments,
588 @item the constraint rows, each row corresponds to a constraint the
589 domain have to satisfy. Each row must be on a single line and is possibly
590 followed by comments. The constraint is an equality @math{p(x) = 0} if the
591 first element is 0, an inequality @math{p(x) \geq 0} if the first element
592 is 1. The next elements are the unknown coefficients, followed by
593 the parameter coefficients. The last element is the constant factor.
595 For instance, assuming that @samp{i}, @samp{j} and @samp{k} are iterators and
596 @samp{m} and @samp{n} are parameters, the domain defined by the following
601 \hbox{$ \cases{ -i + m &$\geq 0$\cr
603 i + j - k &$\geq 0$}$}
617 @noindent can be written in the input file as follows :
622 3 7 # 3 lines and 7 columns
624 1 -1 0 0 1 0 0 # -i + m >= 0
625 1 0 -1 0 0 1 0 # -j + n >= 0
626 1 1 1 -1 0 0 0 # i + j - k >= 0
630 Each iteration domain @samp{Iteration_domain} of a given statement
631 is a union of polyhedra
632 @samp{Domain_union}. A union is defined by its number of elements
633 @samp{Nb_domains} and the elements themselves @samp{Domain_list}.
634 For instance, let us consider the following pseudo-code:
638 for (i=1;i<=n;i++) @{
639 if ((i >= m) || (i <= 2*m))
647 @noindent The iteration domain of @samp{S1} can be divided into two
648 polyhedra and written in the input file as follows:
652 2 # Number of polyhedra in the union
654 3 5 # 3 lines and 5 columns
660 3 5 # 3 lines and 5 columns
664 1 -1 2 0 0 # i <= 2*m
668 @node Scattering Representation
669 @subsection Scattering Function Representation
670 Scattering functions are depicted in the input file thanks a representation
671 very close to the domain one.
672 An integer gives the number of functions @samp{Nb_functions} and each function
673 is represented by a domain. Each line of the domain corresponds to an equality
674 defining a dimension of the function. Note that at present
675 (CLooG @value{VERSION})
676 @strong{all functions must have the same scattering dimension number}. If a
677 user wants to set scattering functions with different dimensionality, he has
678 to complete the smaller one with zeroes to reach the maximum dimensionality.
679 For instance, let us consider the following code and
680 scheduling functions:
684 for (i=1;i<=n;i++) @{
685 if ((i >= m) || (i <= 2*m))
695 \hbox{$ \cases{ \theta _{S1}(i) &$= (i,0)^T$\cr
696 \theta _{S2}(i,j)^T &$= (n,i+j)^T$}$}
704 T_S2(i,j)^T = (n,i+j)^T
710 @noindent This scheduling can be written in the input file as follows:
714 2 # Number of scattering functions
716 2 7 # 2 lines and 7 columns
717 # eq/in c1 c2 i m n 1
718 0 1 0 -1 0 0 0 # c1 = i
719 0 0 1 0 0 0 0 # c2 = 0
721 2 8 # 2 lines and 8 columns
722 # eq/in c1 c2 i j m n 1
723 0 1 0 0 0 0 -1 0 # c1 = n
724 0 0 1 -1 -1 0 0 0 # c2 = i+j
727 The complete input file for the user who wants to generate the code for this
728 example with the preceding scheduling would be
729 (this file is provided in the CLooG distribution
730 as @code{test/manual_scattering.cloog}:
733 # ---------------------- CONTEXT ----------------------
736 # Context (no constraints on two parameters)
737 1 4 # 1 lines and 4 columns
739 1 0 0 0 # 0 >= 0, always true
741 1 # We want to set manually the parameter names
742 m n # parameter names
744 # --------------------- STATEMENTS --------------------
745 2 # Number of statements
747 2 # First statement: two domains
749 3 5 # 3 lines and 5 columns
755 3 5 # 3 lines and 5 columns
759 1 -1 2 0 0 # i <= 2*m
760 0 0 0 # for future options
762 1 # Second statement: one domain
763 4 6 # 4 lines and 6 columns
765 1 1 0 0 0 -1 # i >= 1
766 1 -1 0 0 1 0 # i <= n
767 1 -1 1 0 0 -1 # j >= i+1
768 1 0 -1 1 0 0 # j <= m
769 0 0 0 # for future options
771 1 # We want to set manually the iterator names
774 # --------------------- SCATTERING --------------------
775 2 # Scattering functions
777 2 7 # 2 lines and 7 columns
778 # eq/in p1 p2 i m n 1
779 0 1 0 -1 0 0 0 # p1 = i
780 0 0 1 0 0 0 0 # p2 = 0
782 2 8 # 2 lines and 8 columns
783 # eq/in p1 p2 i j m n 1
784 0 1 0 0 0 0 -1 0 # p1 = n
785 0 0 1 -1 -1 0 0 0 # p2 = i+j
787 1 # We want to set manually the scattering dimension names
788 p1 p2 # scattering dimension names
792 @c %/*************************************************************************
793 @c % * Calling CLooG *
794 @c % *************************************************************************/
796 @section Calling CLooG
797 CLooG is called by the following command:
799 cloog [ options | file ]
801 The default behavior of CLooG is to read the input informations from a file and
802 to print the generated code or pseudo-code on the standard output.
803 CLooG's behavior and the output code shape is under the user control thanks
804 to many options which are detailed a further section (@pxref{CLooG Options}).
805 @code{file} is the input file. @code{stdin} is a special value: when used,
806 input is standard input. For instance, we can call CLooG to treat the
807 input file @code{basic.cloog} with default options by typing:
808 @code{cloog basic.cloog} or @code{more basic.cloog | cloog stdin}.
810 @c %/*************************************************************************
811 @c % * CLooG Options *
812 @c % *************************************************************************/
814 @section CLooG Options
817 * Last Depth to Optimize Control::
818 * First Depth to Optimize Control::
819 * Simplify Convex Hull::
820 * Once Time Loop Elimination::
821 * Equality Spreading::
822 * First Level for Spreading::
832 @node Last Depth to Optimize Control
833 @subsection Last Depth to Optimize Control @code{-l <depth>}
835 @code{-l <depth>}: this option sets the last loop depth to be optimized in
836 control. The higher this depth, the less control overhead.
837 For instance, with some input file, a user can generate
838 different pseudo-codes with different @code{depth} values as shown below.
841 /* Generated using a given input file and @strong{option -l 1} */
842 for (i=0;i<=M;i++) @{
844 for (j=0;j<=N;j++) @{
847 for (j=0;j<=N;j++) @{
856 /* Generated using the same input file but @strong{option -l 2} */
857 for (i=0;i<=M;i++) @{
859 for (j=0;j<=N;j++) @{
867 In this example we can see that this option can change the operation
868 execution order between statements. Let us remind that CLooG does not
869 make any speculation on dependences between statements
870 (@pxref{Scattering}). Thus if nothing (i.e. scattering functions)
871 forbids this, CLooG considers the above codes to be equivalent.
872 If there is no scattering functions, the minimum value for @code{depth}
873 is 1 (in the case of 0, the user doesn't really need a loop generator !),
874 and the number of scattering dimensions otherwise (CLooG will warn the
875 user if he doesn't respect such constraint).
876 The maximum value for depth is -1 (infinity).
877 Default value is infinity.
879 @node First Depth to Optimize Control
880 @subsection First Depth to Optimize Control @code{-f <depth>}
882 @code{-f <depth>}: this option sets the first loop depth to be optimized
883 in control. The lower this depth, the less control overhead (and the longer
884 the generated code). For instance, with some input file, a user
885 can generate different pseudo-codes with different @code{depth} values
887 The minimum value for @code{depth} is 1, and the
888 maximum value is -1 (infinity).
892 /* Generated using a given input file and @strong{option -f 3} */
893 for (i=1;i<=N;i++) @{
894 for (j=1;j<=M;j++) @{
905 /* Generated using the same input file but @strong{option -f 2} */
906 for (i=1;i<=N;i++) @{
907 for (j=1;j<=9;j++) @{
910 for (j=10;j<=M;j++) @{
918 @node Simplify Convex Hull
919 @subsection Simplify Convex Hull @code{-sh <boolean>}
921 @code{-sh <boolean>}: this option enables (@code{boolean=1})
922 or forbids (@code{boolean=0}) a simplification step
923 that may simplify some constraints.
924 This option works only for generated code without
925 code duplication (it means, you have to tune @code{-f} and
926 @code{-l} options first to generate only a loop nest with internal
927 guards). For instance, with the input file @code{test/union.cloog}, a user
928 can generate different pseudo-codes as shown below.
932 /* Generated using test/union.cloog and @strong{option -f -1 -l 2 -override} */
933 for (i=0;i<=11;i++) @{
934 for (j=max(0,5*i-50);j<=min(15,5*i+10);j++) @{
935 if ((i <= 10) && (j <= 10)) @{
938 if ((i >= 1) && (j >= 5)) @{
947 /* Generated using the same input file but @strong{option -sh 1 -f -1 -l 2 -override} */
948 for (i=0;i<=11;i++) @{
949 for (j=0;j<=15;j++) @{
950 if ((i <= 10) && (j <= 10)) @{
953 if ((i >= 1) && (j >= 5)) @{
961 @node Once Time Loop Elimination
962 @subsection Once Time Loop Elimination @code{-otl <boolean>}
964 @code{-otl <boolean>}: this option allows (@code{boolean=1}) or
965 forbids (@code{boolean=0}) the simplification of loops running
966 once. Default value is 1.
969 /* Generated using a given input file and @strong{option -otl 0} */
970 for (j=i+1;j<=i+1;j++) @{
977 /* Generated using the same input file but @strong{option -otl 1} */
984 @node Equality Spreading
985 @subsection Equality Spreading @code{-esp <boolean>}
987 @code{-esp <boolean>}: this option allows (@code{boolean=1}) or
988 forbids (@code{boolean=0}) values spreading when there
989 are equalities. Default value is 1.
992 /* Generated using a given input file and @strong{option -esp 0} */
995 for (k=i;k<=j+M;k++) @{
1002 /* Generated using the same input file but @strong{option -esp 1} */
1003 for (k=M+2;k<=N+M;k++) @{
1004 S1(i = M+2, j = N) ;
1010 @node First Level for Spreading
1011 @subsection First Level for Spreading @code{-fsp <level>}
1013 @code{-fsp <level>}: it can be useful to set a
1014 first level to begin equality spreading. Particularly when using
1015 scattering functions, the user may want to see the scattering dimension
1016 values instead of spreading or hiding them. If user has set a
1017 spreading, @code{level} is
1018 the first level to start it. Default value is 1.
1021 /* Generated using a given input file and @strong{option -fsp 1} */
1022 for (j=0;j<=N+M;j++) @{
1025 for (j=0;j<=N+M;j++) @{
1032 /* Generated using the same input file but @strong{option -fsp 2} */
1034 for (j=0;j<=c1+M;j++) @{
1038 for (j=0;j<=N+c1;j++) @{
1045 @node Statement Block
1046 @subsection Statement Block @code{-block <boolean>}
1048 @code{-block <boolean>}: this option allows (@code{boolean=1}) to
1049 create a statement block for each new iterator, even if there is only
1050 an equality. This can be useful in order to parse the generated
1051 pseudo-code. When @code{boolean} is set to 0 or when the generation
1052 language is FORTRAN, this feature is disabled. Default value is 0.
1055 /* Generated using a given input file and @strong{option -block 0} */
1063 /* Generated using the same input file but @strong{option -block 1} */
1074 @subsection Loop Strides @code{-strides <boolean>}
1076 @code{-strides <boolean>}: this options allows (@code{boolean=1}) to
1077 handle non-unit strides for loop increments. This can remove a lot of
1078 guards and make the generated code more efficient. Default value is 0.
1081 /* Generated using a given input file and @strong{option -strides 0} */
1082 for (i=1;i<=n;i++) @{
1094 /* Generated using the same input file but @strong{option -strides 1} */
1095 for (i=2;i<=n;i+=2) @{
1104 @node Compilable Code
1105 @subsection Compilable Code @code{-compilable <value>}
1107 @code{-compilable <value>}: this options allows (@code{value} is not 0)
1108 to generate a compilable code where all parameters have the integral value
1109 @code{value}. This option creates a macro for each statement. Since
1110 CLooG do not know anything about the statement sources, it fills the
1111 macros with a basic increment that computes the total number of
1112 scanned integral points. The user may change easily the macros according
1113 to his own needs. This option is possible only if the generated code is
1114 in C. Default value is 0.
1117 /* Generated using a given input file and @strong{option -compilable 0} */
1118 for (i=0;i<=n;i++) @{
1119 for (j=0;j<=n;j++) @{
1128 /* Generated using the same input file but @strong{option -compilable 10} */
1129 /* DON'T FORGET TO USE -lm OPTION TO COMPILE. */
1131 /* Useful headers. */
1136 /* Parameter value. */
1139 /* Statement macros (please set). */
1140 #define S1(i,j) @{total++;@}
1141 #define S2(i,j) @{total++;@}
1142 #define S3(i) @{total++;@}
1145 /* Original iterators. */
1148 int n=PARVAL, total=0 ;
1150 for (i=0;i<=n;i++) @{
1151 for (j=0;j<=n;j++) @{
1158 printf("Number of integral points: %d.\n",total) ;
1164 @subsection Callable Code @code{-callable <boolean>}
1166 @code{-callable <boolean>}: if @code{boolean=1}, then a @code{test}
1167 function will be generated that has the parameters as arguments.
1168 Similarly to the @code{-compilable} option,
1169 a macro for each statement is generated. The generated definitions of
1170 these macros are as used during the correctness testing, but they
1171 can easily be changed by the user to suit her own needs.
1172 This option is only available if the target language is C.
1173 The default value is 0.
1176 /* Generated from double.cloog with @strong{option -callable 0} */
1177 for (i=0;i<=M;i++) @{
1179 for (j=0;j<=N;j++) @{
1187 /* Generated from double.cloog with @strong{option -callable 1} */
1188 extern void hash(int);
1190 /* Useful macros. */
1191 #define floord(n,d) (((n)<0) ? ((n)-(d)+1)/(d) : (n)/(d))
1192 #define ceild(n,d) (((n)<0) ? (n)/(d) : ((n)+(d)+1)/(d))
1193 #define max(x,y) ((x) > (y) ? (x) : (y))
1194 #define min(x,y) ((x) < (y) ? (x) : (y))
1196 #define S1(i) @{ hash(1); hash(i); @}
1197 #define S2(i,j) @{ hash(2); hash(i); hash(j); @}
1198 #define S3(i,j) @{ hash(3); hash(i); hash(j); @}
1199 #define S4(i) @{ hash(4); hash(i); @}
1201 void test(int M, int N)
1203 /* Original iterators. */
1205 for (i=0;i<=M;i++) @{
1207 for (j=0;j<=N;j++) @{
1217 @subsection Output @code{-o <output>}
1219 @code{-o <output>}: this option sets the output file. @code{stdout} is a
1220 special value: when used, output is standard output.
1221 Default value is @code{stdout}.
1224 @subsection Help @code{--help} or @code{-h}
1226 @code{--help} or @code{-h}: this option ask CLooG to print a short help.
1229 @subsection Version @code{--version} or @code{-v}
1231 @code{--version} or @code{-v}: this option ask CLooG to print some version
1235 @subsection Quiet @code{--quiet} or @code{-q}
1237 @code{--quiet} or @code{-q}: this option tells CLooG not to print
1238 any informational messages.
1241 @c %/*************************************************************************
1242 @c % * A Full Example *
1243 @c % *************************************************************************/
1245 @section A Full Example
1247 Let us consider the allocation problem of a Gaussian elimination, i.e. we want
1248 to distribute the various statement instances of the compute kernel onto
1249 different processors. The original code is the following:
1252 for (i=1;j<=N-1;i++) @{
1253 for (j=i+1;j<=N;j++) @{
1254 c[i][j] = a[j][i]/a[i][i] ; /* S1 */
1255 for (k=i+1;k<=N;k++) @{
1256 a[j][k] -= c[i][j]*a[i][k] ; /* S2 */
1263 @noindent The best affine allocation functions can be found by any good automatic
1264 parallelizer like LooPo (@pxref{Gri04}):
1268 \hbox{$ \cases{ \theta _{S1}(i,j)^T &$= (i)$\cr
1269 \theta _{S2}(i,j,k)^T &$= (k)$}$}
1282 @noindent To ensure that on each processor, the set of statement instances is
1283 executed according to the original ordering, we add as minor scattering
1284 dimensions the original scheduling (@pxref{Scattering}):
1288 \hbox{$ \cases{ \theta _{S1}(i,j)^T &$= (i,0,i,0,j,0)^T$\cr
1289 \theta _{S2}(i,j,k)^T &$= (k,0,i,0,j,1,k,0)^T$}$}
1296 T_S1(i,j)^T = (i,0,i,0,j,0)^T
1297 T_S2(i,j,k)^T = (k,0,i,0,j,1,k,0)^T
1302 @noindent To ensure that the scattering functions have the same dimensionality, we
1303 complete the first function with zeroes
1304 (this is a CLooG @value{VERSION} and previous versions requirement,
1305 it should be removed in a future version, don't worry it's absolutely legal !):
1309 \hbox{$ \cases{ \theta _{S1}(i,j)^T &$= (i,0,i,0,j,0,0,0)^T$\cr
1310 \theta _{S2}(i,j,k)^T &$= (k,0,i,0,j,1,k,0)^T$}$}
1317 T_S1(i,j)^T = (i,0,i,0,j,0,0,0)^T
1318 T_S2(i,j,k)^T = (k,0,i,0,j,1,k,0)^T
1323 @noindent The input file corresponding to this code generation problem
1324 could be (this file is provided in the CLooG distribution
1325 as @code{test/manual_gauss.cloog}:
1328 # ---------------------- CONTEXT ----------------------
1331 # Context (no constraints on one parameter)
1332 1 3 # 1 line and 3 columns
1334 1 0 0 # 0 >= 0, always true
1336 1 # We want to set manually the parameter name
1339 # --------------------- STATEMENTS --------------------
1340 2 # Number of statements
1342 1 # First statement: one domain
1343 4 5 # 4 lines and 3 columns
1346 1 -1 0 1 -1 # i <= n-1
1347 1 -1 1 0 -1 # j >= i+1
1349 0 0 0 # for future options
1352 # Second statement: one domain
1353 6 6 # 6 lines and 3 columns
1355 1 1 0 0 0 -1 # i >= 1
1356 1 -1 0 0 1 -1 # i <= n-1
1357 1 -1 1 0 0 -1 # j >= i+1
1358 1 0 -1 0 1 0 # j <= n
1359 1 -1 0 1 0 -1 # k >= i+1
1360 1 0 0 -1 1 0 # k <= n
1361 0 0 0 # for future options
1363 0 # We let CLooG set the iterator names
1365 # --------------------- SCATTERING --------------------
1366 2 # Scattering functions
1368 8 13 # 3 lines and 3 columns
1369 # eq/in p1 p2 p3 p4 p5 p6 p7 p8 i j n 1
1370 0 1 0 0 0 0 0 0 0 -1 0 0 0 # p1 = i
1371 0 0 1 0 0 0 0 0 0 0 0 0 0 # p2 = 0
1372 0 0 0 1 0 0 0 0 0 -1 0 0 0 # p3 = i
1373 0 0 0 0 1 0 0 0 0 0 0 0 0 # p4 = 0
1374 0 0 0 0 0 1 0 0 0 0 -1 0 0 # p5 = j
1375 0 0 0 0 0 0 1 0 0 0 0 0 0 # p6 = 0
1376 0 0 0 0 0 0 0 1 0 0 0 0 0 # p7 = 0
1377 0 0 0 0 0 0 0 0 1 0 0 0 0 # p8 = 0
1379 8 14 # 3 lines and 3 columns
1380 # eq/in p1 p2 p3 p4 p5 p6 p7 p8 i j k n 1
1381 0 1 0 0 0 0 0 0 0 0 0 -1 0 0 # p1 = k
1382 0 0 1 0 0 0 0 0 0 0 0 0 0 0 # p2 = 0
1383 0 0 0 1 0 0 0 0 0 -1 0 0 0 0 # p3 = i
1384 0 0 0 0 1 0 0 0 0 0 0 0 0 0 # p4 = 0
1385 0 0 0 0 0 1 0 0 0 0 -1 0 0 0 # p5 = j
1386 0 0 0 0 0 0 1 0 0 0 0 0 0 -1 # p6 = 1
1387 0 0 0 0 0 0 0 1 0 0 0 -1 0 0 # p7 = k
1388 0 0 0 0 0 0 0 0 1 0 0 0 0 0 # p8 = 0
1390 1 # We want to set manually the scattering dimension names
1391 p1 p2 p3 p4 p5 p6 p7 p8 # scattering dimension names
1394 Calling CLooG, with for instance the command line
1395 @code{cloog -fsp 2 gauss.cloog} for a better view
1396 of the allocation (the processor number is given by @code{p1}),
1397 will result on the following target code that actually implements
1398 the transformation. A minor processing on the dimension @code{p1}
1399 to implement, e.g., MPI calls, which is not shown here may
1400 result in dramatic speedups !
1405 for (p5=2;p5<=n;p5++) @{
1409 for (p1=2;p1<=n-1;p1++) @{
1410 for (p3=1;p3<=p1-1;p3++) @{
1411 for (p5=p3+1;p5<=n;p5++) @{
1412 S2(i = p3,j = p5,k = p1) ;
1415 for (p5=p1+1;p5<=n;p5++) @{
1421 for (p3=1;p3<=n-1;p3++) @{
1422 for (p5=p3+1;p5<=n;p5++) @{
1423 S2(i = p3,j = p5,k = n) ;
1430 @c %/*************************************************************************
1431 @c % * A Full Example *
1432 @c % *************************************************************************/
1434 @chapter Using the CLooG Library
1435 The CLooG Library was implemented to allow the user to call CLooG
1436 directly from his programs, without file accesses or system calls. The
1437 user only needs to link his programs with C libraries. The CLooG
1438 library mainly provides one function (@code{cloog_clast_create_from_input})
1439 which takes as input the problem
1440 description with some options, and returns the data structure corresponding
1441 to the generated code (a @code{struct clast_stmt} structure)
1442 which is more or less an abstract syntax tree.
1443 The user can work with this data structure and/or use
1444 our pretty printing function to write the final code in either C or FORTRAN.
1445 Some other functions are provided for convenience reasons.
1446 These functions as well as the data structures are described in this section.
1449 * CLooG Data Structures::
1451 * Example of Library Utilization::
1455 @node CLooG Data Structures
1456 @section CLooG Data Structures Description
1457 In this section, we describe the data structures used by the loop
1458 generator to represent and to process a code generation problem.
1465 * CloogUnionDomain::
1473 @subsection CloogState
1476 CloogState *cloog_state_malloc(void);
1477 void cloog_state_free(CloogState *state);
1481 @noindent The @code{CloogState} structure is (implicitly) needed to perform
1482 any CLooG operation. It should be created using @code{cloog_state_malloc}
1483 before any other CLooG objects are created and destroyed using
1484 @code{cloog_state_free} after all objects have been freed.
1485 It is allowed to use more than one @code{CloogState} structure at
1486 the same time, but an object created within the state of a one
1487 @code{CloogState} structure is not allowed to interact with an object
1488 created within the state of an other @code{CloogState} structure.
1492 @subsection CloogMatrix
1494 @noindent The @code{CloogMatrix} structure is equivalent to the PolyLib
1495 @code{Matrix} data structure (@pxref{Wil93}). This structure is devoted to
1496 represent a set of constraints.
1501 @{ unsigned NbRows ; /* Number of rows. */
1502 unsigned NbColumns ; /* Number of columns. */
1503 cloog_int_t **p; /* Array of pointers to the matrix rows. */
1504 cloog_int_t *p_Init; /* Matrix rows contiguously in memory. */
1506 typedef struct cloogmatrix CloogMatrix;
1508 CloogMatrix *cloog_matrix_alloc(unsigned NbRows, unsigned NbColumns);
1509 void cloog_matrix_print(FILE *foo, CloogMatrix *m);
1510 void cloog_matrix_free(CloogMatrix *matrix);
1514 @noindent The whole matrix is stored in memory row after row at the
1515 @code{p_Init} address. @code{p} is an array of pointers where
1516 @code{p[i]} points to the first element of the @math{i^{th}} row.
1517 @code{NbRows} and @code{NbColumns} are respectively the number of
1518 rows and columns of the matrix.
1519 Each row corresponds to a constraint. The first element of each row is an
1520 equality/inequality tag. The
1521 constraint is an equality @math{p(x) = 0} if the first element is 0, but it is
1522 an inequality @math{p(x) \geq 0} if the first element is 1.
1523 The next elements are the coefficients of the unknowns,
1524 followed by the coefficients of the parameters, and finally the constant term.
1525 For instance, the following three constraints:
1529 \hbox{$ \cases{ -i + m &$= 0$\cr
1531 j + i - k &$\geq 0$}$}
1545 @noindent would be represented by the following rows:
1549 # eq/in i j k m n cst
1556 @noindent To be able to provide different precision version (CLooG
1557 supports 32 bits, 64 bits and arbitrary precision through the GMP library),
1558 the @code{cloog_int_t} type depends on the configuration options (it may be
1559 @code{long int} for 32 bits version, @code{long long int} for 64 bits version,
1560 and @code{mpz_t} for multiple precision version).
1563 @subsection CloogDomain
1566 CloogDomain *cloog_domain_union_read(CloogState *state,
1567 FILE *input, int nb_parameters);
1568 CloogDomain *cloog_domain_from_cloog_matrix(CloogState *state,
1569 CloogMatrix *matrix, int nb_par);
1570 void cloog_domain_free(CloogDomain *domain);
1574 @noindent @code{CloogDomain} is an opaque type representing a polyhedral
1575 domain (a union of polyhedra).
1576 A @code{CloogDomain} can be read
1577 from a file using @code{cloog_domain_union_read} or
1578 converted from a @code{CloogMatrix}.
1579 The input format for @code{cloog_domain_union_read}
1580 is that of @ref{Domain Representation}.
1581 The function @code{cloog_domain_from_cloog_matrix} takes a @code{CloogState}, a
1582 @code{CloogMatrix} and @code{int} as input and returns a pointer to a
1583 @code{CloogDomain}. @code{matrix} describes the domain and @code{nb_par} is the
1584 number of parameters in this domain. The input data structures are neiter
1586 The @code{CloogDomain} can be freed using @code{cloog_domain_free}.
1587 There are also some backend dependent functions for creating
1588 @code{CloogDomain}s.
1591 * CloogDomain/PolyLib::
1595 @node CloogDomain/PolyLib
1596 @subsubsection PolyLib
1599 #include <cloog/polylib/cloog.h>
1600 CloogDomain *cloog_domain_from_polylib_polyhedron(CloogState *state,
1601 Polyhedron *, int nb_par);
1604 The function @code{cloog_domain_from_polylib_polyhedron} takes a PolyLib
1605 @code{Polyhedron} as input and returns a pointer to a @code{CloogDomain}.
1606 The @code{nb_par} parameter indicates the number of parameters
1607 in the domain. The input data structure if neither modified nor freed.
1609 @node CloogDomain/isl
1613 #include <cloog/isl/cloog.h>
1614 CloogDomain *cloog_domain_from_isl_set(struct isl_set *set);
1617 The function @code{cloog_domain_from_isl_set} takes a
1618 @code{struct isl_set} as input and returns a pointer to a @code{CloogDomain}.
1619 The function consumes a reference to the given @code{struct isl_set}.
1622 @node CloogScattering
1623 @subsection CloogScattering
1626 CloogScattering *cloog_domain_read_scattering(CloogDomain *domain,
1628 CloogScattering *cloog_scattering_from_cloog_matrix(CloogState *state,
1629 CloogMatrix *matrix, int nb_scat, int nb_par);
1630 void cloog_scattering_free(CloogScattering *);
1635 The @code{CloogScattering} type represents a scattering function.
1636 A @code{CloogScattering} for a given @code{CloogDomain} can be read
1637 from a file using @code{cloog_scattering_read} or converted
1638 from a @code{CloogMatrix} using @code{cloog_scattering_from_cloog_matrix}.
1639 The function @code{cloog_scattering_from_cloog_matrix} takes a
1640 @code{CloogState}, a @code{CloogMatrix} and two @code{int}s as input and
1642 pointer to a @code{CloogScattering}.
1643 @code{matrix} describes the scattering, while @code{nb_scat} and
1644 @code{nb_par} are the number of scattering dimensions and
1645 the number of parameters, respectively. The input data structures are
1646 neiter modified nor freed.
1647 A @code{CloogScattering} can be freed using @code{cloog_scattering_free}.
1648 There are also some backend dependent functions for creating
1649 @code{CloogScattering}s.
1652 * CloogScattering/PolyLib::
1653 * CloogScattering/isl::
1656 @node CloogScattering/PolyLib
1657 @subsubsection PolyLib
1660 #include <cloog/polylib/cloog.h>
1661 CloogScattering *cloog_scattering_from_polylib_polyhedron(
1662 CloogState *state, Polyhedron *polyhedron, int nb_par);
1665 The function @code{cloog_scattering_from_polylib_polyhedron} takes a PolyLib
1666 @code{Polyhedron} as input and returns a pointer to a @code{CloogScattering}.
1667 The @code{nb_par} parameter indicates the number of parameters
1668 in the domain. The input data structure if neither modified nor freed.
1670 @node CloogScattering/isl
1674 #include <cloog/isl/cloog.h>
1675 CloogScattering *cloog_scattering_from_isl_map(struct isl_map *map);
1678 The function @code{cloog_scattering_from_isl_map} takes a
1679 @code{struct isl_map} as input and returns a pointer to a @code{CloogScattering}.
1680 The outut dimensions of the @code{struct isl_map} correspond to the
1681 scattering dimensions, while the input dimensions correspond to the
1683 The function consumes a reference to the given @code{struct isl_map}.
1686 @node CloogUnionDomain
1687 @subsection CloogUnionDomain
1690 enum cloog_dim_type @{ CLOOG_PARAM, CLOOG_ITER, CLOOG_SCAT @};
1692 CloogUnionDomain *cloog_union_domain_alloc(int nb_par);
1693 CloogUnionDomain *cloog_union_domain_add_domain(CloogUnionDomain *ud,
1694 const char *name, CloogDomain *domain,
1695 CloogScattering *scattering, void *usr);
1696 CloogUnionDomain *cloog_union_domain_set_name(CloogUnionDomain *ud,
1697 enum cloog_dim_type type, int index, const char *name);
1698 void cloog_union_domain_free(CloogUnionDomain *ud);
1702 @noindent A @code{CloogUnionDomain} structure represents a union
1703 of scattered named domains. A @code{CloogUnionDomain} is
1704 initialized by a call to @code{cloog_union_domain_alloc},
1705 after which domains can be added using @code{cloog_union_domain_add_domain}.
1707 @code{cloog_union_domain_alloc} takes the number of parameters as input.
1708 @code{cloog_union_domain_add_domain} takes a previously created
1709 @code{CloogUnionDomain} as input along with an optional name,
1710 a domain, an optional scattering function and a user pointer.
1711 The name may be @code{NULL} and is duplicated if it is not.
1712 If no name is specified, then the statements will be named according
1713 to the order in which they were added.
1714 @code{domain} and @code{scattering} are taken over
1715 by the @code{CloogUnionDomain}. @code{scattering} may be @code{NULL},
1716 but it must be consistently @code{NULL} or not over all calls
1717 to @code{cloog_union_domain_add_domain}.
1718 @code{cloog_union_domain_set_name} can be used to set the names
1719 of parameters, iterators and scattering dimensions.
1720 The names of iterators and scattering dimensions can only be set
1721 after all domains have been added.
1724 @node CloogStatement
1725 @subsection CloogStatement
1728 struct cloogstatement
1729 @{ int number ; /* The statement unique number. */
1730 char *name; /* Name of the statement. */
1731 void * usr ; /* Pointer for user's convenience. */
1732 struct cloogstatement * next ;/* Next element of the linked list. */
1734 typedef struct cloogstatement CloogStatement ;
1736 CloogStatement *cloog_statement_malloc(CloogState *state);
1737 void cloog_statement_print(FILE *, CloogStatement *);
1738 void cloog_statement_free(CloogStatement *);
1742 @noindent The @code{CloogStatement} structure represents a @code{NULL}
1744 list of statements. In CLooG, a statement is only defined by its unique
1745 number (@code{number}). The user can use the pointer @code{usr} for his
1746 own convenience to link his own statement representation to the
1747 corresponding @code{CloogStatement} structure. The whole management of the
1748 @code{usr} pointer is under the responsibility of the user, in particular,
1749 CLooG never tries to print, to allocate or to free a memory block pointed
1755 @subsection CloogOptions
1759 @{ int l ; /* -l option. */
1760 int f ; /* -f option. */
1761 int strides ; /* -strides option. */
1762 int sh ; /* -sh option. */
1763 int esp ; /* -esp option. */
1764 int fsp ; /* -fsp option. */
1765 int otl ; /* -otl option. */
1766 int block ; /* -block option. */
1767 int cpp ; /* -cpp option. */
1768 int compilable ; /* -compilable option. */
1769 int language; /* LANGUAGE_C or LANGUAGE_FORTRAN */
1771 typedef struct cloogoptions CloogOptions ;
1773 CloogOptions *cloog_options_malloc(CloogState *state);
1774 void cloog_options_print(FILE *foo, CloogOptions *options);
1775 void cloog_options_free(CloogOptions *options);
1779 @noindent The @code{CloogOptions} structure contains all the possible options to
1780 rule CLooG's behaviour (@pxref{Calling CLooG}).
1781 As a reminder, the default values are:
1783 @item @math{l = -1} (optimize control until the innermost loops),
1784 @item @math{f = 1} (optimize control from the outermost loops),
1785 @item @math{strides = 0} (use only unit strides),
1786 @item @math{sh = 0} (do not simplify convex hulls),
1787 @item @math{esp = 1} (do not spread complex equalities),
1788 @item @math{fsp = 1} (start to spread from the first iterators),
1789 @item @math{otl = 1} (simplify loops running only once).
1790 @item @math{block = 0} (do not make statement blocks when not necessary).
1791 @item @math{cpp = 0} (do not generate a compilable part of code using preprocessor).
1792 @item @math{compilable = 0} (do not generate a compilable code).
1797 @subsection CloogInput
1800 CloogInput *cloog_input_read(FILE *file, CloogOptions *options);
1801 CloogInput *cloog_input_alloc(CloogDomain *context,
1802 CloogUnionDomain *ud);
1803 void cloog_input_free(CloogInput *input);
1805 void cloog_input_dump_cloog(FILE *, CloogInput *, CloogOptions *);
1809 @noindent A @code{CloogInput} structure represents the input to CLooG.
1810 It is essentially a @code{CloogUnionDomain} along with a context
1811 @code{CloogDomain}. A @code{CloogInput} can be created from
1812 a @code{CloogDomain} and a @code{CloogUnionDomains} using
1813 @code{cloog_input_alloc}, or it can be read from a CLooG input
1814 file using @code{cloog_input_read}. The latter also modifies
1815 the @code{language} field of the @code{CloogOptions} structure.
1816 The constructed @code{CloogInput} can be used as input
1817 to a @code{cloog_clast_create_from_input} call.
1819 A @code{CloogInput} data structure and a @code{CloogOptions} contain
1820 the same information as a .cloog file. This function dumps the .cloog
1821 description of the given data structures into a file.
1823 @node Dump CLooG Input File Function
1824 @subsection Dump CLooG Input File Function
1829 @section CLooG Output
1832 Given a description of the input,
1833 an AST corresponding to the @code{CloogInput} can be constructed
1834 using @code{cloog_clast_create_from_input} and destroyed using
1835 @code{free_clast_stmt}.
1837 struct clast_stmt *cloog_clast_create_from_input(CloogInput *input,
1838 CloogOptions *options);
1839 void free_clast_stmt(struct clast_stmt *s);
1842 @code{clast_stmt} represents a linked list of ``statements''.
1844 struct clast_stmt @{
1845 const struct clast_stmt_op *op;
1846 struct clast_stmt *next;
1850 The entries in the list are not of type @code{clast_stmt} itself,
1851 but of some larger type. The following statement types are defined
1855 struct clast_root @{
1856 struct clast_stmt stmt;
1859 struct clast_root *new_clast_root(CloogNames *names);
1861 struct clast_assignment @{
1862 struct clast_stmt stmt;
1864 struct clast_expr * RHS;
1866 struct clast_assignment *new_clast_assignment(const char *lhs,
1867 struct clast_expr *rhs);
1869 struct clast_block @{
1870 struct clast_stmt stmt;
1871 struct clast_stmt * body;
1873 struct clast_block *new_clast_block(void);
1875 struct clast_user_stmt @{
1876 struct clast_stmt stmt;
1877 CloogStatement * statement;
1878 struct clast_stmt * substitutions;
1880 struct clast_user_stmt *new_clast_user_stmt(CloogStatement *stmt,
1881 struct clast_stmt *subs);
1884 struct clast_stmt stmt;
1885 const char * iterator;
1886 struct clast_expr * LB;
1887 struct clast_expr * UB;
1889 struct clast_stmt * body;
1891 struct clast_for *new_clast_for(const char *it, struct clast_expr *LB,
1892 struct clast_expr *UB, cloog_int_t stride);
1894 struct clast_guard @{
1895 struct clast_stmt stmt;
1896 struct clast_stmt * then;
1898 struct clast_equation eq[1];
1900 struct clast_guard *new_clast_guard(int n);
1903 The @code{clast_stmt} returned by @code{cloog_clast_create}
1904 is a @code{clast_root}.
1905 It contains a placeholder for all the variable names that appear
1906 in the AST and a (list of) nested statement(s).
1909 A @code{clast_assignment} assigns the value given by
1910 the @code{clast_expr} @code{RHS} to a variable named @code{LHS}.
1913 A @code{clast_block} groups a list of statements into one statement.
1914 These statements are only generated if the @code{block} option is set,
1915 @pxref{Statement Block} and @ref{CloogOptions}.
1918 A @code{clast_user_stmt} represents a call to a statement specified
1919 by the user, @pxref{CloogStatement}.
1920 @code{substitutions} is a list of @code{clast_assignment} statements
1921 assigning an expression in terms of the scattering dimensions to
1922 each of the original iterators in the original order.
1923 The @code{LHS}s of these assignments are left blank (@code{NULL}).
1926 A @code{clast_for} represents a for loop, iterating @code{body} for each
1927 value of @code{iterator} between @code{LB} and @code{UB} in steps
1928 of size @code{stride}.
1931 A @code{clast_guard} represents the guarded execution of the @code{then}
1932 (list of) statement(s) by a conjunction of @code{n} (in)equalities.
1933 Each (in)equality is represented by a @code{clast_equation}.
1935 struct clast_equation @{
1936 struct clast_expr * LHS;
1937 struct clast_expr * RHS;
1942 The condition expressed by a @code{clast_equation} is
1943 @code{LHS <= RHS}, @code{LHS == RHS} or @code{LHS >= RHS}
1944 depending on whether @code{sign} is less than zero, equal
1945 to zero, or greater than zero.
1947 The dynamic type of a @code{clast_stmt} can be determined
1948 using the macro @code{CLAST_STMT_IS_A(stmt,type)},
1949 where @code{stmt} is a pointer to a @code{clast_stmt}
1950 and @code{type} is one of @code{stmt_root}, @code{stmt_ass},
1951 @code{stmt_user}, @code{stmt_block}, @code{stmt_for} or
1953 Users are allowed to define their own statement types by
1954 assigning the @code{op} field of the statements a pointer
1955 to a @code{clast_stmt_op} structure.
1957 struct clast_stmt_op @{
1958 void (*free)(struct clast_stmt *);
1962 The @code{free} field of this structure should point
1963 to a function that frees the user defined statement.
1966 A @code{clast_expr} can be an identifier, a term,
1967 a binary expression or a reduction.
1969 enum clast_expr_type @{
1975 struct clast_expr @{
1976 enum clast_expr_type type;
1978 void free_clast_expr(struct clast_expr *e);
1982 Identifiers are of subtype @code{clast_name}.
1984 struct clast_name @{
1985 struct clast_expr expr;
1988 struct clast_name *new_clast_name(const char *name);
1989 void free_clast_name(struct clast_name *t);
1992 The character string pointed to by @code{name} is
1993 assumed to be part of the @code{CloogNames} structure
1994 in the root of the clast as is therefore not copied.
1997 Terms are of type @code{clast_term}.
1999 struct clast_term @{
2000 struct clast_expr expr;
2002 struct clast_expr *var;
2004 struct clast_term *new_clast_term(cloog_int_t c, struct clast_expr *v);
2005 void free_clast_term(struct clast_term *t);
2008 If @code{var} is set to @code{NULL}, then the term represents
2009 the integer value @code{val}. Otherwise, it represents
2010 the term @code{val * var}.
2011 @code{new_clast_term} simply copies the @code{v} pointer
2012 without copying the underlying @code{clast_expr}.
2013 @code{free_clast_term}, on the other hand, recursively frees
2017 Binary expressions are of type @code{clast_bin_type} and
2018 represent either the floor of a division (fdiv),
2019 the ceil of a division (cdiv), an exact division or
2020 the remainder of an fdiv.
2022 enum clast_bin_type @{ clast_bin_fdiv, clast_bin_cdiv,
2023 clast_bin_div, clast_bin_mod @};
2024 struct clast_binary @{
2025 struct clast_expr expr;
2026 enum clast_bin_type type;
2027 struct clast_expr* LHS;
2030 struct clast_binary *new_clast_binary(enum clast_bin_type t,
2031 struct clast_expr *lhs, cloog_int_t rhs);
2032 void free_clast_binary(struct clast_binary *b);
2036 Reductions are of type @code{clast_reduction} and
2037 can represent either the sum, the minimum or the maximum
2040 enum clast_red_type @{ clast_red_sum, clast_red_min, clast_red_max @};
2041 struct clast_reduction @{
2042 struct clast_expr expr;
2043 enum clast_red_type type;
2045 struct clast_expr* elts[1];
2047 struct clast_reduction *new_clast_reduction(enum clast_red_type t,
2049 void free_clast_reduction(struct clast_reduction *r);
2053 @node Example of Library Utilization
2054 @section Example of Library Utilization
2055 Here is a basic example showing how it is possible to use the CLooG library,
2056 assuming that a standard installation has been done.
2057 The following C program reads a CLooG input file on the standard input,
2058 then prints the solution on the standard output.
2059 Options are preselected to the default values of the CLooG software.
2060 This example is provided in the @code{example} directory of the
2065 # include <cloog/cloog.h>
2071 CloogOptions * options ;
2072 struct clast_stmt *root;
2074 /* Setting options and reading program informations. */
2075 state = cloog_state_malloc();
2076 options = cloog_options_malloc(state);
2077 input = cloog_input_read(stdin, options);
2079 /* Generating and printing the code. */
2080 root = cloog_clast_create_from_input(input, options);
2081 clast_pprint(stdout, root, 0, options);
2083 cloog_clast_free(root);
2084 cloog_options_free(options) ;
2085 cloog_state_free(state);
2090 @noindent The compilation command could be:
2092 gcc example.c -lcloog -o example
2094 @noindent A calling command with the input file test.cloog could be:
2096 more test.cloog | ./example
2100 @c % ******************************** HACKING *********************************
2102 @c @chapter Hacking CLooG
2105 @c * Program organization::
2106 @c * Special Options::
2107 @c * CLooG Coding Standards::
2110 @c @node Program organization
2111 @c @section Program organization
2113 @c @node Special Options
2114 @c @section Special Options
2116 @c @node CLooG Coding Standards
2117 @c @section CLooG Coding Standards
2120 @c % ****************************** INSTALLING ********************************
2122 @chapter Installing CLooG
2127 * Basic Installation::
2128 * Optional Features::
2134 First of all, it would be very kind to refer the following paper in any
2135 publication that result from the use of the CLooG software or its library,
2136 @pxref{Bas04} (a bibtex entry is provided behind the title page of this
2137 manual, along with copyright notice, and in the CLooG home
2138 @code{http://www.CLooG.org}.
2140 This library is free software; you can redistribute it and/or
2141 modify it under the terms of the GNU Lesser General Public
2142 License as published by the Free Software Foundation; either
2143 version 2.1 of the License, or (at your option) any later version.
2144 This library is distributed in the hope that it will be useful,
2145 but WITHOUT ANY WARRANTY; without even the implied warranty of
2146 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2147 Lesser General Public License for more details.
2148 @code{http://www.gnu.org/licenses/lgpl-2.1.html}
2150 Note, though, that if you link CLooG against a GPL library such
2151 as the PolyLib backend, then the combination becomes GPL too.
2152 In particular, a CLooG library based on the PolyLib backend
2153 is GPL version 2 only.
2154 Since the isl backend is LGPL, linking against it does not affect
2155 the license of CLooG.
2159 @section Requirements
2161 CLooG can be used with one of two possible backends,
2162 one using isl and one using PolyLib.
2163 The isl library is included in the CLooG distribution,
2164 while the PolyLib library needs to be obtained separately.
2165 On the other hand, isl requires GMP, while PolyLib can be
2166 compiled with or without the use of GMP.
2167 The user therefore needs to install at least one of
2177 @subsection PolyLib (optional)
2178 To successfully install CLooG with the PolyLib backend,
2179 the user first needs to install PolyLib
2180 version 5.22.1 or above (default 64 bits version is satisfying
2181 as well as 32 bits or GMP multiple precision version).
2182 Polylib can be downloaded freely
2183 at @code{http://icps.u-strasbg.fr/PolyLib/} or
2184 @code{http://www.irisa.fr/polylib/}. Once downloaded and unpacked
2185 (e.g. using the @samp{tar -zxvf polylib-5.22.3.tar.gz} command),
2186 the user can compile
2187 it by typing the following commands on the PolyLib's root directory:
2190 @item @code{./configure}
2192 @item And as root: @code{make install}
2195 Alternatively, the latest development version can be obtained from the
2198 @item @code{git clone git://repo.or.cz/polylib.git}
2199 @item @code{cd polylib}
2200 @item @code{./autogen.sh}
2201 @item @code{./configure}
2203 @item And as root: @code{make install}
2206 The PolyLib default installation is @code{/usr/local}. This directory may
2207 not be inside your library path. To fix the problem, the user should set
2209 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
2211 @noindent if your shell is, e.g., bash or
2213 setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib
2215 @noindent if your shell is, e.g., tcsh. Add the line to your .bashrc or .tcshrc (or
2216 whatever convenient file) to make this change permanent. Another solution
2217 is to ask PolyLib to install in the standard path by using the prefix
2218 option of the configure script:
2219 @samp{./configure --prefix=/usr}.
2221 CLooG makes intensive calls to polyhedral operations, and PolyLib
2222 functions do the job. Polylib is a free library written in C for the
2223 manipulation of polyhedra. The library is operating on objects like
2224 vectors, matrices, lattices, polyhedra, Z-polyhedra, unions of
2225 polyhedra and a lot of other intermediary structures. It provides
2226 functions for all the important operations on these structures.
2229 @subsection GMP Library (optional)
2231 To be able to deal with insanely large coefficient, the user will need to
2232 install the GNU Multiple Precision Library (GMP for short) version 4.1.4
2233 or above. It can be freely downloaded from @code{http://www.swox.com/gmp}.
2234 Note that the isl backend currently requires GMP.
2235 The user can compile GMP by typing the following commands on the GMP root
2239 @item @code{./configure}
2241 @item And as root: @code{make install}
2244 The GMP default installation is @code{/usr/local}, the same method to
2245 fix a library path problem applies as with PolyLib (@pxref{PolyLib}).
2247 If you want to use the PolyLib backend, then
2248 PolyLib has to be built using the GMP library by specifying the option
2249 @samp{--with-libgmp=PATH_TO_GMP} to the PolyLib configure script
2250 (where @code{PATH_TO_GMP} is @code{/usr/local} if you did not change the GMP
2251 installation directory). Then you have to set the convenient CLooG configure
2252 script options to build the GMP version (@pxref{Optional Features}).
2255 @node Basic Installation
2256 @section CLooG Basic Installation
2258 Once downloaded and unpacked
2259 (e.g. using the @samp{tar -zxvf cloog-@value{VERSION}.tar.gz} command),
2260 you can compile CLooG by typing the following commands on the CLooG's root
2264 @item @code{./configure}
2266 @item And as root: @code{make install}
2269 Alternatively, the latest development version can be obtained from the
2272 @item @code{git clone git://repo.or.cz/cloog.git}
2273 @item @code{cd cloog}
2274 @item @code{./get_submodules.sh}
2275 @item @code{./autogen.sh}
2276 @item @code{./configure}
2278 @item And as root: @code{make install}
2281 Depending on which backend you want to use and where they
2282 are located, you may need to pass some
2283 options to the configure script, @pxref{Optional Features}.
2285 The program binaries and object files can be removed from the
2286 source code directory by typing @code{make clean}. To also remove the
2287 files that the @code{configure} script created (so you can compile the
2288 package for a different kind of computer) type @code{make distclean}.
2290 Both the CLooG software and library have been successfully compiled
2291 on the following systems:
2293 @item PC's under Linux, with the @code{gcc} compiler,
2294 @item PC's under Windows (Cygwin), with the @code{gcc} compiler,
2295 @item Sparc and UltraSparc Stations, with the @code{gcc} compiler.
2298 @node Optional Features
2299 @section Optional Features
2300 The @code{configure} shell script attempts to guess correct values for
2301 various system-dependent variables and user options used during compilation.
2302 It uses those values to create the @code{Makefile}. Various user options
2303 are provided by the CLooG's configure script. They are summarized in the
2304 following list and may be printed by typing @code{./configure --help} in the
2305 CLooG top-level directory.
2308 @item By default, the installation directory is @code{/usr/local}:
2309 @code{make install} will install the package's files in
2310 @code{/usr/local/bin}, @code{/usr/local/lib} and @code{/usr/local/include}.
2311 The user can specify an installation prefix other than @code{/usr/local} by
2312 giving @code{configure} the option @code{--prefix=PATH}.
2314 @item By default, the isl backend will use the version of isl
2315 that is @code{bundled} together with CLooG.
2316 Using the @code{--with-isl} option of @code{configure}
2317 the user can specify that @code{no} isl,
2318 a previously installed (@code{system}) isl or a @code{build} isl
2320 In the latter case, the user should also specify the build location
2321 using @code{--with-isl-builddir=PATH}.
2322 In case of an installed isl,
2323 the installation location can be specified using the
2324 @code{--with-isl-prefix=PATH} and
2325 @code{--with-isl-exec-prefix=PATH} options of @code{configure}.
2327 @item By default, the PolyLib backend will use an installed
2328 (@code{system}) PolyLib, if any.
2329 The installation location can be specified using the
2330 @code{--with-polylib-prefix=PATH} and
2331 @code{--with-polylib-exec-prefix=PATH} options of @code{configure}.
2332 Using the @code{--with-polylib} option of @code{configure}
2333 the user can specify that @code{no} PolyLib or a @code{build} PolyLib
2335 In the latter case, the user should also specify the build location
2336 using @code{--with-polylib-builddir=PATH}.
2338 @item By default, the PolyLib backend of CLooG is built
2339 in 64bits version if such version of the
2340 PolyLib is found by @code{configure}. If the only existing version of the
2341 PolyLib is the 32bits or if the user give to @code{configure} the option
2342 @code{--with-bits=32}, the 32bits version of CLooG will be compiled. In the
2343 same way, the option @code{--with-bits=gmp} have to be used to build
2344 the multiple precision version.
2346 @item By default, @code{configure} will look for the GMP library
2347 (necessary to build the multiple precision version) in standard
2348 locations. If necessary, the user can specify the GMP path by giving
2349 @code{configure} the option @code{--with-gmp-prefix=PATH} and/or
2350 @code{--with-gmp-exec-prefix=PATH}.
2353 @node Uninstallation
2354 @section Uninstallation
2355 The user can easily remove the CLooG software and library from his system
2356 by typing (as root if necessary) from the CLooG top-level directory
2357 @code{make uninstall}.
2359 @c % **************************** DOCUMENTATION ******************************
2361 @chapter Documentation
2362 The CLooG distribution provides several documentation sources. First, the
2363 source code itself is as documented as possible. The code comments use a
2364 Doxygen-compatible presentation (something similar to what JavaDoc does for
2365 JAVA). The user may install Doxygen
2366 (see @code{http://www.stack.nl/~dimitri/doxygen}) to automatically
2367 generate a technical documentation by typing @code{make doc} or
2368 @code{doxygen ./autoconf/Doxyfile} at the CLooG top-level directory after
2369 running the configure script (@pxref{Installing}). Doxygen will generate
2370 documentation sources (in HTML, LaTeX and man) in the @code{doc/source}
2371 directory of the CLooG distribution.
2373 The Texinfo sources of the present document are also provided in the @code{doc}
2374 directory. You can build it in either DVI format (by typing
2375 @code{texi2dvi cloog.texi}) or PDF format
2376 (by typing @code{texi2pdf cloog.texi}) or HTML format
2377 (by typing @code{makeinfo --html cloog.texi}, using @code{--no-split}
2378 option to generate a single HTML file) or info format
2379 (by typing @code{makeinfo cloog.texi}).
2381 @c % ****************************** REFERENCES ********************************
2387 @anchor{Bas03a}[Bas03a] C. Bastoul, P. Feautrier. Improving data locality
2388 by chunking. CC'12 International Conference on Compiler Construction,
2389 LNCS 2622, pages 320-335, Warsaw, april 2003.
2392 @anchor{Bas03b}[Bas03b] C. Bastoul. Efficient code generation for automatic
2393 parallelization and optimization. ISPDC'03 IEEE International Symposium on
2394 Parallel and Distributed Computing, pages 23-30, Ljubljana, october 2003.
2397 @anchor{Bas04}[Bas04] C. Bastoul. Code Generation in the Polyhedral Model
2398 Is Easier Than You Think. PACT'13 IEEE International Conference on Parallel
2399 Architecture and Compilation Techniques, pages 7-16, Juan-les-Pins,
2403 @anchor{Fea92}[Fea92] P. Feautrier Some efficient solutions to the affine
2404 scheduling problem, part II: multidimensional time.
2405 International Journal of Parallel Programming, 21(6):389--420, December 1992.
2408 @anchor{Gri04}[Gri04] M. Griebl. Automatic parallelization of loop programs
2409 for distributed memory architectures. Habilitation Thesis. Facult@"at f@"ur
2410 Mathematik und Informatik, Universit@"at Passau, 2004.
2411 @emph{http://www.infosun.fmi.uni-passau.de/cl/loopo/}
2414 @anchor{Qui00}[Qui00] F. Quiller@'e, S. Rajopadhye, and D. Wilde.
2415 Generation of efficient nested loops from polyhedra.
2416 International Journal of Parallel Programming, 28(5):469-498,
2420 @anchor{Wil93}[Wil93] Doran K. Wilde.
2421 A library for doing polyhedral operations.
2422 Technical Report 785, IRISA, Rennes, France, 1993.
2429 @c % /*************************************************************************
2430 @c % * PART VI: END OF THE DOCUMENT *
2431 @c % *************************************************************************/
2432 @c @unnumbered Index