[MITgcm-devel] GLOBAL_SUM in cost_final.F
Jean-Michel Campin
jmc at ocean.mit.edu
Thu Oct 24 14:59:46 EDT 2013
Hi,
I started to test some changes in pkg/cost/cost_final.F,
to replace the call to GLOBAL_SUM_RL( fc , myThid )
with a call to GLOBAL_SUM_TILE_RL( tile_fc , fc , myThid )
There is a practical advantage to do this is that I can get
better forward gradient agreement when using MPI compared to non-MPI
(when GLOBAL_SUM_SEND_RECV is defined in CPP_EEOPTIONS.h).
For instance, with tutorial_tracer_adjsens, forward grad
testreport with MPI will give 16 digits for forward grad
whereas now it's only 5 (on baudelaire with gfortran).
There is also a less obvious advantage is that
GLOBAL_SUM_RL( fc , myThid )
gives the wrong results when using multi-threads (since
fc is in common block).
I have several versions that I can check-in:
1) only changes in cost_final.F (but this leave on the side
few other cost contributions.
2) add "tile_fc(bi,bj)" to cost.h and change
cost_final.F seaice_cost_final.F shelfice_cost_final.F thsice_cost_final.F
(the only pkg that would need GLOBAL_SUM_RL( fc ) would be pkg/ecco)
3) same as (2) + also change ecco_cost_final.F
(changes are not major, total of 6 lines, changing
fc = fc
to
tile_fc(bi,bj) = tile_fc(bi,bj)
)
I think (3) would be cleaner (and easier to follow and check), but I don't
know how many different versions of ecco_cost_final.F users have.
Suggestions ?
Cheers,
Jean-Michel
More information about the MITgcm-devel
mailing list