Boost logo

Ublas :

From: Patrick Kowalzick (patrick.kowalzick_at_[hidden])
Date: 2005-06-09 08:03:04


Toon Knapen <toon.knapen_at_[hidden]> schrieb am 09.06.2005 12:34:29:

> Gunter Winkler <guwi17_at_[hidden]> wrote:
> >Am Dienstag, 7. Juni 2005 23:14 schrieb Jack Nguyen:
> >Yes, ublas can not (and will not) compete with atlas. You can play with
> >different matrix products and matrix sizes with the attached sample
> >program.
> >
> >size of metrices - 500x500*500x500
> >
> > prod axpy opb block goto atlas
> >RRR 2.71 1.52 1.73 0.47 0.45 0.12
> >RRC 1.17 2.85 1.75 0.47 0.45 0.13
> >RCR 6.01 1.57 1.7 0.48 0.45 0.12
> >RCC 2.6 2.86 1.72 0.48 0.45 0.13
> >CRR 2.6 2.86 1.72 0.47 0.44 0.13
> >CRC 1.13 2.84 1.75 0.48 0.45 0.12
> >CCR 6.01 1.5 1.71 0.48 0.46 0.11
> >CCC 2.7 1.48 1.73 0.47 0.45 0.13
> >
> >(first column gives storage orientation of X, A and B, other columns
> >present times on my Athlon XP (1466MHz) for X += A*B using different
> >products)
> >
>
>
> I am a bit surprised. I would have expected that [RC]RC would provide
> optimal performance because (generally) the prod is calculated by axpy-ing
> rows of A with columns of B. Axpy-prod however is slowest on these configs.
> BTW: what is 'opb'?
size of metrices - 500x500

If you use a simple algorithm with three loops for the product, an optimal loop order exists for each case. The columns rkc, rck and so on are the permutations of the loop order.

       prod axpy opb block rkc rck krc kcr crk ckr
RRR 2.39 2.24 2.58 0.6 2.11 4.39 2.59 6.82 3.29 6.16
RRC 1.04 4.24 2.64 0.59 4.27 2.11 3.32 6.93 2.17 6.13
RCR 4.22 2.28 2.61 0.59 2.16 6.22 2.51 4.61 6.2 2.86
RCC 1.83 4.26 2.66 0.58 4.82 4.24 3.22 4.66 4.63 2.85
CRR 1.72 4.58 2.62 0.63 3.02 4.56 4.89 3.64 3.28 4.66
CRC 1.11 4.41 2.68 0.6 6.23 2.2 7.08 3.49 2.13 4.34
CCR 4.26 2.36 2.59 0.64 3.14 6.3 4.84 2.59 6.13 2.19
CCC 2.51 2.22 2.67 0.62 6.28 3.51 6.79 2.58 4.43 2.07

So I think the differences in prod and axpy could be smaller.

Patrick
__________________________________________________________
Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201