/[MITgcm]/MITgcm/eesupp/inc/CPP_EEMACROS.h
ViewVC logotype

Diff of /MITgcm/eesupp/inc/CPP_EEMACROS.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2.2.2 by jmc, Tue Apr 10 00:55:13 2001 UTC revision 1.26 by jmc, Wed Sep 13 22:12:35 2017 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4  C     /==========================================================\  CBOP
5  C     | CPP_EEMACROS.h                                           |  C     !ROUTINE: CPP_EEMACROS.h
6  C     |==========================================================|  C     !INTERFACE:
7  C     | C preprocessor "execution environment" supporting        |  C     include "CPP_EEMACROS.h"
8  C     | macros. Use this file to define macros for  simplifying  |  C     !DESCRIPTION:
9  C     | execution environment in which a model runs - as opposed |  C     *==========================================================*
10  C     | to the dynamical problem the model solves.               |  C     | CPP_EEMACROS.h
11  C     \==========================================================/  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_  #ifndef _CPP_EEMACROS_H_
20  #define _CPP_EEMACROS_H_  #define _CPP_EEMACROS_H_
# Line 29  C     Flag used to indicate which flavou Line 35  C     Flag used to indicate which flavou
35  C     compiler directives to use. Only set one of these.  C     compiler directives to use. Only set one of these.
36  C     USE_SOLARIS_THREADING  - Takes directives for SUN Workshop  C     USE_SOLARIS_THREADING  - Takes directives for SUN Workshop
37  C                              compiler.  C                              compiler.
38  C     USE_KAP_THREADING      - Takes directives for Kuck and  C     USE_KAP_THREADING      - Takes directives for Kuck and
39  C                              Associates multi-threading compiler  C                              Associates multi-threading compiler
40  C                              ( used on Digital platforms ).  C                              ( used on Digital platforms ).
41  C     USE_IRIX_THREADING     - Takes directives for SGI MIPS  C     USE_IRIX_THREADING     - Takes directives for SGI MIPS
# Line 40  C     USE_C90_THREADING      - Takes dir Line 46  C     USE_C90_THREADING      - Takes dir
46  C                              system F90 compiler.  C                              system F90 compiler.
47  #ifdef TARGET_SUN  #ifdef TARGET_SUN
48  #define USE_SOLARIS_THREADING  #define USE_SOLARIS_THREADING
49    #define USING_THREADS
50  #endif  #endif
51    
52  #ifdef TARGET_DEC  #ifdef TARGET_DEC
53  #define USE_KAP_THREADING  #define USE_KAP_THREADING
54    #define USING_THREADS
55  #endif  #endif
56    
57  #ifdef TARGET_SGI  #ifdef TARGET_SGI
58  #define USE_IRIX_THREADING  #define USE_IRIX_THREADING
59    #define USING_THREADS
60  #endif  #endif
61    
62  #ifdef TARGET_HP  #ifdef TARGET_HP
63  #define USE_EXEMPLAR_THREADING  #define USE_EXEMPLAR_THREADING
64    #define USING_THREADS
65  #endif  #endif
66    
67  #ifdef TARGET_CRAY_VECTOR  #ifdef TARGET_CRAY_VECTOR
68  #define USE_C90_THREADING  #define USE_C90_THREADING
69    #define USING_THREADS
70    #endif
71    
72    #ifdef USE_OMP_THREADING
73    #define USING_THREADS
74  #endif  #endif
75    
76  C--   Define the mapping for the _BARRIER macro  C--   Define the mapping for the _BARRIER macro
# Line 63  C     On some systems low-level hardware Line 78  C     On some systems low-level hardware
78  C     compiler directives here.  C     compiler directives here.
79  #define _BARRIER CALL BARRIER(myThid)  #define _BARRIER CALL BARRIER(myThid)
80    
81  C--   Define the mapping for the BEGIN_CRIT() and  END_CRIT() macros.  C--   Define the mapping for the BEGIN_CRIT() and  END_CRIT() macros.
82  C     On some systems we simply execute this section only using the  C     On some systems we simply execute this section only using the
83  C     master thread i.e. its not really a critical section. We can  C     master thread i.e. its not really a critical section. We can
84  C     do this because we do not use critical sections in any critical  C     do this because we do not use critical sections in any critical
# Line 75  C--   Define the mapping for the BEGIN_M Line 90  C--   Define the mapping for the BEGIN_M
90  C     END_MASTER_SECTION() macros. These are generally implemented by  C     END_MASTER_SECTION() macros. These are generally implemented by
91  C     simply choosing a particular thread to be "the master" and have  C     simply choosing a particular thread to be "the master" and have
92  C     it alone execute the BEGIN_MASTER..., END_MASTER.. sections.  C     it alone execute the BEGIN_MASTER..., END_MASTER.. sections.
93  #define _BEGIN_MASTER(a)  IF ( a .EQ. 1 ) THEN  
94  #define _END_MASTER(a)    ENDIF  #define _BEGIN_MASTER(a) IF ( a .EQ. 1 ) THEN
95    #define _END_MASTER(a)   ENDIF
96    CcnhDebugStarts
97    C      Alternate form to the above macros that increments (decrements) a counter each
98    C      time a MASTER section is entered (exited). This counter can then be checked in barrier
99    C      to try and detect calls to BARRIER within single threaded sections.
100    C      Using these macros requires two changes to Makefile - these changes are written
101    C      below.
102    C      1 - add a filter to the CPP command to kill off commented _MASTER lines
103    C      2 - add a filter to the CPP output the converts the string N EWLINE to an actual newline.
104    C      The N EWLINE needs to be changes to have no space when this macro and Makefile changes
105    C      are used. Its in here with a space to stop it getting parsed by the CPP stage in these
106    C      comments.
107    C      #define _BEGIN_MASTER(a)  IF ( a .EQ. 1 ) THEN  N EWLINE      CALL BARRIER_MS(a)
108    C      #define _END_MASTER(a)    CALL BARRIER_MU(a) N EWLINE        ENDIF
109    C      'CPP = cat $< | $(TOOLSDIR)/set64bitConst.sh |  grep -v '^[cC].*_MASTER' | cpp  -traditional -P'
110    C      .F.f:
111    C      $(CPP) $(DEFINES) $(INCLUDES) |  sed 's/N EWLINE/\n/' > $@
112    CcnhDebugEnds
113    
114  C--   Control storage of floating point operands  C--   Control storage of floating point operands
115  C     On many systems it improves performance only to use  C     On many systems it improves performance only to use
# Line 86  C     can use 4-byte precision, reducing Line 119  C     can use 4-byte precision, reducing
119  C     boosting performance because of a smaller working  C     boosting performance because of a smaller working
120  C     set size. However, on vector CRAY systems this degrades  C     set size. However, on vector CRAY systems this degrades
121  C     performance.  C     performance.
122    C- Note: global_sum/max macros were used to switch to  JAM routines (obsolete);
123    C  in addition, since only the R4 & R8 S/R are coded, GLOBAL RS & RL macros
124    C  enable to call the corresponding R4 or R8 S/R.
125  #ifdef REAL4_IS_SLOW  #ifdef REAL4_IS_SLOW
126  #define _RS Real*8  #define _RS Real*8
127  #define RS_IS_REAL8  #define RS_IS_REAL8
128  #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R8 ( a, b)  #define _GLOBAL_SUM_RS(a,b) CALL GLOBAL_SUM_R8 ( a, b)
129    #define _GLOBAL_MAX_RS(a,b) CALL GLOBAL_MAX_R8 ( a, b )
130    #define _MPI_TYPE_RS MPI_DOUBLE_PRECISION
131    #ifdef USE_OLD_MACROS_R4R8toRSRL
132    #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R8 ( a, b )
133  #define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R8 ( a, b )  #define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R8 ( a, b )
134    #endif
135  #else  #else
136  #define _RS Real*4  #define _RS Real*4
137  #define RS_IS_REAL4  #define RS_IS_REAL4
138    #define _GLOBAL_SUM_RS(a,b) CALL GLOBAL_SUM_R4 ( a, b )
139    #define _GLOBAL_MAX_RS(a,b) CALL GLOBAL_MAX_R4 ( a, b )
140    #define _MPI_TYPE_RS MPI_REAL
141    #ifdef USE_OLD_MACROS_R4R8toRSRL
142    cph Needed for some backward compatibility with broken packages
143  #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R4 ( a, b )  #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R4 ( a, b )
144  #define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R4 ( a, b )  #define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R4 ( a, b )
145  #endif  #endif
146  #define _EXCH_XY_R4(a,b) CALL EXCH_XY_RS ( a, b )  #endif
 #define _EXCH_XYZ_R4(a,b) CALL EXCH_XYZ_RS ( a, b )  
