/[MITgcm]/MITgcm/eesupp/src/scatter_2d_wh_rx.template
ViewVC logotype

Contents of /MITgcm/eesupp/src/scatter_2d_wh_rx.template

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Fri Sep 24 18:38:25 2010 UTC (14 years, 10 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, HEAD
o eesup and pkg/mdsio: ALLOW_WHIO

  Option to write/read 2D fields to files including tiles halos.
  The main purpose is for adjoint related "tape I/O".
  The secondary purpose is for debugging phases.

  A word on those rather specifically intended purposes.
  The code was meant to be stripped down to the bare minimum.
  Typically, there is a unique and basic mapping to the global
  buffer (tile by tile, then proc by proc, then level by level), and
  byteswaps and meta-files are omitted. Indeed the (*_WH*) code is not
  meant to generate user friendly outputs of various shapes and forms.
  Rather it is intended, for the knowledgeabale developers,
  to be largely independent of the many mdsio options, to allow
  outputs of tiles+halos in debugging phases and in adjoint runs,
  and to allow some flexibility in tuning (adoint) I/O depending on each
  file system behavior. With regard to tuning, most of the potential knobs
  (to leave files open, to allocate the I/O indep. of usesinglecpuio,
  to specify directories, to specify the typical size of I/O calls, etc.)
  are not yet included, and will be added if they prove useful.

1 C $Header: /u/gcmpack/MITgcm/eesupp/src/scatter_2d_wh_rx.template,v 1.1 2010/09/23 05:32:17 gforget Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_EEOPTIONS.h"
6
7 CBOP
8 C !ROUTINE: SCATTER_2D_WH_RX
9 C !INTERFACE:
10 SUBROUTINE SCATTER_2D_WH_RX(
11 I gloBuff,
12 O procBuff,
13 I myThid )
14 C !DESCRIPTION:
15 C Scatter elements, including halos, of a global 2-D array from mpi process 0 to all processes.
16 C Note: done by Master-Thread ; might need barrier calls before and after
17 C this S/R call.
18
19 C !USES:
20 IMPLICIT NONE
21 #include "SIZE.h"
22 #include "EEPARAMS.h"
23 #include "EESUPPORT.h"
24
25 C !INPUT/OUTPUT PARAMETERS:
26 C gloBuff ( _RX ) :: full-domain 2D IO-buffer array (Input)
27 C procBuff ( _RX ) :: proc-domain 2D IO-buffer array (Input)
28 C myThid (integer):: my Thread Id number
29
30 C sNxWh :: x tile size with halo included
31 C sNyWh :: y tile size with halo included
32 C pocNyWh :: processor sum of sNyWh
33 C gloNyWh :: global sum of sNyWh
34 INTEGER sNxWh
35 INTEGER sNyWh
36 INTEGER procNyWh
37 INTEGER gloNyWh
38 PARAMETER ( sNxWh = sNx+2*Olx )
39 PARAMETER ( sNyWh = sNy+2*Oly )
40 PARAMETER ( procNyWh = sNyWh*nSy*nSx )
41 PARAMETER ( gloNyWh = procNyWh*nPy*nPx )
42
43 _RX gloBuff(sNxWh,gloNyWh)
44 _RX procBuff(sNxWh,procNyWh)
45 INTEGER myThid
46 CEOP
47
48 C !LOCAL VARIABLES:
49 INTEGER i,j
50 #ifdef ALLOW_USE_MPI
51 INTEGER jj, np0, np
52 _RX temp(sNxWh,gloNyWh)
53 INTEGER istatus(MPI_STATUS_SIZE), ierr
54 INTEGER lbuff, isource, itag
55 #endif /* ALLOW_USE_MPI */
56
57 _BEGIN_MASTER( myThid )
58
59 #ifdef ALLOW_USE_MPI
60
61 lbuff = sNxWh*procNyWh
62 isource = 0
63 itag = 0
64
65 IF( mpiMyId .EQ. 0 ) THEN
66
67 C-- Process 0 sends local arrays to all other processes
68 DO np = 2, numberOfProcs
69 np0 = np - 1
70
71 C-- Process 0 extract the local arrays from the global buffer.
72 DO j=1,procNyWh
73 DO i=1,sNxWh
74 jj=j+procNyWh*(np-1)
75 temp(i,j) = gloBuff(i,jj)
76 ENDDO
77 ENDDO
78
79 C-- Process 0 sends local arrays to all other processes
80 CALL MPI_SEND (temp, lbuff, _MPI_TYPE_RX,
81 & np0, itag, MPI_COMM_MODEL, ierr)
82
83 C- end loop on np
84 ENDDO
85
86 ELSE
87
88 C-- All proceses except 0 receive local array from process 0
89 CALL MPI_RECV (procBuff, lbuff, _MPI_TYPE_RX,
90 & isource, itag, MPI_COMM_MODEL, istatus, ierr)
91
92 ENDIF
93
94 #endif /* ALLOW_USE_MPI */
95
96 IF( myProcId .EQ. 0 ) THEN
97 C-- Process 0 fills-in its local data
98
99 DO j=1,procNyWh
100 DO i=1,sNxWh
101 procBuff(i,j) = gloBuff(i,j)
102 ENDDO
103 ENDDO
104
105 c DO j=1,gloNyWh
106 c DO i=1,sNxWh
107 c gloBuff(i,j) = 0.
108 c ENDDO
109 c ENDDO
110
111 C- end if myProcId = 0
112 ENDIF
113
114 _END_MASTER( myThid )
115
116 RETURN
117 END
118
119 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|

  ViewVC Help
Powered by ViewVC 1.1.22