[MITgcm-devel] diagstats_calc
Martin Losch
Martin.Losch at awi.de
Fri Nov 4 08:03:48 EDT 2011
Hi there,
on my beloved vector machine, I get a dramatic performance hit, when I use diagstats. Basically diagstats_calc.F does not vectorize at all (Vector Operation Ratio = 0 %, pretty impressive). The main reason is the statement:
IF ( statArr(0).EQ.0. ) THEN
statArr(im) = tmpFld
statArr(ix) = tmpFld
ELSE
statArr(im) = MIN(tmpFld,statArr(im))
statArr(ix) = MAX(tmpFld,statArr(ix))
ENDIF
because statArr(0) is changing with loop-counts. Everything else can be fixed with compiler directives. I can not come up with a good work-around, so I replaced the min/max computations with F90 intrinsic routines (MINVAL, MAXVAL) and while I was at it, I used the F90 instrinsic SUM to do the other computations, also I use F90-array operations and avoided some loops. Now my diagstats_calc.F is about 9 times faster, no longer uses >50% of the run time, and vectorization is sufficently good. Is it OK to check this code in (all with in #ifdefs TARGET_NEC_SX, of course)? We do not even have a f77-compiler on our SX8 anymore, and I do not expect that anyone with access to an SX will use F77 either, so that I think that using the F90 functions is not a limitation.
Please let me know what your think.
Martin
More information about the MITgcm-devel
mailing list