HP-UX 10.20, f90 1.0, C240 HPPA 2.0
has anybody a reliable subroutine for CPU-time measurements
for the HP-UC f90 compiler? I attach the code I used (C-wrapper
for mytime...). CPU_TIME is not part of the f90 HP-UX compiler.
as expected, the compiler is able to do a good job for loops.
Puzzling for me is, that the SUM() call is much faster than the
others, and also that the result is different.
I also included a BLAS call to sasum like in the code below.
Run times are in the range of the f77 loops.
juergen
1.) -g
f77 loop, contiguous array, sum =32811.492188 time = 9.620000
f77 loop, stride 2x2 array, sum =32811.492188 time = 11.590000
f90 loop, contiguous array, sum =32811.492188 time = 18.459999
f90 loop, stride 2x2 array, sum =32811.492188 time = 19.039997
f90 SUM(stride 2x2 array), sum =32811.437500 time = 0.700001
2.)
+O3 +Odataprefetch +Ofastaccess +Onoinitcheck +Oloop_unroll \
+Onofltacc +FPD +Oregionsched +Oentrysched
f77 loop, contiguous array, sum =32811.492188 time = 0.850000
f77 loop, stride 2x2 array, sum =32811.492188 time = 1.020000
f90 loop, contiguous array, sum =32811.492188 time = 1.340000
f90 loop, stride 2x2 array, sum =32811.492188 time = 1.010000
f90 SUM(stride 2x2 array), sum =32811.437500 time = 0.700000
--
Insitut fuer Hoechstfrequenztechnik und Elektronik - Uni Karlsruhe
Tel +49 721 608 76 76 - Fax +49 721 69 18 65
===snip===
#include <unistd.h>
#include <sys/times.h>
static float gotclktck = 1.0;
void getclktck() /* MUST BE CALLED ONCE !! */
{
gotclktck = (float)sysconf(_SC_CLK_TCK); /* obtain ticks per clock */
return;
}
float mytime(float *ttime)
{
struct tms cputime;
clock_t rtime;
rtime = times(&cputime); /* obtain timing information */
rtime /= gotclktck;
ttime[0] = cputime.tms_utime/gotclktck; /* user time */
ttime[1] = cputime.tms_stime/gotclktck; /* system time */
ttime[2] = cputime.tms_cutime/gotclktck; /* children user time */
ttime[3] = cputime.tms_cstime/gotclktck; /* children system time */
return ((float)rtime);
}
===snip===
subroutine CPU_time(t)
implicit none
real :: t, realtime
real,external :: etime,dtime,mytime
real :: toto(4)
realtime = mytime(toto)
t = toto(1)
return
end subroutine CPU_time
===snip===sasum===
subroutine a4(x,s)
implicit none
real, intent(IN) :: x(:,:)
real, intent(OUT) :: s
integer :: n1, n2
integer :: l1
real, external :: sasum
n1 = size(x,1)
n2 = size(x,2)
s = 0.0
do l1 = 1, n2
s = s + sasum(n1,x(1,l1),1)
end do
return
end subroutine a4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|