147    
148  #define _RL Real*8  #define _RL Real*8
149  #define _EXCH_XY_R8(a,b) CALL EXCH_XY_RL ( a, b )  #define RL_IS_REAL8
150  #define _EXCH_XYZ_R8(a,b) CALL EXCH_XYZ_RL ( a, b )  #define _GLOBAL_SUM_RL(a,b) CALL GLOBAL_SUM_R8 ( a, b )
151    #define _GLOBAL_MAX_RL(a,b) CALL GLOBAL_MAX_R8 ( a, b )
152    #ifdef USE_OLD_MACROS_R4R8toRSRL
153    cph Needed for some backward compatibility with broken packages
154  #define _GLOBAL_SUM_R8(a,b) CALL GLOBAL_SUM_R8 ( a, b )  #define _GLOBAL_SUM_R8(a,b) CALL GLOBAL_SUM_R8 ( a, b )
155  #define _GLOBAL_MAX_R8(a,b) CALL GLOBAL_MAX_R8 ( a, b )  #define _GLOBAL_MAX_R8(a,b) CALL GLOBAL_MAX_R8 ( a, b )
156    #endif
157    #define _MPI_TYPE_RL MPI_DOUBLE_PRECISION
158    
159    #define _MPI_TYPE_R4 MPI_REAL
160    #if (defined (TARGET_SGI) || defined (TARGET_AIX) || defined (TARGET_LAM))
161    #define _MPI_TYPE_R8 MPI_DOUBLE_PRECISION
162    #else
163    #define _MPI_TYPE_R8 MPI_REAL8
164    #endif
165    #define _R4 Real*4
166    #define _R8 Real*8
167    
168    C- Note: a) exch macros were used to switch to  JAM routines (obsolete)
169    C        b) exch R4 & R8 macros are not practically used ; if needed,
170    C           will directly call the corrresponding S/R.
171  #define _EXCH_XY_RS(a,b) CALL EXCH_XY_RS ( a, b )  #define _EXCH_XY_RS(a,b) CALL EXCH_XY_RS ( a, b )
 #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_RS ( a, b )  
