/[MITgcm]/MITgcm/pkg/autodiff/global_sum_tile_ad.F
ViewVC logotype

Contents of /MITgcm/pkg/autodiff/global_sum_tile_ad.F

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


Revision 1.4 - (show annotations) (download)
Tue Apr 27 16:20:22 2010 UTC (14 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62g, checkpoint62f, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62u, checkpoint62t
Changes since 1.3: +9 -53 lines
fix bug in the same way as in global_sum_ad.F

1 C $Header: /u/gcmpack/MITgcm/pkg/autodiff/global_sum_tile_ad.F,v 1.3 2010/04/22 22:23:37 jmc Exp $
2 C $Name: $
3
4 #include "AUTODIFF_OPTIONS.h"
5
6 C-- File global_sum_tile_ad.F: Routines that perform adjoint of
7 C global sum on an array of thread values.
8 C Contents
9 C o GLOBAL_ADSUM_TILE_RL
10 C o GLOBAL_ADSUM_TILE_RS <- not yet coded
11
12 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
13 CBOP
14 C !ROUTINE: GLOBAL_ADSUM_TILE_RL
15
16 C !INTERFACE:
17 SUBROUTINE GLOBAL_ADSUM_TILE_RL(
18 O adPhiTile,
19 I adsumPhi,
20 I myThid )
21
22 C !DESCRIPTION:
23 C *==========================================================*
24 C | SUBROUTINE GLOBAL\_ADSUM\_TILE\_RL
25 C | o Adjoint version of global_sum_tile which returns
26 C | global sum over all tiles
27 C | Note: Assume that adsumPhi is local to this thread
28 C | (i.e., is not a shared var. and is not in a common block)
29 C *==========================================================*
30 C | Apply sum on an array of one value per tile
31 C | and operate over all tiles & all the processes.
32 C *==========================================================*
33
34 C !USES:
35 IMPLICIT NONE
36
37 C == Global data ==
38 #include "SIZE.h"
39 #include "EEPARAMS.h"
40
41 C !INPUT/OUTPUT PARAMETERS:
42 C == Routine arguments ==
43 C phiTile :: Input array with one value per tile
44 C sumPhi :: Result of sum.
45 C myThid :: My Thread Id.
46 _RL adphiTile(nSx,nSy)
47 _RL adsumPhi
48 INTEGER myThid
49 CEOP
50
51 C !LOCAL VARIABLES:
52 C == Local variables ==
53 C bi,bj :: tile indices
54 INTEGER bi,bj
55 Real*8 tmp
56
57 tmp = adsumPhi
58
59 CALL GLOBAL_SUM_R8( tmp, myThid )
60
61 C-- each thread takes its tile adjoint sum
62 DO bj = myByLo(myThid), myByHi(myThid)
63 DO bi = myBxLo(myThid), myBxHi(myThid)
64 adphiTile(bi,bj) = tmp
65 ENDDO
66 ENDDO
67 C-- reset input to zero (jmc: is it right ? necessary ?)
68 c adsumPhi = 0.
69
70 RETURN
71 END

  ViewVC Help
Powered by ViewVC 1.1.22