PDA

View Full Version : Re: [LF] MATMUL-Performance


Lahey Support
08-15-2003, 01:33 AM
----- Original Message -----
From: "W. Schmidt" [address removed]
To: "Lahey-Forum" [address removed]
Sent: Friday, September 07, 2001 1:02 AM
Subject: [LF] MATMUL-Performance


> Dear forum members,
>
> testing the new Fortran90/95 feature MATMUL (with LF90 4.5 and
LF95
> 5.6f,
> OS: WIN9X and WIN2000, with and without optimizing) i have
found that
> the use of MATMUL causes the programs to run remarkable more
slowly.
>
> For example, inside a subroutine (often called from a big main
prgram)
> with the following subset of declarations
>
> REAL(8) :: A(2,2),B(2,2)
> REAL(8) :: X(2),Y(2),Z(2)
>
> i have changed the following code
>
> Z(1)=A(1,1)*X(1)+A(1,2)*X(2)-B(1,1)*Y(1)-B(1,2)*Y(2)
> Z(2)=A(2,1)*X(1)+A(2,2)*X(2)-B(2,1)*Y(1)-B(2,2)*Y(2)
>
> to the equivalent code
>
> Z=MATMUL(A,X)-MATMUL(B,Y)
>
> The results from the MATMUL-code are exactly the same as from
the
> explicit code before, but the execution grows with MATMUL by a
factor >
> 6.
>
> In an other test with the same (matrix- and vector-dimensions,
the
> execution time with MATMUL-code was growing by a factor 3.
>
> Has anyone analogous experiences with other f90/f95 compilers?
> Will the MUTMUL-Performance grow by greater matrix- and
> vector-dimensions?
> How actual are the popular benchmarks in respect to the new
Fortran90/95
> features?
>
> MfG
> W. Schmidt
On small matrices, MATMUL cannot deliver good performance, except
with compilers such as CVF which expand in line and unroll the
inner dot_product loop. I have not seen a compiler for IA which
handles MATMUL efficiently over a wide range of cases.
Typically, you must know the effect of problem size and call a
library version such as Intel MKL when appropriate.

The MipsPro f90, and the Cray compilers, determine at compile
time whether to expand in line or invoke a proprietary BLAS
library. This tactic is often quite effective.

----------------------------------------------------------
To unsubscribe, send to [address removed] the following
as the first and only line of the message body:
unsubscribe fortran
----------------------------------------------------------