24.05.2014 Views

pdf: 600KB - Potsdam Institute for Climate Impact Research

pdf: 600KB - Potsdam Institute for Climate Impact Research

pdf: 600KB - Potsdam Institute for Climate Impact Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

64<br />

Reduced computational efficiency<br />

There is a view that, as a general rule, a declarative approach takes more computer processing<br />

time than an equivalent procedural solution. Ecosystem models can easily become<br />

computationally demanding if, <strong>for</strong> example, they have fine spatial resolution on a grid, they<br />

include large numbers of interacting objects, or they need to be simulated many times <strong>for</strong><br />

parameter estimation or sensitivity analysis. It is there<strong>for</strong>e appropriate to ask whether a<br />

declarative approach becomes impractical <strong>for</strong> such models.<br />

If a model is implemented in a computer program by a human programmer, then there is plenty of<br />

scope <strong>for</strong> that program to be highly efficient. There are optimised subroutine libraries and<br />

algorithms that can be used <strong>for</strong> time-critical parts of a simulation, Various programming tricks,<br />

such as the use of hash tables and techniques <strong>for</strong> handling sparse arrays, can be employed. And<br />

models can be programmed to run on a distributed-computing or parallel-computer system.<br />

In a declarative-modelling approach, however, the executable version of a model is produced<br />

automatically, using one of two methods. The software capable of handling models expressed in<br />

the language might have their own built-in interpreter: this appears to be the approach employed<br />

in, <strong>for</strong> example, the Stella modelling environment. In this case, evaluating an equation involves<br />

two levels - processing by the software package and processing by the language in which the<br />

package is implemented - and this necessarily reduces computational efficiency.<br />

Alternatively, the software might use a program generator to generate a program which is<br />

equivalent to the one that a human programmer would have produced <strong>for</strong> the same model. In this<br />

case, it is possible, but certainly not inevitable, that the computer-generated program will be less<br />

efficient. It is possible because the program generator might be rather crude, or not programmed<br />

to detect special cases that could be handled more efficiently. However, it is also possible that<br />

the reverse is true. The human programmer might not have the time or the expertise to implement<br />

computationally-efficient algorithms - many ecosystem research models are implemented by<br />

research scientists or by research assistants with little training in computer science. In this case,<br />

the generated program could well be more efficient - in some cases, significantly so, since it can<br />

undertake optimisations that the human programmer might not think of, or be unable or unwilling<br />

to implement. For example, the Simile program generator automatically takes variables to the<br />

outermost loop wherever possible, whereas the human programmer probably would not do this<br />

because it would significantly complicate the code.<br />

There are two additional points that are worth making. First, it is worthwhile investing in<br />

improving a program generator <strong>for</strong> a widely-used modelling language, because the investment is<br />

recovered across many models. So we would expect the program generator <strong>for</strong> a modelling<br />

language to gradually improve over time. This would be especially the case if the programgenerating<br />

software is open-source (as opposed to a proprietary commercial), so that it could<br />

accumulate the refinements and tools <strong>for</strong> handling special cases of a large community of<br />

programmers.<br />

Second, we could have several program generators. One could be <strong>for</strong> standard, single-processor<br />

PCs. Another could be <strong>for</strong> a workstation cluster running Condor (a widely-used network<br />

management system that manages the farming-out of a task across a cluster of workstations).<br />

Another could generate code <strong>for</strong> a parallel computer. Thus, the same model could be initially<br />

developed and run on a desktop PC, then run in a more powerful environment if required.<br />

In conclusion, it is probably theoretically true that a hand-crafted program can be computationally<br />

more efficient than an automatically-generated one. However, in practice the reverse may well<br />

be true, and the this will become increasingly so as tools <strong>for</strong> handling declarative models<br />

gradually accumulate better and better solutions.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!