|
||||
File indexing completed on 2022-04-14 05:08:57 UTC
view on githubraw file Latest commit 3d93c0a0 on 2022-04-13 15:21:38 UTC4c563c2ee9 Chri*0001 CBOP 2467a0374a Jean*0002 C !ROUTINE: CPP_EEMACROS.h 4c563c2ee9 Chri*0003 C !INTERFACE: ae1d98edd6 Jean*0004 C include "CPP_EEMACROS.h" 4c563c2ee9 Chri*0005 C !DESCRIPTION: 0006 C *==========================================================* 2467a0374a Jean*0007 C | CPP_EEMACROS.h 4c563c2ee9 Chri*0008 C *==========================================================* 2467a0374a Jean*0009 C | C preprocessor "execution environment" supporting 0010 C | macros. Use this file to define macros for simplifying 0011 C | execution environment in which a model runs - as opposed 0012 C | to the dynamical problem the model solves. 4c563c2ee9 Chri*0013 C *==========================================================* 0014 CEOP 6b34767493 Alis*0015 0016 #ifndef _CPP_EEMACROS_H_ 0017 #define _CPP_EEMACROS_H_ 0018 0019 C In general the following convention applies: 0020 C ALLOW - indicates an feature will be included but it may 0021 C CAN have a run-time flag to allow it to be switched 0022 C on and off. 0023 C If ALLOW or CAN directives are "undef'd" this generally 0024 C means that the feature will not be available i.e. it 0025 C will not be included in the compiled code and so no 0026 C run-time option to use the feature will be available. 0027 C 0028 C ALWAYS - indicates the choice will be fixed at compile time 0029 C so no run-time option will be present 0030 0031 C Flag used to indicate which flavour of multi-threading 0032 C compiler directives to use. Only set one of these. 0033 C USE_SOLARIS_THREADING - Takes directives for SUN Workshop 0034 C compiler. 2467a0374a Jean*0035 C USE_KAP_THREADING - Takes directives for Kuck and 6b34767493 Alis*0036 C Associates multi-threading compiler 0037 C ( used on Digital platforms ). 0038 C USE_IRIX_THREADING - Takes directives for SGI MIPS 0039 C Pro Fortran compiler. 0040 C USE_EXEMPLAR_THREADING - Takes directives for HP SPP series 0041 C compiler. 0042 C USE_C90_THREADING - Takes directives for CRAY/SGI C90 0043 C system F90 compiler. 0044 #ifdef TARGET_SUN 0045 #define USE_SOLARIS_THREADING 2e7833c3c9 Chri*0046 #define USING_THREADS 6b34767493 Alis*0047 #endif 0048 0049 #ifdef TARGET_DEC 0050 #define USE_KAP_THREADING 2e7833c3c9 Chri*0051 #define USING_THREADS 6b34767493 Alis*0052 #endif 0053 0054 #ifdef TARGET_SGI 0055 #define USE_IRIX_THREADING 2e7833c3c9 Chri*0056 #define USING_THREADS 6b34767493 Alis*0057 #endif 0058 0059 #ifdef TARGET_HP 0060 #define USE_EXEMPLAR_THREADING 2e7833c3c9 Chri*0061 #define USING_THREADS 6b34767493 Alis*0062 #endif 0063 0064 #ifdef TARGET_CRAY_VECTOR 0065 #define USE_C90_THREADING 2e7833c3c9 Chri*0066 #define USING_THREADS 0067 #endif 0068 0069 #ifdef USE_OMP_THREADING 0070 #define USING_THREADS 6b34767493 Alis*0071 #endif 0072 0073 C-- Define the mapping for the _BARRIER macro 0074 C On some systems low-level hardware support can be accessed through 0075 C compiler directives here. 0076 #define _BARRIER CALL BARRIER(myThid) 0077 2467a0374a Jean*0078 C-- Define the mapping for the BEGIN_CRIT() and END_CRIT() macros. 6b34767493 Alis*0079 C On some systems we simply execute this section only using the 0080 C master thread i.e. its not really a critical section. We can 0081 C do this because we do not use critical sections in any critical 0082 C sections of our code! 0083 #define _BEGIN_CRIT(a) _BEGIN_MASTER(a) 0084 #define _END_CRIT(a) _END_MASTER(a) 0085 0086 C-- Define the mapping for the BEGIN_MASTER_SECTION() and 0087 C END_MASTER_SECTION() macros. These are generally implemented by 0088 C simply choosing a particular thread to be "the master" and have 0089 C it alone execute the BEGIN_MASTER..., END_MASTER.. sections. 5bfeee1bf0 Chri*0090 0091 #define _BEGIN_MASTER(a) IF ( a .EQ. 1 ) THEN 0092 #define _END_MASTER(a) ENDIF 0093 CcnhDebugStarts 0094 C Alternate form to the above macros that increments (decrements) a counter each 0095 C time a MASTER section is entered (exited). This counter can then be checked in barrier 0096 C to try and detect calls to BARRIER within single threaded sections. 0097 C Using these macros requires two changes to Makefile - these changes are written 0098 C below. 0099 C 1 - add a filter to the CPP command to kill off commented _MASTER lines 0100 C 2 - add a filter to the CPP output the converts the string N EWLINE to an actual newline. 0101 C The N EWLINE needs to be changes to have no space when this macro and Makefile changes 0102 C are used. Its in here with a space to stop it getting parsed by the CPP stage in these 0103 C comments. 0104 C #define _BEGIN_MASTER(a) IF ( a .EQ. 1 ) THEN N EWLINE CALL BARRIER_MS(a) 0105 C #define _END_MASTER(a) CALL BARRIER_MU(a) N EWLINE ENDIF 0106 C 'CPP = cat $< | $(TOOLSDIR)/set64bitConst.sh | grep -v '^[cC].*_MASTER' | cpp -traditional -P' 0107 C .F.f: 4aea938d76 Jean*0108 C $(CPP) $(DEFINES) $(INCLUDES) | sed 's/N EWLINE/\n/' > $@ 5bfeee1bf0 Chri*0109 CcnhDebugEnds 6b34767493 Alis*0110 0111 C-- Control storage of floating point operands 0112 C On many systems it improves performance only to use 0113 C 8-byte precision for time stepped variables. 0114 C Constant in time terms ( geometric factors etc.. ) 0115 C can use 4-byte precision, reducing memory utilisation and 0116 C boosting performance because of a smaller working 0117 C set size. However, on vector CRAY systems this degrades 0118 C performance. 2467a0374a Jean*0119 C- Note: global_sum/max macros were used to switch to JAM routines (obsolete); 0120 C in addition, since only the R4 & R8 S/R are coded, GLOBAL RS & RL macros 0121 C enable to call the corresponding R4 or R8 S/R. 6b34767493 Alis*0122 #ifdef REAL4_IS_SLOW 0123 #define _RS Real*8 0124 #define RS_IS_REAL8 2467a0374a Jean*0125 #define _GLOBAL_SUM_RS(a,b) CALL GLOBAL_SUM_R8 ( a, b) 0126 #define _GLOBAL_MAX_RS(a,b) CALL GLOBAL_MAX_R8 ( a, b ) fa1dae9534 Dimi*0127 #define _MPI_TYPE_RS MPI_DOUBLE_PRECISION 6b34767493 Alis*0128 #else 0129 #define _RS Real*4 0130 #define RS_IS_REAL4 2467a0374a Jean*0131 #define _GLOBAL_SUM_RS(a,b) CALL GLOBAL_SUM_R4 ( a, b ) 0132 #define _GLOBAL_MAX_RS(a,b) CALL GLOBAL_MAX_R4 ( a, b ) fa1dae9534 Dimi*0133 #define _MPI_TYPE_RS MPI_REAL 387b9272e0 Patr*0134 #endif 6b34767493 Alis*0135 0136 #define _RL Real*8 9bcca379b4 Ed H*0137 #define RL_IS_REAL8 2467a0374a Jean*0138 #define _GLOBAL_SUM_RL(a,b) CALL GLOBAL_SUM_R8 ( a, b ) 0139 #define _GLOBAL_MAX_RL(a,b) CALL GLOBAL_MAX_R8 ( a, b ) fa1dae9534 Dimi*0140 #define _MPI_TYPE_RL MPI_DOUBLE_PRECISION aea29c8517 Alis*0141 e0692723ae Dimi*0142 #define _MPI_TYPE_R4 MPI_REAL d86928d456 Cons*0143 #if (defined (TARGET_SGI) || defined (TARGET_AIX) || defined (TARGET_LAM)) e0692723ae Dimi*0144 #define _MPI_TYPE_R8 MPI_DOUBLE_PRECISION 0145 #else 0146 #define _MPI_TYPE_R8 MPI_REAL8 0147 #endif 0148 #define _R4 Real*4 0149 #define _R8 Real*8 aea29c8517 Alis*0150 2467a0374a Jean*0151 C- Note: a) exch macros were used to switch to JAM routines (obsolete) 0152 C b) exch R4 & R8 macros are not practically used ; if needed, 0153 C will directly call the corrresponding S/R. 0154 #define _EXCH_XY_RS(a,b) CALL EXCH_XY_RS ( a, b ) 0155 #define _EXCH_XY_RL(a,b) CALL EXCH_XY_RL ( a, b ) 0156 #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_RS ( a, b ) 0157 #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_RL ( a, b ) 0158 0159 C-- Control use of JAM routines for Artic network (no longer supported) aea29c8517 Alis*0160 C These invoke optimized versions of "exchange" and "sum" that 0161 C utilize the programmable aspect of Artic cards. 92dda24350 Jean*0162 CXXX No longer supported ; started to remove JAM routines. 0163 CXXX #ifdef LETS_MAKE_JAM 0164 CXXX #define _GLOBAL_SUM_RS(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b) 0165 CXXX #define _GLOBAL_SUM_RL(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b ) 0166 CXXX #define _EXCH_XY_RS(a,b) CALL EXCH_XY_R8_JAM ( a, b ) 0167 CXXX #define _EXCH_XY_RL(a,b) CALL EXCH_XY_R8_JAM ( a, b ) 0168 CXXX #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_R8_JAM ( a, b ) 0169 CXXX #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_R8_JAM ( a, b ) 0170 CXXX #endif 2467a0374a Jean*0171 6b34767493 Alis*0172 C-- Control use of "double" precision constants. 0173 C Use D0 where it means REAL*8 but not where it means REAL*16 0174 #ifdef REAL_D0_IS_16BYTES 0175 #define D0 0176 #endif 0177 0178 C-- Substitue for 1.D variables 0179 C Sun compilers do not use 8-byte precision for literals 0180 C unless .Dnn is specified. CRAY vector machines use 16-byte 0181 C precision when they see .Dnn which runs very slowly! 0182 #ifdef REAL_D0_IS_16BYTES 0183 #define _F64( a ) a 0184 #endif 0185 #ifndef REAL_D0_IS_16BYTES 0186 #define _F64( a ) DFLOAT( a ) 0187 #endif 0188 38c2795bd1 Mart*0189 C-- Set the format for writing processor IDs, e.g. in S/R eeset_parms 0190 C and S/R open_copy_data_file. The default of I9.9 should work for 0191 C a long time (until we will use 10e10 processors and more) 0192 #define FMT_PROC_ID 'I9.9' 0193 c3d0b098ae Lars*0194 C-- Set the format for writing ensemble task IDs in S/R eeset_parms 0195 C and S/R open_copy_data_file. 0196 #define FMT_TSK_ID 'I6.6' 0197 3d93c0a01e Ou W*0198 C-- Set ACTION= in OPEN instruction for input file (before doing IO) 0199 C leave it empty (if EXCLUDE_OPEN_ACTION) or set it to proper value 0200 #ifdef EXCLUDE_OPEN_ACTION 0201 # define _READONLY_ACTION 0202 #else 0203 # define _READONLY_ACTION ACTION='read', 0204 #endif 0205 6b34767493 Alis*0206 #endif /* _CPP_EEMACROS_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated from https://github.com/MITgcm/MITgcm by the 2.2.1-MITgcm-0.1 LXR engine. The LXR team |