[MITgcm-devel] diagstats_calc

Jean-Michel Campin jmc at ocean.mit.edu
Fri Nov 4 13:33:43 EDT 2011


Hi Martin,

I think that within TARGET_NEC_SX this can be checked in
(we will have both versions available).

Thanks,
Jean-Michel

On Fri, Nov 04, 2011 at 01:03:48PM +0100, Martin Losch wrote:
> 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
> 
> 
> 
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel



More information about the MITgcm-devel mailing list