172  #define _EXCH_XY_RL(a,b) CALL EXCH_XY_RL ( a, b )  #define _EXCH_XY_RL(a,b) CALL EXCH_XY_RL ( a, b )
173    #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_RS ( a, b )
174  #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_RL ( a, b )  #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_RL ( a, b )
175    #ifdef USE_OLD_MACROS_R4R8toRSRL
176    cph Needed for some backward compatibility with broken packages
177    #define _EXCH_XY_R4(a,b) CALL EXCH_XY_RS ( a, b )
178    #define _EXCH_XY_R8(a,b) CALL EXCH_XY_RL ( a, b )
179    #define _EXCH_XYZ_R4(a,b) CALL EXCH_XYZ_RS ( a, b )
180    #define _EXCH_XYZ_R8(a,b) CALL EXCH_XYZ_RL ( a, b )
181    #endif
182    
183  C--   Control use of JAM routines for Artic network  C--   Control use of JAM routines for Artic network (no longer supported)
184  C     These invoke optimized versions of "exchange" and "sum" that  C     These invoke optimized versions of "exchange" and "sum" that
185  C     utilize the programmable aspect of Artic cards.  C     utilize the programmable aspect of Artic cards.
186  #ifdef LETS_MAKE_JAM  CXXX No longer supported ; started to remove JAM routines.
187  #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b)  CXXX #ifdef LETS_MAKE_JAM
188  #define _EXCH_XY_R4(a,b) CALL EXCH_XY_R8_JAM ( a, b )  CXXX #define _GLOBAL_SUM_RS(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b)
189  #define _EXCH_XYZ_R4(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )  CXXX #define _GLOBAL_SUM_RL(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b )
190  #define _EXCH_XY_R8(a,b) CALL EXCH_XY_R8_JAM ( a, b )  CXXX #define _EXCH_XY_RS(a,b) CALL EXCH_XY_R8_JAM ( a, b )
191  #define _EXCH_XYZ_R8(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )  CXXX #define _EXCH_XY_RL(a,b) CALL EXCH_XY_R8_JAM ( a, b )
192  #define _GLOBAL_SUM_R8(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b )  CXXX #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )
193    CXXX #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )
194  #define _EXCH_XY_RS(a,b) CALL EXCH_XY_R8_JAM ( a, b )  CXXX #endif
195  #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )  
 #define _EXCH_XY_RL(a,b) CALL EXCH_XY_R8_JAM ( a, b )  
 #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )  
 #endif  
   
196  C--   Control use of "double" precision constants.  C--   Control use of "double" precision constants.
197  C     Use D0 where it means REAL*8 but not where it means REAL*16  C     Use D0 where it means REAL*8 but not where it means REAL*16
198  #ifdef REAL_D0_IS_16BYTES  #ifdef REAL_D0_IS_16BYTES
# Line 139  C     Sun compilers do not use 8-byte pr Line 204  C     Sun compilers do not use 8-byte pr
204  C     unless .Dnn is specified. CRAY vector machines use 16-byte  C     unless .Dnn is specified. CRAY vector machines use 16-byte
205  C     precision when they see .Dnn which runs very slowly!  C     precision when they see .Dnn which runs very slowly!
206  #ifdef REAL_D0_IS_16BYTES  #ifdef REAL_D0_IS_16BYTES
 #define _d  
207  #define _F64( a ) a  #define _F64( a ) a
208  #endif  #endif
209  #ifndef REAL_D0_IS_16BYTES  #ifndef REAL_D0_IS_16BYTES
 #define _d D  
210  #define _F64( a ) DFLOAT( a )  #define _F64( a ) DFLOAT( a )
211  #endif  #endif
212    
213    C--   Set the format for writing processor IDs, e.g. in S/R eeset_parms
214    C     and S/R open_copy_data_file. The default of I9.9 should work for
215    C     a long time (until we will use 10e10 processors and more)
216    #define FMT_PROC_ID 'I9.9'
217    
218  #endif /* _CPP_EEMACROS_H_ */  #endif /* _CPP_EEMACROS_H_ */

Legend:
Removed from v.1.2.2.2  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.22