/[MITgcm]/MITgcm/tools/OAD_support/ad_template.revolve.F
ViewVC logotype

Diff of /MITgcm/tools/OAD_support/ad_template.revolve.F

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

revision 1.6 by heimbach, Thu Jul 2 04:47:30 2015 UTC revision 1.7 by heimbach, Fri Jul 3 21:33:55 2015 UTC
# Line 1  Line 1 
1  #include "PACKAGES_CONFIG.h"  #include "PACKAGES_CONFIG.h"
2    #include "OPENAD_OPTIONS.h"
3    
4        subroutine template()        subroutine template()
5        use OAD_cp        use OAD_cp
# Line 116  c we may need these for the checkpointin Line 117  c we may need these for the checkpointin
117       +'OAD:',indentation(1:our_indent),       +'OAD:',indentation(1:our_indent),
118       +' __SRNAME__: run plain, down plain'       +' __SRNAME__: run plain, down plain'
119  #endif  #endif
120    #ifdef ALLOW_OPENAD_DIVA
121          DO iloop1 = 1, nTimeSteps
122            PROD = (ILOOP1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
123            print *, 'DIVA Revolve Plain PROD = ', PROD
124            CALL OpenAD_forward_step( PROD, mytime, myiter, mythid )
125          enddo
126    #else
127        DO iloop = 1, nTimeSteps        DO iloop = 1, nTimeSteps
128          CALL OpenAD_forward_step( iloop, mytime, myiter, mythid )          CALL OpenAD_forward_step( iloop, mytime, myiter, mythid )
129        enddo        enddo
130    #endif
131        end if        end if
132        if (our_rev_mode%tape) then        if (our_rev_mode%tape) then
133  #ifdef OAD_DEBUG_JOINT  #ifdef OAD_DEBUG_JOINT
# Line 141  c we may need these for the checkpointin Line 150  c we may need these for the checkpointin
150               case (rvForward)               case (rvForward)
151                  call OAD_revPlain                  call OAD_revPlain
152                  do currIter=currIter,theAction%iteration-1                  do currIter=currIter,theAction%iteration-1
153                     CALL OpenAD_forward_step( currIter+1, mytime,  #ifdef ALLOW_OPENAD_DIVA
154                       PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
155                       print *, 'DIVA Revolve Tape rvForward PROD = ', PROD
156                       CALL OpenAD_forward_step( PROD, mytime,
157       +myiter, mythid )       +myiter, mythid )
158    #else
159                       CALL OpenAD_forward_step( currIter+1, mytime,
160         +myiter, mythid )
161    #endif
162                  end do                  end do
163                  call OAD_revTape                  call OAD_revTape
164               case (rvFirstUTurn)               case (rvFirstUTurn)
165                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,  #ifdef ALLOW_OPENAD_DIVA
166                    PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
167                    print *, 'DIVA Revolve Tape rvFirstUTurn PROD = ', PROD
168                    CALL OpenAD_forward_step( PROD, mytime, myiter,
169         +mythid )
170    #else
171                    CALL OpenAD_forward_step( currIter+1, mytime, myiter,
172       +mythid )       +mythid )
173    #endif
174  ! get out now ...  ! get out now ...
175                  exit                                  exit                
176               end select                 end select  
# Line 159  c we may need these for the checkpointin Line 182  c we may need these for the checkpointin
182             select case (theAction%actionFlag)             select case (theAction%actionFlag)
183               case (rvFirstUTurn)               case (rvFirstUTurn)
184  !we taped already ... see above  !we taped already ... see above
185    #ifdef ALLOW_OPENAD_DIVA
186                    PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
187                    print *, 'DIVA Revolve Adjoint rvFirstUTurn PROD = ', PROD
188                    CALL OpenAD_forward_step( PROD, mytime, myiter,
189         +mythid )
190    #else
191                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,
192       +mythid )       +mythid )
193    #endif
194               case (rvStore)               case (rvStore)
195                  call cp_write_open(theAction%cpNum+jointCPCount)                  call cp_write_open(theAction%cpNum+jointCPCount)
196  !$PLACEHOLDER_PRAGMA$ id=8  !$PLACEHOLDER_PRAGMA$ id=8
# Line 173  c we may need these for the checkpointin Line 203  c we may need these for the checkpointin
203               case (rvForward)               case (rvForward)
204                  call OAD_revPlain                  call OAD_revPlain
205                  do currIter=currIter,theAction%iteration-1                  do currIter=currIter,theAction%iteration-1
206    #ifdef ALLOW_OPENAD_DIVA
207                       PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
208                       print *, 'DIVA Revolve Adjoint rvForward PROD = ', PROD
209                       CALL OpenAD_forward_step( PROD, mytime, myiter,
210         + mythid )
211    #else
212                     CALL OpenAD_forward_step( currIter+1, mytime, myiter,                     CALL OpenAD_forward_step( currIter+1, mytime, myiter,
213       + mythid )       + mythid )
214    #endif
215                  end do                  end do
216                  call OAD_revAdjoint                  call OAD_revAdjoint
217               case (rvUTurn)               case (rvUTurn)
218    #ifdef ALLOW_OPENAD_DIVA
219                    PROD = (currIter+1 + NTIMESTEPS_L2 *(ILOOP +(-1)))
220    #endif
221                  call OAD_revTape                  call OAD_revTape
222                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,  #ifdef ALLOW_OPENAD_DIVA
223                    print *, 'DIVA Revolve Adjoint rvUTurn tp PROD = ', PROD
224                    CALL OpenAD_forward_step( PROD, mytime, myiter,
225         +mythid )
226    #else
227                    CALL OpenAD_forward_step( currIter+1, mytime, myiter,
228       +mythid )       +mythid )
229    #endif
230                  call OAD_revAdjoint                  call OAD_revAdjoint
231                  CALL OpenAD_forward_step( currIter+1, mytime, myiter,  #ifdef ALLOW_OPENAD_DIVA
232                    print *, 'DIVA Revolve Adjoint rvUTurn ad PROD = ', PROD
233                    CALL OpenAD_forward_step( PROD, mytime, myiter,
234       +mythid )       +mythid )
235    #else
236                    CALL OpenAD_forward_step( currIter+1, mytime, myiter,
237         +mythid )
238    #endif
239             end select               end select  
240             theAction=rvNextAction()             theAction=rvNextAction()
241          end do          end do

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22