Back to home page

MITgcm

 
 

    


File indexing completed on 2025-05-01 05:08:01 UTC

view on githubraw file Latest commit 86f38990 on 2025-04-30 15:10:43 UTC
86f389907b Jean*0001 #ifndef _CPP_EEOPTIONS_H_
                0002 #define _CPP_EEOPTIONS_H_
                0003 
3d054304e0 Jean*0004 CBOP
                0005 C     !ROUTINE: CPP_EEOPTIONS.h
                0006 C     !INTERFACE:
                0007 C     include "CPP_EEOPTIONS.h"
7f58e89433 Jean*0008 C
3d054304e0 Jean*0009 C     !DESCRIPTION:
                0010 C     *==========================================================*
                0011 C     | CPP\_EEOPTIONS.h                                         |
                0012 C     *==========================================================*
7f58e89433 Jean*0013 C     | C preprocessor "execution environment" supporting        |
                0014 C     | flags. Use this file to set flags controlling the        |
                0015 C     | execution environment in which a model runs - as opposed |
                0016 C     | to the dynamical problem the model solves.               |
                0017 C     | Note: Many options are implemented with both compile time|
                0018 C     |       and run-time switches. This allows options to be   |
                0019 C     |       removed altogether, made optional at run-time or   |
                0020 C     |       to be permanently enabled. This convention helps   |
                0021 C     |       with the data-dependence analysis performed by the |
                0022 C     |       adjoint model compiler. This data dependency       |
                0023 C     |       analysis can be upset by runtime switches that it  |
                0024 C     |       is unable to recoginise as being fixed for the     |
                0025 C     |       duration of an integration.                        |
                0026 C     |       A reasonable way to use these flags is to          |
                0027 C     |       set all options as selectable at runtime but then  |
                0028 C     |       once an experimental configuration has been        |
                0029 C     |       identified, rebuild the code with the appropriate  |
                0030 C     |       options set at compile time.                       |
3d054304e0 Jean*0031 C     *==========================================================*
                0032 CEOP
7f58e89433 Jean*0033 
                0034 C     In general the following convention applies:
                0035 C     ALLOW  - indicates an feature will be included but it may
                0036 C     CAN      have a run-time flag to allow it to be switched
                0037 C              on and off.
                0038 C              If ALLOW or CAN directives are "undef'd" this generally
                0039 C              means that the feature will not be available i.e. it
                0040 C              will not be included in the compiled code and so no
                0041 C              run-time option to use the feature will be available.
                0042 C
                0043 C     ALWAYS - indicates the choice will be fixed at compile time
                0044 C              so no run-time option will be present
                0045 
86f389907b Jean*0046 C=== Macro related options ===
                0047 C--   Control storage of floating point operands
                0048 C     On many systems it improves performance only to use
                0049 C     8-byte precision for time stepped variables.
                0050 C     Constant in time terms ( geometric factors etc.. )
                0051 C     can use 4-byte precision, reducing memory utilisation and
                0052 C     boosting performance because of a smaller working set size.
                0053 C     However, on vector CRAY systems this degrades performance.
                0054 C     Enable to switch REAL4_IS_SLOW from genmake2 (with LET_RS_BE_REAL4):
                0055 #ifdef LET_RS_BE_REAL4
                0056 #undef REAL4_IS_SLOW
                0057 #else /* LET_RS_BE_REAL4 */
                0058 #define REAL4_IS_SLOW
                0059 #endif /* LET_RS_BE_REAL4 */
                0060 
                0061 C--   Control use of "double" precision constants.
                0062 C     Use D0 where it means REAL*8 but not where it means REAL*16
                0063 #define D0 d0
                0064 
                0065 C=== IO related options ===
3d054304e0 Jean*0066 C--   Flag used to indicate whether Fortran formatted write
7f58e89433 Jean*0067 C     and read are threadsafe. On SGI the routines can be thread
                0068 C     safe, on Sun it is not possible - if you are unsure then
                0069 C     undef this option.
