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