posed whereby the granularity of parallel tasks and
their number are controlled. The aim of granularity
control is to change parallel execution to sequential
execution or vice-versa based on some conditions re-
lated to grain size and overheads. Granularity control
has been studied in the context of traditional (Krua-
trachue and Lewis, 1988; McGreary and Gill, 1989),
functional (Huelsbergen, 1993; Huelsbergen et al.,
1994) and logic programming (Kaplan, 1988; Debray
et al., 1990; Zhong et al., 1992; López-García et al.,
1996). Taking all these theoretical and practical is-
sues into account, an interesting goal in automatic pa-
rallelization is thus to ensure that the parallel executi-
on will not take more time than the sequential one. In
general, this condition cannot be determined before
executing the task involved, while granularity con-
trol should intuitively be carried out ahead of time.
Thus, we are forced to use approximations. One clear
alternative is to evaluate a (simple) sufficient condi-
tion to ensure that the parallel execution will not take
more time than the sequential one. This was the ap-
proach developed in (López-García et al., 1996). It
has the advantage of ensuring that whenever a given
group of tasks are executed in parallel, there will be
no slowdown with respect to their sequential execu-
tion. However, the sufficient conditions can be very
conservativein some situations and lead to some tasks
being executed sequentially even when their parallel
execution would take less time. Although not pro-
ducing slowdown, this causes a loss in parallelization
opportunities, and thus, no speedup is obtained. An
alternative is to give up strictly ensuring the no slow-
down condition in all parallel executions and to use
some conditions that have a good average case beha-
vior. It is in this point where fuzzy logic can be suc-
cessfully applied to evaluate “fuzzy” conditions that,
although can entail eventual slowdowns in some exe-
cutions, speedup the whole computation on average
(always preserving correctness).
It is remarkable the originality of this approach
that is betting for the expressiveness of fuzzy logic to
improve the decision making in the field of program
optimization and, in particular, in automatic program
parallelization, including granularity control.
1.1 Fuzzy Logic Programming
Fuzzy logic has been a very fertile area during the
last years. Specially in the theoretical side, but also
from the practical point of view, with the development
of many fuzzy approaches. The ones developed in
logic programming are specially interesting by their
simplicity. The fuzzy logic programming systems
replace their inference mechanism, SLD-resolution,
with a fuzzy variant that is able to handle partial truth.
Most of these systems implement the fuzzy resolu-
tion introduced by Lee in (Lee, 1972): the Prolog-Elf
system (Ishizuka and Kanai, 1985), the FRIL Prolog
system (Baldwin et al., 1995) and the F-Prolog lan-
guage (Li and Liu, 1990).
One of the most promising fuzzy tools for Prolog
was the “Fuzzy Prolog” system (Guadarrama et al.,
2004). Fuzzy Prolog adds fuzziness to a Prolog com-
piler using CLP(R ) instead of implementing a new
fuzzy resolution method, as other former fuzzy Pro-
logs do. It represents intervals as constraints over
real numbers and aggregation operators as operations
with these constraints, so it uses the Prolog built-in
inference mechanism to handle the concept of partial
truth.
1.1.1 RFuzzy
Besides the advantages of Fuzzy Prolog (Vaucheret
et al., 2002; Guadarrama et al., 2004), its truth value
representation based on constraints is too general,
which makes it complex to be interpreted by regular
users. That was the reason for implementing a sim-
pler variant that was called RFuzzy (Pablos-Ceruelo
et al., 2009a; Muñoz-Hernández et al., 2009; Pablos-
Ceruelo et al., 2009b; Strass et al., 2009). In RFuzzy,
the truth value is represented by a simple real number.
RFuzzy is implemented as a Ciao Pro-
log (Hermenegildo et al., 2008) package because
Ciao Prolog offers the possibility of dealing with a
higher order compilation through the implementation
of Ciao packages.
The compilation process of a RFuzzy program has
two pre-compilation steps: (1) the RFuzzy program is
translated into CLP(R ) constraints by means of the
RFuzzy package and (2) the program with constraints
is translated into ISO Prolog by using the CLP(R )
package.
As the motivation of RFuzzy was providing a tool
for practical application, it was loaded with many nice
features that represent an advantage with respect to
previous fuzzy tools to model real problems. That is
why we have chosen RFuzzy for the implementation
of our prototype in this work.
2 THE GRANULARITY
CONTROL PROBLEM
We start by discussing the basic issues to be addressed
in our approach to granularity control, in terms of the
generic execution model described in (López-García
et al., 1996). In particular, we discuss how conditions
ICFC 2010 - International Conference on Fuzzy Computation
44