Boost logo

Glas :

Re: [glas] when to evaluate scalar expressions

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2006-04-23 16:26:23


Andreas Pokorny wrote:
>
> Can you attach a specific backend to a subtree, and have another one
> in the final assignment? I just wonder if you have control over the
> backend used to preevaluate the scalar value.

Partial dispatching, i.e. dispatching only a specific part of an
expression to one backend and the rest of the expression to another
backend, is not directly supported. We thought long and hard about this
but partial dispatching leads to a lot of ambiguous situations.

Thus currently only when assigning a rhs to the lhs we dispatch the
/whole/ expression to a specific backend. However the backend itself can
decide to dispatch parts of the expression to another backend and/or
create temporaries.

For instance we have one 'strict' blas-backend. Dispatching an
expression that does not correspond exactly to a blas-call to this
backend will result in a (compile-)error. Another backend however, say
general blas-backend, will try to evaluate the expression using multiple
blas-calls when there is no blas-call that can evaluate the whole
expression at once. The latter backend will for instance first call
dnrm2 and then daxpy to evaluate the expression 'w=norm2(v)*v' with w
and v being a glas::dense_vector<double> and thus create a temporary.

Since adding backends should be simple, anyone can add another backend,
that builds on all other backends, to adapt policies regarding partial
dispatching, temporaries etc.

toon