[pooma-dev] [PATCH] Clean up Tensor.h
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Mon Nov 3 14:43:19 UTC 2003
On Mon, 3 Nov 2003, James Crotinger wrote:
> Hi Richard,
>
> It's been too long for me to comment on the details here. There were places
> in the code where template meta-programs were used over loops in order to
> get performance, and some developers (myself included - it's a fun thing to
> play with but easy to overuse) used these in places where loops would have
> sufficed (assuming the upper limits were small and were compile-time
> constants, so that they could be completely unrolled). There was a wave of
> simplifications (between 2.2 and 2.3 I think) that cleaned most of these out
> as the meta-programs were adding a lot to compile time. If this is the
> nature of your changes, and if the changed code still generates good
> assembly-code, then the Tensor stuff was probably missed during this
> cleanup.
Ok, I'll have another look into Tensor.h then and figure out if the
template metaprogams can do any magic a simple loop implementation cannot
do. If not, I'm going to scrap the metaprograms in favor of simple loops.
Like
TensorAssign<TensorEngine<Dim, T, Tag>, TensorEngine<Dim, T2, Tag>, Op >
::apply(T1& t1, T2& t2, Op& op) {
for (int i=0; i<TensorStorageSize<Dim, Tag>::size; ++i)
op(t1(i), t2(i));
}
for matching dimensions and engine tags.
> It does look like your changes make use of template template parameters.
> This will hurt portability. I don't think those were supported by anyone
> when this code was written, and I'm not sure how widely they are supported
> now. Probably the high-performance compilers can handle them, but at least
> in the past a number of people would do development with Metrowerks and VC++
> since they were/are very productive environments, and they've tended to lag
> on details such as these. I'd probably avoid them for this reason.
I think they are widely supported now. This also raises the question, if
we're going to require an ISO C++ conformant compiler for future releases,
which I would encourage. Even MS is shipping one with .NET now.
Richard.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
More information about the pooma-dev
mailing list