3d054304e0 Jean*0070 #undef FMTFTN_IO_THREAD_SAFE
                0071 
                0072 C--   Flag used to indicate whether Binary write to Local file (i.e.,
                0073 C     a different file for each tile) and read are thread-safe.
                0074 #undef LOCBIN_IO_THREAD_SAFE
                0075 
                0076 C--   Flag to turn off the writing of error message to ioUnit zero
                0077 #undef DISABLE_WRITE_TO_UNIT_ZERO
                0078 
86f389907b Jean*0079 C--   Flag to turn on old default of opening scratch files with the
                0080 C     STATUS='SCRATCH' option. This method, while perfectly FORTRAN-standard,
                0081 C     caused filename conflicts on some multi-node/multi-processor platforms
                0082 C     in the past and has been replace by something (hopefully) more robust.
                0083 #undef USE_FORTRAN_SCRATCH_FILES
                0084 
                0085 C--   Flag defined for eeboot_minimal.F, eeset_parms.F and open_copy_data_file.F
                0086 C     to write STDOUT, STDERR and scratch files from process 0 only.
                0087 C WARNING: to use only when absolutely confident that the setup is working
                0088 C     since any message (error/warning/print) from any proc <> 0 will be lost.
                0089 #undef SINGLE_DISK_IO
3d054304e0 Jean*0090 
86f389907b Jean*0091 C=== MPI, EXCH and GLOBAL_SUM related options ===
3d054304e0 Jean*0092 C--   Flag turns off MPI_SEND ready_to_receive polling in the
                0093 C     gather_* subroutines to speed up integrations.
                0094 #undef DISABLE_MPI_READY_TO_RECEIVE
                0095 
                0096 C--   Control use of communication that might overlap computation.
                0097 C     Under MPI selects/deselects "non-blocking" sends and receives.
                0098 #undef  ALLOW_ASYNC_COMMUNICATION
                0099 #undef  ALWAYS_USE_ASYNC_COMMUNICATION
                0100 C--   Control use of communication that is atomic to computation.
                0101 C     Under MPI selects/deselects "blocking" sends and receives.
                0102 #define ALLOW_SYNC_COMMUNICATION
                0103 #undef  ALWAYS_USE_SYNC_COMMUNICATION
                0104 
                0105 C--   Control XY periodicity in processor to grid mappings
                0106 C     Note: Model code does not need to know whether a domain is
                0107 C           periodic because it has overlap regions for every box.
                0108 C           Model assume that these values have been
                0109 C           filled in some way.
                0110 #undef  ALWAYS_PREVENT_X_PERIODICITY
                0111 #undef  ALWAYS_PREVENT_Y_PERIODICITY
                0112 #define CAN_PREVENT_X_PERIODICITY
                0113 #define CAN_PREVENT_Y_PERIODICITY
                0114 
86f389907b Jean*0115 C--   disconnect tiles (no exchange between tiles, just fill-in edges
                0116 C     assuming locally periodic subdomain)
                0117 #undef DISCONNECTED_TILES
                0118 
                0119 C--   Always cumulate tile local-sum in the same order by applying MPI allreduce
                0120 C     to array of tiles ; can get slower with large number of tiles (big set-up)
                0121 #define GLOBAL_SUM_ORDER_TILES
3d054304e0 Jean*0122 
                0123 C--   Alternative way of doing global sum without MPI allreduce call
86f389907b Jean*0124 C     but instead, explicit MPI send & recv calls. Expected to be slower.
3d054304e0 Jean*0125 #undef GLOBAL_SUM_SEND_RECV
                0126 
                0127 C--   Alternative way of doing global sum on a single CPU
86f389907b Jean*0128 C     to eliminate tiling-dependent roundoff errors. Note: This is slow.
                0129 #undef CG2D_SINGLECPU_SUM
                0130 
                0131 C=== Other options (to add/remove pieces of code) ===
                0132 C--   Flag to turn on checking for errors from all threads and procs
                0133 C     (calling S/R STOP_IF_ERROR) before stopping.
                0134 #define USE_ERROR_STOP
                0135 
                0136 C--   Control use of communication with other component:
                0137 C     allow to import and export from/to Coupler interface.
                0138 #undef COMPONENT_MODULE
