[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.2.2 Scattering Function Representation
Scattering functions are depicted in the input file thanks a representation very close to the domain one. An integer gives the number of functions ‘Nb_functions’ and each function is represented by a domain. Each line of the domain corresponds to an equality defining a dimension of the function. Note that at present (CLooG 0.18.0-UNKNOWN) all functions must have the same scattering dimension number. If a user wants to set scattering functions with different dimensionality, he has to complete the smaller one with zeroes to reach the maximum dimensionality. For instance, let us consider the following code and scheduling functions:
for (i=1;i<=n;i++) { if ((i >= m) || (i <= 2*m)) S1 ; for (j=i+1;j<=m;j++) S2 ; }
T_S1(i) = (i,0)^T T_S2(i,j)^T = (n,i+j)^T
This scheduling can be written in the input file as follows:
2 # Number of scattering functions # First function 2 7 # 2 lines and 7 columns # eq/in c1 c2 i m n 1 0 1 0 -1 0 0 0 # c1 = i 0 0 1 0 0 0 0 # c2 = 0 # Second function 2 8 # 2 lines and 8 columns # eq/in c1 c2 i j m n 1 0 1 0 0 0 0 -1 0 # c1 = n 0 0 1 -1 -1 0 0 0 # c2 = i+j
The complete input file for the user who wants to generate the code for this
example with the preceding scheduling would be
(this file is provided in the CLooG distribution
as test/manual_scattering.cloog
:
# ---------------------- CONTEXT ---------------------- c # language is C # Context (no constraints on two parameters) 1 4 # 1 lines and 4 columns # eq/in m n 1 1 0 0 0 # 0 >= 0, always true 1 # We want to set manually the parameter names m n # parameter names # --------------------- STATEMENTS -------------------- 2 # Number of statements 2 # First statement: two domains # First domain 3 5 # 3 lines and 5 columns # eq/in i m n 1 1 1 0 0 -1 # i >= 1 1 -1 0 1 0 # i <= n 1 1 -1 0 0 # i >= m # Second domain 3 5 # 3 lines and 5 columns # eq/in i m n 1 1 1 0 0 -1 # i >= 1 1 -1 0 1 0 # i <= n 1 -1 2 0 0 # i <= 2*m 0 0 0 # for future options 1 # Second statement: one domain 4 6 # 4 lines and 6 columns # eq/in i j m n 1 1 1 0 0 0 -1 # i >= 1 1 -1 0 0 1 0 # i <= n 1 -1 1 0 0 -1 # j >= i+1 1 0 -1 1 0 0 # j <= m 0 0 0 # for future options 1 # We want to set manually the iterator names i j # iterator names # --------------------- SCATTERING -------------------- 2 # Scattering functions # First function 2 7 # 2 lines and 7 columns # eq/in p1 p2 i m n 1 0 1 0 -1 0 0 0 # p1 = i 0 0 1 0 0 0 0 # p2 = 0 # Second function 2 8 # 2 lines and 8 columns # eq/in p1 p2 i j m n 1 0 1 0 0 0 0 -1 0 # p1 = n 0 0 1 -1 -1 0 0 0 # p2 = i+j 1 # We want to set manually the scattering dimension names p1 p2 # scattering dimension names
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 20, 2013 using texi2html 5.0.