| 1 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/inc/CPP_EEMACROS.h,v 1.2.2.1 2001/03/28 19:48:49 adcroft Exp $ |
| 2 |
C $Name: $ |
| 3 |
|
| 4 |
C /==========================================================\ |
| 5 |
C | CPP_EEMACROS.h | |
| 6 |
C |==========================================================| |
| 7 |
C | C preprocessor "execution environment" supporting | |
| 8 |
C | macros. Use this file to define macros for simplifying | |
| 9 |
C | execution environment in which a model runs - as opposed | |
| 10 |
C | to the dynamical problem the model solves. | |
| 11 |
C \==========================================================/ |
| 12 |
|
| 13 |
#ifndef _CPP_EEMACROS_H_ |
| 14 |
#define _CPP_EEMACROS_H_ |
| 15 |
|
| 16 |
C In general the following convention applies: |
| 17 |
C ALLOW - indicates an feature will be included but it may |
| 18 |
C CAN have a run-time flag to allow it to be switched |
| 19 |
C on and off. |
| 20 |
C If ALLOW or CAN directives are "undef'd" this generally |
| 21 |
C means that the feature will not be available i.e. it |
| 22 |
C will not be included in the compiled code and so no |
| 23 |
C run-time option to use the feature will be available. |
| 24 |
C |
| 25 |
C ALWAYS - indicates the choice will be fixed at compile time |
| 26 |
C so no run-time option will be present |
| 27 |
|
| 28 |
C Flag used to indicate which flavour of multi-threading |
| 29 |
C compiler directives to use. Only set one of these. |
| 30 |
C USE_SOLARIS_THREADING - Takes directives for SUN Workshop |
| 31 |
C compiler. |
| 32 |
C USE_KAP_THREADING - Takes directives for Kuck and |
| 33 |
C Associates multi-threading compiler |
| 34 |
C ( used on Digital platforms ). |
| 35 |
C USE_IRIX_THREADING - Takes directives for SGI MIPS |
| 36 |
C Pro Fortran compiler. |
| 37 |
C USE_EXEMPLAR_THREADING - Takes directives for HP SPP series |
| 38 |
C compiler. |
| 39 |
C USE_C90_THREADING - Takes directives for CRAY/SGI C90 |
| 40 |
C system F90 compiler. |
| 41 |
#ifdef TARGET_SUN |
| 42 |
#define USE_SOLARIS_THREADING |
| 43 |
#endif |
| 44 |
|
| 45 |
#ifdef TARGET_DEC |
| 46 |
#define USE_KAP_THREADING |
| 47 |
#endif |
| 48 |
|
| 49 |
#ifdef TARGET_SGI |
| 50 |
#define USE_IRIX_THREADING |
| 51 |
#endif |
| 52 |
|
| 53 |
#ifdef TARGET_HP |
| 54 |
#define USE_EXEMPLAR_THREADING |
| 55 |
#endif |
| 56 |
|
| 57 |
#ifdef TARGET_CRAY_VECTOR |
| 58 |
#define USE_C90_THREADING |
| 59 |
#endif |
| 60 |
|
| 61 |
C-- Define the mapping for the _BARRIER macro |
| 62 |
C On some systems low-level hardware support can be accessed through |
| 63 |
C compiler directives here. |
| 64 |
#define _BARRIER CALL BARRIER(myThid) |
| 65 |
|
| 66 |
C-- Define the mapping for the BEGIN_CRIT() and END_CRIT() macros. |
| 67 |
C On some systems we simply execute this section only using the |
| 68 |
C master thread i.e. its not really a critical section. We can |
| 69 |
C do this because we do not use critical sections in any critical |
| 70 |
C sections of our code! |
| 71 |
#define _BEGIN_CRIT(a) _BEGIN_MASTER(a) |
| 72 |
#define _END_CRIT(a) _END_MASTER(a) |
| 73 |
|
| 74 |
C-- Define the mapping for the BEGIN_MASTER_SECTION() and |
| 75 |
C END_MASTER_SECTION() macros. These are generally implemented by |
| 76 |
C simply choosing a particular thread to be "the master" and have |
| 77 |
C it alone execute the BEGIN_MASTER..., END_MASTER.. sections. |
| 78 |
#define _BEGIN_MASTER(a) IF ( a .EQ. 1 ) THEN |
| 79 |
#define _END_MASTER(a) ENDIF |
| 80 |
|
| 81 |
C-- Control storage of floating point operands |
| 82 |
C On many systems it improves performance only to use |
| 83 |
C 8-byte precision for time stepped variables. |
| 84 |
C Constant in time terms ( geometric factors etc.. ) |
| 85 |
C can use 4-byte precision, reducing memory utilisation and |
| 86 |
C boosting performance because of a smaller working |
| 87 |
C set size. However, on vector CRAY systems this degrades |
| 88 |
C performance. |
| 89 |
#ifdef REAL4_IS_SLOW |
| 90 |
#define _RS Real*8 |
| 91 |
#define RS_IS_REAL8 |
| 92 |
#define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R8 ( a, b) |
| 93 |
#define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R8 ( a, b ) |
| 94 |
#else |
| 95 |
#define _RS Real*4 |
| 96 |
#define RS_IS_REAL4 |
| 97 |
#define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R4 ( a, b ) |
| 98 |
#define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R4 ( a, b ) |
| 99 |
#endif |
| 100 |
#define _EXCH_XY_R4(a,b) CALL EXCH_XY_RS ( a, b ) |
| 101 |
#define _EXCH_XYZ_R4(a,b) CALL EXCH_XYZ_RS ( a, b ) |
| 102 |
|
| 103 |
#define _RL Real*8 |
| 104 |
#define _EXCH_XY_R8(a,b) CALL EXCH_XY_RL ( a, b ) |
| 105 |
#define _EXCH_XYZ_R8(a,b) CALL EXCH_XYZ_RL ( a, b ) |
| 106 |
#define _GLOBAL_SUM_R8(a,b) CALL GLOBAL_SUM_R8 ( a, b ) |
| 107 |
#define _GLOBAL_MAX_R8(a,b) CALL GLOBAL_MAX_R8 ( a, b ) |
| 108 |
|
| 109 |
#define _EXCH_XY_RS(a,b) CALL EXCH_XY_RS ( a, b ) |
| 110 |
#define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_RS ( a, b ) |
| 111 |
#define _EXCH_XY_RL(a,b) CALL EXCH_XY_RL ( a, b ) |
| 112 |
#define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_RL ( a, b ) |
| 113 |
|
| 114 |
C-- Control use of JAM routines for Artic network |
| 115 |
C These invoke optimized versions of "exchange" and "sum" that |
| 116 |
C utilize the programmable aspect of Artic cards. |
| 117 |
#ifdef LETS_MAKE_JAM |
| 118 |
#define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b) |
| 119 |
#define _EXCH_XY_R4(a,b) CALL EXCH_XY_R8_JAM ( a, b ) |
| 120 |
#define _EXCH_XYZ_R4(a,b) CALL EXCH_XYZ_R8_JAM ( a, b ) |
| 121 |
#define _EXCH_XY_R8(a,b) CALL EXCH_XY_R8_JAM ( a, b ) |
| 122 |
#define _EXCH_XYZ_R8(a,b) CALL EXCH_XYZ_R8_JAM ( a, b ) |
| 123 |
#define _GLOBAL_SUM_R8(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b ) |
| 124 |
|
| 125 |
#define _EXCH_XY_RS(a,b) CALL EXCH_XY_R8_JAM ( a, b ) |
| 126 |
#define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_R8_JAM ( a, b ) |
| 127 |
#define _EXCH_XY_RL(a,b) CALL EXCH_XY_R8_JAM ( a, b ) |
| 128 |
#define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_R8_JAM ( a, b ) |
| 129 |
#endif |
| 130 |
|
| 131 |
C-- Control use of "double" precision constants. |
| 132 |
C Use D0 where it means REAL*8 but not where it means REAL*16 |
| 133 |
#ifdef REAL_D0_IS_16BYTES |
| 134 |
#define D0 |
| 135 |
#endif |
| 136 |
|
| 137 |
C-- Substitue for 1.D variables |
| 138 |
C Sun compilers do not use 8-byte precision for literals |
| 139 |
C unless .Dnn is specified. CRAY vector machines use 16-byte |
| 140 |
C precision when they see .Dnn which runs very slowly! |
| 141 |
#ifdef REAL_D0_IS_16BYTES |
| 142 |
#define _d |
| 143 |
#define _F64( a ) a |
| 144 |
#endif |
| 145 |
#ifndef REAL_D0_IS_16BYTES |
| 146 |
#define _d D |
| 147 |
#define _F64( a ) DFLOAT( a ) |
| 148 |
#endif |
| 149 |
|
| 150 |
#endif /* _CPP_EEMACROS_H_ */ |