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

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

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


Revision 1.13 - (hide annotations) (download)
Tue Nov 8 15:53:41 2005 UTC (18 years, 6 months ago) by cnh
Branch: MAIN
Changes since 1.12: +21 -3 lines
File MIME type: text/plain
Changes toward getting exf working multi-threaded.
  o added some opitonal consistency check in barrier for
    trapping barrier calls in singel threaded region
  o removed a single thread block in ini_depths - singleCpuIO
    still broken.
  o modified parts of exf_ that were setting local stack variables
    in single threaded section and then referencing them from all
    threads.
  o commented out strange stop in mdsio for multithreading which
    seems uneeded.
  o fixed ptracers initialization and changed ptracers monitor
    to avoid race condition in which several threads set a shared
    logical flag at arbitrary moments with respect to each other

1 cnh 1.13 C $Header: /u/gcmpack/MITgcm/eesupp/inc/CPP_EEMACROS.h,v 1.12 2005/02/18 19:43:27 ce107 Exp $
2 adcroft 1.4 C $Name: $
3    
4 cnh 1.5 CBOP
5     C !ROUTINE: CPP_EEMACROS.h
6     C !INTERFACE:
7     C include "CPP_EEMACROS.h "
8     C !DESCRIPTION:
9     C *==========================================================*
10 dimitri 1.9 C | CPP_EEMACROS.h
11 cnh 1.5 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 adcroft 1.1
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 cnh 1.13
85     #define _BEGIN_MASTER(a) IF ( a .EQ. 1 ) THEN
86     #define _END_MASTER(a) ENDIF
87     CcnhDebugStarts
88     C Alternate form to the above macros that increments (decrements) a counter each
89     C time a MASTER section is entered (exited). This counter can then be checked in barrier
90     C to try and detect calls to BARRIER within single threaded sections.
91     C Using these macros requires two changes to Makefile - these changes are written
92     C below.
93     C 1 - add a filter to the CPP command to kill off commented _MASTER lines
94     C 2 - add a filter to the CPP output the converts the string N EWLINE to an actual newline.
95     C The N EWLINE needs to be changes to have no space when this macro and Makefile changes
96     C are used. Its in here with a space to stop it getting parsed by the CPP stage in these
97     C comments.
98     C #define _BEGIN_MASTER(a) IF ( a .EQ. 1 ) THEN N EWLINE CALL BARRIER_MS(a)
99     C #define _END_MASTER(a) CALL BARRIER_MU(a) N EWLINE ENDIF
100     C 'CPP = cat $< | $(TOOLSDIR)/set64bitConst.sh | grep -v '^[cC].*_MASTER' | cpp -traditional -P'
101     C .F.f:
102     C $(CPP) $(DEFINES) $(INCLUDES) | sed 's/N EWLINE/\n/' > $@
103     CcnhDebugEnds
104 adcroft 1.1
105     C-- Control storage of floating point operands
106     C On many systems it improves performance only to use
107     C 8-byte precision for time stepped variables.
108     C Constant in time terms ( geometric factors etc.. )
109     C can use 4-byte precision, reducing memory utilisation and
110     C boosting performance because of a smaller working
111     C set size. However, on vector CRAY systems this degrades
112     C performance.
113     #ifdef REAL4_IS_SLOW
114     #define _RS Real*8
115     #define RS_IS_REAL8
116 adcroft 1.4 #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R8 ( a, b)
117 adcroft 1.1 #define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R8 ( a, b )
118 dimitri 1.6 #define _MPI_TYPE_RS MPI_DOUBLE_PRECISION
119 adcroft 1.1 #else
120     #define _RS Real*4
121     #define RS_IS_REAL4
122     #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R4 ( a, b )
123     #define _GLOBAL_MAX_R4(a,b) CALL GLOBAL_MAX_R4 ( a, b )
124 dimitri 1.6 #define _MPI_TYPE_RS MPI_REAL
125 adcroft 1.1 #endif
126 dimitri 1.10 #define _EXCH_XY_R4(a,b) CALL EXCH_XY_RL ( a, b )
127     #define _EXCH_XYZ_R4(a,b) CALL EXCH_XYZ_RL ( a, b )
128 adcroft 1.1
129     #define _RL Real*8
130 dimitri 1.10 #define _EXCH_XY_R8(a,b) CALL EXCH_XY_RL ( a, b )
131     #define _EXCH_XYZ_R8(a,b) CALL EXCH_XYZ_RL ( a, b )
132 adcroft 1.4 #define _GLOBAL_SUM_R8(a,b) CALL GLOBAL_SUM_R8 ( a, b )
133 adcroft 1.1 #define _GLOBAL_MAX_R8(a,b) CALL GLOBAL_MAX_R8 ( a, b )
134 dimitri 1.6 #define _MPI_TYPE_RL MPI_DOUBLE_PRECISION
135 adcroft 1.4
136 dimitri 1.10 #define _EXCH_XY_RS(a,b) CALL EXCH_XY_RL ( a, b )
137     #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_RL ( a, b )
138     #define _EXCH_XY_RL(a,b) CALL EXCH_XY_RL ( a, b )
139     #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_RL ( a, b )
140 dimitri 1.9
141     #define _MPI_TYPE_R4 MPI_REAL
142 ce107 1.12 #if (defined (TARGET_SGI) || defined (TARGET_AIX) || defined (TARGET_LAM))
143 dimitri 1.9 #define _MPI_TYPE_R8 MPI_DOUBLE_PRECISION
144     #else
145     #define _MPI_TYPE_R8 MPI_REAL8
146     #endif
147     #define _R4 Real*4
148     #define _R8 Real*8
149 adcroft 1.4
150     C-- Control use of JAM routines for Artic network
151     C These invoke optimized versions of "exchange" and "sum" that
152     C utilize the programmable aspect of Artic cards.
153     #ifdef LETS_MAKE_JAM
154     #define _GLOBAL_SUM_R4(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b)
155     #define _EXCH_XY_R4(a,b) CALL EXCH_XY_R8_JAM ( a, b )
156     #define _EXCH_XYZ_R4(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )
157     #define _EXCH_XY_R8(a,b) CALL EXCH_XY_R8_JAM ( a, b )
158     #define _EXCH_XYZ_R8(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )
159     #define _GLOBAL_SUM_R8(a,b) CALL GLOBAL_SUM_R8_JAM ( a, b )
160    
161     #define _EXCH_XY_RS(a,b) CALL EXCH_XY_R8_JAM ( a, b )
162     #define _EXCH_XYZ_RS(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )
163     #define _EXCH_XY_RL(a,b) CALL EXCH_XY_R8_JAM ( a, b )
164     #define _EXCH_XYZ_RL(a,b) CALL EXCH_XYZ_R8_JAM ( a, b )
165     #endif
166 adcroft 1.1
167     C-- Control use of "double" precision constants.
168     C Use D0 where it means REAL*8 but not where it means REAL*16
169     #ifdef REAL_D0_IS_16BYTES
170     #define D0
171     #endif
172    
173     C-- Substitue for 1.D variables
174     C Sun compilers do not use 8-byte precision for literals
175     C unless .Dnn is specified. CRAY vector machines use 16-byte
176     C precision when they see .Dnn which runs very slowly!
177     #ifdef REAL_D0_IS_16BYTES
178 dimitri 1.7 #define _d E
179 adcroft 1.1 #define _F64( a ) a
180     #endif
181     #ifndef REAL_D0_IS_16BYTES
182     #define _d D
183     #define _F64( a ) DFLOAT( a )
184     #endif
185    
186     #endif /* _CPP_EEMACROS_H_ */

  ViewVC Help
Powered by ViewVC 1.1.22