[MITgcm-support] using gather/scatter to work with global fields

Jean-Michel Campin jmc at ocean.mit.edu
Wed Aug 29 11:24:22 EDT 2012


Oops, I meant writeBinaryPrec (and not readBinaryPrec). My mistake.
Jean-Michel

On Mon, Aug 27, 2012 at 10:19:55AM -0400, Jean-Michel Campin wrote:
> Hi Katy,
> 
> few comments:
> 1) the BARRIER calls (either coded with the macro "_BARRIER" or
>   explicit call to BAR2) are itended to syncronise threads.
>   Unless you you are running multi-threads (nTx > 1 or nTy > 1 in eedata),
>   these barrier calls will do nothing.
> 
> 2) S/R GATHER_2D_R4 is used to write output when the default readBinaryPrec 
>   is used (i.e., =32) with single CPU IO (useSingleCpuIO=.TRUE.).
>   It has been used & tested by many people in many different set-up,
>   so a bug is not very likely; but anyway, it would be useful to check that, 
>   in your set-up, using these 2 options (readBinaryPrec=32 and 
>   useSingleCpuIO=.TRUE.) give you the right output files.
>   Assuming this test passes, it means we can focus on (3):
> 
> 3) How to (re-) use  S/R GATHER_2D_R4 in a customised piece of code
>   within MITgcm.
>  I would suggest to pass by MIT one day, so that we can get a more precised
>  idea of the purpose of this piece of code and how to make it to work.
>  Since few persons from AER are coming regularly to MIT, I imagine it 
>  should be possible to make this visit.
> 
> Cheers,
> Jean-Michel
> 
> On Thu, Aug 23, 2012 at 01:40:55PM -0400, Katherine Quinn wrote:
> > Hi all,
> > Within the MITgcm code (not matlab) I need to gather tiled variables
> > into a global array, specifically I'm trying to gather XC and YC.
> > I'm using the subroutine gather_2d_r4, which suggests "barrier
> > calls" before and after but it seems no matter what various barrier
> > calls I use, when I look at the global array there's chunks of tiles
> > missing.  Other relevant info - the MITgcm setup is for ecco version
> > 4 runs, with all_exch2 turned on.
> > Here's the relevant portions of my code, please suggest what I'm
> > doing wrong:
> > 
> > C     == Global variables ===
> > #include "SIZE.h"
> > #include "EEPARAMS.h"
> > #include "EESUPPORT.h"
> > #include "PARAMS.h"
> > #ifdef ALLOW_EXCH2
> > # include "W2_EXCH2_SIZE.h"
> > # include "W2_EXCH2_TOPOLOGY.h"
> > # include "W2_EXCH2_PARAMS.h"
> > #endif /* ALLOW_EXCH2 */
> > #include "EEBUFF_SCPU.h"
> > #include "GRID.h"
> > 
> > C     INPUT/OUTPUT PARAMETERS:
> > C     == Routine arguments ==
> > C     myThid - Thread number for this instance of the routine.
> >       INTEGER  myThid
> > 
> > C     LOCAL VARIABLES:
> >       LOGICAL zeroBuff, useExch2ioLayOut
> >       INTEGER xSize, ySize
> > #ifdef ALLOW_EXCH2
> >       _RL  XC_global(exch2_global_Nx,exch2_global_Ny)
> >       _RL  YC_global(exch2_global_Nx,exch2_global_Ny)
> > #else  /* ALLOW_EXCH2 */
> >       _RS  XC_global(Nx,Ny)
> >       _RS  YC_global(Nx,Ny)
> > #endif /* ALLOW_EXCH2 */
> > 
> > C Set dimensions and flags (e.g. mdsio_write_field.F)
> >       xSize = Nx
> >       ySize = Ny
> >       useExch2ioLayOut = .FALSE.
> >       zeroBuff = .TRUE.
> > #ifdef ALLOW_EXCH2
> >       IF ( W2_useE2ioLayOut ) THEN
> >          xSize = exch2_global_Nx
> >          ySize = exch2_global_Ny
> >          useExch2ioLayOut = .TRUE.
> >       ENDIF
> > #endif /* ALLOW_EXCH2 */
> > 
> > C gather XC and YC into global model grid
> > 
> >       CALL BAR2( myThid )
> >       _BEGIN_MASTER( myThid )
> >       CALL GATHER_2D_R4(
> >      O                  XC_global,
> >      I                  XC,
> >      I                  xSize, ySize,
> >      I                  useExch2ioLayOut,
> >      I                  zeroBuff,
> >      I                  myThid )
> >       _END_MASTER( myThid )
> >       CALL BAR2( myThid )
> > 
> >       _BEGIN_MASTER( myThid )
> >       CALL GATHER_2D_R4(
> >      O                  YC_global,
> >      I                  YC,
> >      I                  xSize, ySize,
> >      I                  useExch2ioLayOut,
> >      I                  zeroBuff,
> >      I                  myThid )
> >       _END_MASTER( myThid )
> >       CALL BAR2( myThid )
> > 
> > 
> > 
> > -- 
> > Katherine J. Quinn
> > Atmospheric and Environmental Research         voice: 781-761-2234
> > 131 Hartwell Avenue                              fax: 781-761-2299
> > Lexington, MA  02421-3126                     e-mail: kquinn at aer.com
> > 
> > _______________________________________________
> > MITgcm-support mailing list
> > MITgcm-support at mitgcm.org
> > http://mitgcm.org/mailman/listinfo/mitgcm-support
> 
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support



More information about the MITgcm-support mailing list