1 |
C $Header: /u/gcmpack/MITgcm/pkg/autodiff/autodiff_check.F,v 1.14 2012/07/06 23:10:28 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
5 |
|
6 |
#include "AUTODIFF_OPTIONS.h" |
7 |
#include "AD_CONFIG.h" |
8 |
|
9 |
CBOP |
10 |
C !ROUTINE: AUTODIFF_CHECK |
11 |
C !INTERFACE: |
12 |
SUBROUTINE AUTODIFF_CHECK( myThid ) |
13 |
|
14 |
C !DESCRIPTION: \bv |
15 |
C \ev |
16 |
|
17 |
IMPLICIT NONE |
18 |
#include "SIZE.h" |
19 |
#include "GRID.h" |
20 |
#include "EEPARAMS.h" |
21 |
#include "PARAMS.h" |
22 |
#ifdef ALLOW_AUTODIFF |
23 |
#include "tamc.h" |
24 |
#endif |
25 |
|
26 |
C !INPUT/OUTPUT PARAMETERS: |
27 |
C myThid - Number of this instances |
28 |
INTEGER myThid |
29 |
C msgBuf :: Informational/error message buffer |
30 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
31 |
CEOP |
32 |
|
33 |
#if (defined ALLOW_AUTODIFF_TAMC && \ |
34 |
(defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_ADMTLM)) ) |
35 |
|
36 |
#ifdef ALLOW_TAMC_CHECKPOINTING |
37 |
# if (defined (AUTODIFF_2_LEVEL_CHECKPOINT)) |
38 |
if (nchklev_1*nchklev_2 .lt. nTimeSteps) then |
39 |
WRITE(msgBuf,'(A)') |
40 |
& 'THE_MAIN_LOOP: TAMC checkpointing parameters' |
41 |
CALL PRINT_ERROR( msgBuf , myThid ) |
42 |
WRITE(msgBuf,'(A,I10)') |
43 |
& 'nchklev_1*nchklev_2 = ', |
44 |
& nchklev_1*nchklev_2 |
45 |
CALL PRINT_ERROR( msgBuf , myThid ) |
46 |
WRITE(msgBuf,'(A,I10)') |
47 |
& 'are not consistent with nTimeSteps = ', |
48 |
& nTimeSteps |
49 |
CALL PRINT_ERROR( msgBuf , myThid ) |
50 |
STOP 'ABNORMAL END: S/R AUTODIFF_CHECK' |
51 |
endif |
52 |
# elif (defined (AUTODIFF_4_LEVEL_CHECKPOINT)) |
53 |
if (nchklev_1*nchklev_2*nchklev_3*nchklev_4 .lt. nTimeSteps) then |
54 |
WRITE(msgBuf,'(A)') |
55 |
& 'THE_MAIN_LOOP: TAMC checkpointing parameters' |
56 |
CALL PRINT_ERROR( msgBuf , myThid ) |
57 |
WRITE(msgBuf,'(A,I10)') |
58 |
& 'nchklev_1*nchklev_2*nchklev_3*nchklev_4 = ', |
59 |
& nchklev_1*nchklev_2*nchklev_3*nchklev_4 |
60 |
CALL PRINT_ERROR( msgBuf , myThid ) |
61 |
WRITE(msgBuf,'(A,I10)') |
62 |
& 'are not consistent with nTimeSteps = ', |
63 |
& nTimeSteps |
64 |
CALL PRINT_ERROR( msgBuf , myThid ) |
65 |
STOP 'ABNORMAL END: S/R AUTODIFF_CHECK' |
66 |
endif |
67 |
# else |
68 |
c-- Check the choice of the checkpointing parameters in relation |
69 |
c-- to nTimeSteps: (nchklev_1*nchklev_2*nchklev_3 .ge. nTimeSteps) |
70 |
if (nchklev_1*nchklev_2*nchklev_3 .lt. nTimeSteps) then |
71 |
WRITE(msgBuf,'(A)') |
72 |
& 'THE_MAIN_LOOP: TAMC checkpointing parameters' |
73 |
CALL PRINT_ERROR( msgBuf , myThid ) |
74 |
WRITE(msgBuf,'(A,I10)') |
75 |
& 'nchklev_1*nchklev_2*nchklev_3 = ', |
76 |
& nchklev_1*nchklev_2*nchklev_3 |
77 |
CALL PRINT_ERROR( msgBuf , myThid ) |
78 |
WRITE(msgBuf,'(A,I10)') |
79 |
& 'are not consistent with nTimeSteps = ', |
80 |
& nTimeSteps |
81 |
CALL PRINT_ERROR( msgBuf , myThid ) |
82 |
STOP 'ABNORMAL END: S/R AUTODIFF_CHECK' |
83 |
endif |
84 |
# endif |
85 |
#else /* undef ALLOW_TAMC_CHECKPOINTING */ |
86 |
if (nchklev_1 .lt. nTimeSteps) then |
87 |
WRITE(msgBuf,'(A)') |
88 |
& 'THE_MAIN_LOOP: TAMC checkpointing parameters' |
89 |
CALL PRINT_ERROR( msgBuf , myThid ) |
90 |
WRITE(msgBuf,'(A,I10)') |
91 |
& 'nchklev_1 = ', nchklev_1 |
92 |
CALL PRINT_ERROR( msgBuf , myThid ) |
93 |
WRITE(msgBuf,'(A,I10)') |
94 |
& 'are not consistent with nTimeSteps = ', nTimeSteps |
95 |
CALL PRINT_ERROR( msgBuf , myThid ) |
96 |
STOP 'ABNORMAL END: S/R AUTODIFF_CHECK' |
97 |
endif |
98 |
#endif /* ALLOW_TAMC_CHECKPOINTING */ |
99 |
|
100 |
#ifndef ALLOW_AUTODIFF_MONITOR |
101 |
IF ( adjDumpFreq .NE. 0. ) THEN |
102 |
WRITE(msgBuf,'(A)') |
103 |
& 'adjDumpFreq <> 0, but undef ALLOW_AUTODIFF_MONITOR' |
104 |
CALL PRINT_ERROR( msgBuf , myThid ) |
105 |
STOP 'ABNORMAL END: S/R AUTODIFF_CHECK' |
106 |
ENDIF |
107 |
IF ( adjMonitorFreq .NE. 0. ) THEN |
108 |
WRITE(msgBuf,'(A)') |
109 |
& 'adjMonitorFreq <> 0, but undef ALLOW_AUTODIFF_MONITOR' |
110 |
CALL PRINT_ERROR( msgBuf , myThid ) |
111 |
STOP 'ABNORMAL END: S/R AUTODIFF_CHECK' |
112 |
ENDIF |
113 |
#endif |
114 |
|
115 |
|
116 |
#ifndef ALLOW_AUTODIFF_WHTAPEIO |
117 |
IF ( useSingleCpuIO ) THEN |
118 |
WRITE(msgBuf,'(3A)') '** WARNING ** AUTODIFF_CHECK: ', |
119 |
& 'relying on mdsio_read/writevector.F to write ', |
120 |
& 'tapes is unsafe when useSingleCpuIO is true.' |
121 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
122 |
& SQUEEZE_RIGHT, myThid ) |
123 |
ENDIF |
124 |
#endif |
125 |
|
126 |
#endif |
127 |
|
128 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
129 |
|
130 |
RETURN |
131 |
END |