3d054304e0 Jean*0139 
86f389907b Jean*0140 C--   Activate some pieces of code for coupling to GEOS AGCM
                0141 #undef HACK_FOR_GMAO_CPL
                0142 
                0143 C=== And define Macros ===
                0144 c#include "CPP_EEMACROS.h"
3d054304e0 Jean*0145 C--- Taken from file "CPP_EEMACROS.h":
7f58e89433 Jean*0146 
                0147 C     Flag used to indicate which flavour of multi-threading
                0148 C     compiler directives to use. Only set one of these.
                0149 C     USE_SOLARIS_THREADING  - Takes directives for SUN Workshop
                0150 C                              compiler.
9274434acc Jean*0151 C     USE_KAP_THREADING      - Takes directives for Kuck and
7f58e89433 Jean*0152 C                              Associates multi-threading compiler
                0153 C                              ( used on Digital platforms ).
                0154 C     USE_IRIX_THREADING     - Takes directives for SGI MIPS
                0155 C                              Pro Fortran compiler.
                0156 C     USE_EXEMPLAR_THREADING - Takes directives for HP SPP series
                0157 C                              compiler.
                0158 C     USE_C90_THREADING      - Takes directives for CRAY/SGI C90
                0159 C                              system F90 compiler.
                0160 #ifdef TARGET_SUN
                0161 #define USE_SOLARIS_THREADING
                0162 #endif
                0163 
                0164 #ifdef TARGET_DEC
                0165 #define USE_KAP_THREADING
                0166 #endif
                0167 
                0168 #ifdef TARGET_SGI
                0169 #define USE_IRIX_THREADING
                0170 #endif
                0171 
                0172 #ifdef TARGET_HP
                0173 #define USE_EXEMPLAR_THREADING
                0174 #endif
                0175 
                0176 #ifdef TARGET_CRAY_VECTOR
                0177 #define USE_C90_THREADING
                0178 #endif
                0179 
86f389907b Jean*0180 #ifdef USE_OMP_THREADING
                0181 #define USING_THREADS
                0182 #endif
                0183 
7f58e89433 Jean*0184 C--   Define the mapping for the _BARRIER macro
                0185 C     On some systems low-level hardware support can be accessed through
                0186 C     compiler directives here.
                0187 #define _BARRIER CALL BARRIER(myThid)
                0188 
9274434acc Jean*0189 C--   Define the mapping for the BEGIN_CRIT() and  END_CRIT() macros.
7f58e89433 Jean*0190 C     On some systems we simply execute this section only using the
                0191 C     master thread i.e. its not really a critical section. We can
                0192 C     do this because we do not use critical sections in any critical
                0193 C     sections of our code!
                0194 #define _BEGIN_CRIT(a) _BEGIN_MASTER(a)
                0195 #define _END_CRIT(a)   _END_MASTER(a)
                0196 
                0197 C--   Define the mapping for the BEGIN_MASTER_SECTION() and
                0198 C     END_MASTER_SECTION() macros. These are generally implemented by
                0199 C     simply choosing a particular thread to be "the master" and have
                0200 C     it alone execute the BEGIN_MASTER..., END_MASTER.. sections.
                0201 #define _BEGIN_MASTER(a)  IF ( a .EQ. 1 ) THEN
                0202 #define _END_MASTER(a)    ENDIF
                0203 
3d054304e0 Jean*0204 C- Note: global_sum/max macros were used to switch to  JAM routines (obsolete);
                0205 C  in addition, since only the R4 & R8 S/R are coded, GLOBAL RS & RL macros
                0206 C  enable to call the corresponding R4 or R8 S/R.
7f58e89433 Jean*0207 #ifdef REAL4_IS_SLOW
3d054304e0 Jean*0208 
7f58e89433 Jean*0209 #define _RS  Real*8
                0210 #define RS_IS_REAL8
3d054304e0 Jean*0211 #define _GLOBAL_SUM_RS(a,b)    CALL GLOBAL_SUM_R8( a, b )
                0212 #define _GLOBAL_MAX_RS(a,b)    CALL GLOBAL_MAX_R8( a, b )
                0213 #define _MPI_TYPE_RS MPI_DOUBLE_PRECISION
7f58e89433 Jean*0214 
3d054304e0 Jean*0215 #else /* REAL4_IS_SLOW */
7f58e89433 Jean*0216 
                0217 #define _RS  Real*4
                0218 #define RS_IS_REAL4
3d054304e0 Jean*0219 #define _GLOBAL_SUM_RS(a,b)    CALL GLOBAL_SUM_R4( a, b )
                0220 #define _GLOBAL_MAX_RS(a,b)    CALL GLOBAL_MAX_R4( a, b )
                0221 #define _MPI_TYPE_RS MPI_REAL
7f58e89433 Jean*0222 
3d054304e0 Jean*0223 #endif /* REAL4_IS_SLOW */
7f58e89433 Jean*0224 
3d054304e0 Jean*0225 #define _RL  Real*8
                0226 #define RL_IS_REAL8
                0227 #define _GLOBAL_SUM_RL(a,b)    CALL GLOBAL_SUM_R8( a, b )
                0228 #define _GLOBAL_MAX_RL(a,b)    CALL GLOBAL_MAX_R8( a, b )
                0229 #define _MPI_TYPE_RL MPI_DOUBLE_PRECISION
                0230 
86f389907b Jean*0231 #define _MPI_TYPE_R4 MPI_REAL
                0232 #if (defined (TARGET_SGI) || defined (TARGET_AIX) || defined (TARGET_LAM))
                0233 #define _MPI_TYPE_R8 MPI_DOUBLE_PRECISION
                0234 #else
                0235 #define _MPI_TYPE_R8 MPI_REAL8
                0236 #endif
                0237 #define _R4 Real*4
                0238 #define _R8 Real*8
                0239 
3d054304e0 Jean*0240 C- Note: a) exch macros were used to switch to  JAM routines (obsolete)
                0241 C        b) exch R4 & R8 macros are not practically used ; if needed,
                0242 C           will directly call the corrresponding S/R.
                0243 #define _EXCH_XY_RS(a,b) CALL EXCH_XY_RS ( a, b )
                0244 #define _EXCH_XY_RL(a,b) CALL EXCH_XY_RL ( a, b )
                0245 #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_RS ( a, b )
                0246 #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_RL ( a, b )
7f58e89433 Jean*0247 
                0248 C--   Control use of "double" precision constants.
                0249 C     Use D0 where it means REAL*8 but not where it means REAL*16
                0250 #ifdef REAL_D0_IS_16BYTES
                0251 #define D0
                0252 #endif
                0253 
                0254 C--   Substitue for 1.D variables
                0255 C     Sun compilers do not use 8-byte precision for literals
                0256 C     unless .Dnn is specified. CRAY vector machines use 16-byte
                0257 C     precision when they see .Dnn which runs very slowly!
                0258 #ifdef REAL_D0_IS_16BYTES
                0259 #define _F64( a ) a
                0260 #endif
                0261 #ifndef REAL_D0_IS_16BYTES
                0262 #define _F64( a ) DFLOAT( a )
                0263 #endif
                0264 
86f389907b Jean*0265 C--   Set the format for writing processor IDs, e.g. in S/R eeset_parms
                0266 C     and S/R open_copy_data_file. The default of I9.9 should work for
                0267 C     a long time (until we will use 10e10 processors and more)
                0268 #define FMT_PROC_ID 'I9.9'
                0269 
                0270 C--   Set the format for writing ensemble task IDs in S/R eeset_parms
                0271 C     and S/R open_copy_data_file.
                0272 #define FMT_TSK_ID 'I6.6'
                0273 
                0274 C--   Set ACTION= in OPEN instruction for input file (before doing IO)
                0275 C     leave it empty (if EXCLUDE_OPEN_ACTION) or set it to proper value
                0276 #ifdef EXCLUDE_OPEN_ACTION
                0277 # define _READONLY_ACTION
                0278 #else
                0279 # define _READONLY_ACTION ACTION='read',
                0280 #endif
3d054304e0 Jean*0281 
86f389907b Jean*0282 #endif /* _CPP_EEOPTIONS_H_ */