HARM
harm and utilities
 All Data Structures Files Functions Variables Typedefs Macros Pages
makehead.inc
Go to the documentation of this file.
1 ###################
2 #
3 # see makefile.notes for detailed comments/notes
4 #
5 ###################
6 
7 #####################
8 #
9 # AUTO PICK SYSTEM TO COMPILE ON
10 #
11 #####################
12 
13 # for this to work, should put in .bashrc or at command-line before running make:
14 #export HOSTNAME
15 
16 
17 $(warning HOSTNAME is $(HOSTNAME))
18 $(warning CFLAGS is $(CFLAGS))
19 
20 
21 #############################
22 #
23 # Default is all compilers are not used, so can reference (e.g.) OSX being set to 0 or not.
24 # DO NOT CHANGE THESE ZEROS! Just use these as reference for what to add or change in the next section when you pick your system or compiler.
25 #
26 #############################
27 
28 # WATCH OUT FOR SPACES, etc. AFTER ASSIGNMENTS!!!!
29 USEGCC=0
30 USEICCGENERIC=0
31 USEICCINTEL=0
32 USEBG=0
33 #QUEENBEE (avoids making directories or forking in general)
34 USEQB=0
35 USEUB=0
36 USEOSX=0
37 # USEABE -> USEICCGENERIC is used
38 USECCC=0
39 USEORANGE=0
40 USENERSC=0
41 USEKRAKEN=0
42 USEKRAKENICC=0 # best to use for Kraken
43 USETACCLONESTAR4=0
44 USETACCLONESTAR=0
45 USETACCRANGER=0
46 USEPFE=0
47 USENAU=0
48 USESTAMPEDE=0
49 
50 
51 #####################
52 #
53 # PICK SYSTEM TO COMPILE ON. Only should change "HOSTNAME->COMPILER" section below, not default!
54 #
55 #####################
56 
57 hoststriped=$(shell echo $$HOSTNAME | sed 's/[0-9]*//g')
58 $(warning hoststriped is $(hoststriped))
59 
60 
61 ifeq ($(HOSTNAME),)
62 #############
63 # default compiler is GCC that will always be present on linux
64 #############
65 USEGCC=1
66 $(warning USEcompiler is set arbitrarily in makehead.inc. Put your system into makehead.inc to get specific compiler.)
67 
68 
69 else
70 #####################
71 # HOSTNAME->COMPILER: system name (HOSTNAME) chooses compiler to use. So don't have to have git repo keep changing for each user.
72 ####################
73 
74 ifeq ($(HOSTNAME),physics-179.umd.edu)
75 USEICCINTEL=1
76 #USEGCC=1
77 $(warning USEICCINTEL is $(USEICCINTEL))
78 else ifeq ($(hoststriped),krakenpf)
79 USEKRAKENICC=1
80 $(warning USEKRAKENICC is $(USEKRAKENICC))
81 else ifeq ($(HOSTNAME),ki-rh42)
82 USEICCINTEL=1
83 $(warning USEICCINTEL is $(USEICCINTEL))
84 else ifeq ($(HOSTNAME),ki-rh39)
85 USEICCINTEL=1
86 $(warning USEICCINTEL is $(USEICCINTEL))
87 else ifeq ($(HOSTNAME),ki-jmck)
88 USEICCINTEL=1
89 $(warning USEICCINTEL is $(USEICCINTEL))
90 else ifeq ($(hoststriped),login.stampede.tacc.utexas.edu)
91 USESTAMPEDE=1
92 $(warning USESTAMPEDE is $(USESTAMPEDE))
93 else ifeq ($(hoststriped),pfe)
94 USEPFE=1
95 $(warning USEPFE is $(USEPFE))
96 else ifeq ($(HOSTNAME),ubuntu)
97 USEICCINTEL=1
98 $(warning USEICCINTEL is $(USEICCINTEL))
99 else ifeq ($(HOSTNAME),bh00)
100 USEICCINTEL=1
101 $(warning USEICCINTEL is $(USEICCINTEL))
102 else ifeq ($(HOSTNAME),bhjet)
103 USEOSX=1
104 $(warning USEOSX is $(USEOSX))
105 else
106 #$(error USEcompiler never set!. Need to choose for your system: $(HOSTNAME) in makehead.inc .)
107 USEICCINTEL=1
108 $(warning USEICCINTEL is $(USEICCINTEL))
109 endif
110 
111 
112 ############
113 # end else if having HOSTNAME choose compiler.
114 ############
115 endif
116 
117 
118 
119 
120 
121 ########################
122 #
123 # PERFORMANCE CHECKS WITH GPROF
124 #
125 ########################
126 # default should be 0 since has large performance hit.
127 USEGPROF=0
128 
129 
130 ########################
131 #
132 # Debug information in binary
133 #
134 ########################
135 # Generally ok to have, no performance hit
136 # Required for using pfmon with intelligent output
137 USEDEBUG=1
138 
139 
140 
141 ########################
142 #
143 # BEGIN setup what compiling
144 #
145 ########################
146 
147 
148 ########################
149 #
150 # PREPARE COMMAND NAMES
151 #
152 ########################
153 PREP=prep
154 PREPF=prepf
155 PREPLD=prepgrmhdldouble
156 PREPLIAISON=prepliaison
157 PREPJONINTERP=prepiinterp
158 PREPBIN2TXT=prepbin2txt
159 PREPSMCALC=prepsmcalc
160 
161 ########################
162 #
163 # BINARY NAMES
164 #
165 ########################
166 DEFTARGET=
167 CMD=grmhd
168 CMD2=grmhdldouble
169 LIAISONCMD=liaison
170 JONINTERPCMD=iinterp
171 BIN2TXTCMD=bin2txt
172 SMCALCCMD=smcalc
173 
174 
175 # different target sets
176 MPITARGETS=$(DEFTARGET) $(CMD) $(CMD2) $(LIAISONCMD) $(PREP) $(PREPLD) $(PREPLAISON)
177 LAPACKTARGETS=$(DEFTARGET) $(CMD) $(CMD2) $(LIAISONCMD) $(JONINTERPCMD) $(PREP) $(PREPLD) $(PREPLAISON) $(PREPJONINTERP)
178 BINARYTARGETS=$(CMD) $(CMD2) $(LIAISONCMD)
179 
180 ########################
181 #
182 # Set default goal
183 #
184 ########################
185 .DEFAULT_GOAL := $(CMD)
186 
187 $(warning default goal is $(.DEFAULT_GOAL))
188 $(warning goal is $(MAKECMDGOALS))
189 $(warning MPITARGETS is $(MPITARGETS))
190 
191 # check for default make call
192 ifeq ($(MAKECMDGOALS),)
193 MYMAKECMDGOALS=$(.DEFAULT_GOAL)
194 else
195 MYMAKECMDGOALS=$(MAKECMDGOALS)
196 endif
197 
198 
199 
200 ########################
201 #
202 # DONE setup what compiling
203 #
204 ########################
205 
206 
207 
208 ########################
209 #
210 # MPI CHOICE
211 #
212 ########################
213 
214 #ifeq ($(MYMAKECMDGOALS),$(filter $(MYMAKECMDGOALS), $(MPITARGETS)))
215 ifneq ($(filter $(MPITARGETS), $(MYMAKECMDGOALS)),)
216 # choice for below
217 # i.e. MPI is only for grmhd, grmhdldouble, and liaison codes
218 USEMPI=1
219 
220 else
221 
222 # no choice for below
223 # i.e. no MPI for iinterp, bin2txt, or smcalc
224 USEMPI=0
225 
226 endif
227 
228 
229 
230 
231 ########################
232 #
233 # OpenMP CHOICE
234 #
235 # With icc and koralinsert and bounds.koral.c, issue with compile with OpenMP. Can turn off OpenMP for just that one file by trying compile and copying compile like for bounds.c and remove USINGOPENMP and -fopenmp
236 #
237 ########################
238 USEOPENMP=0
239 
240 
241 ########################
242 #
243 # Pthread CHOICE
244 #
245 ########################
246 USEPTHREAD=1
247 
248 
249 
250 # turns on -mp and -pc64 for USEICC?????=1
251 # Note that if using -pc64 -mp that error in inversion seems to be limited for doubles to 1E-11 instead of 1E-15
252 # causes code to be less accurate: e.g. inversion doesn't reach to 1E-15, but rather 1E-11
253 # for some simple linear wave tests with small amplitude can cause significant problems if any noise exists in intial solution
254 # With OpenMP and icc 10.1 20080602 this feature with:
255 # -O2 -finline -finline-functions -ip -fno-alias -unroll -Wall -Wcheck -Wshadow -w2 -wd=1419,869,177,310,593,810,981,1418 $(DFLAGS) -g
256 # caused the fluxcalc_fluxctstag_emf_1d() function fail to work properly. It would cause NaN's to random appear in different places. I tried to find any associated bug, but could not. Reverting to -O0 leads to no problems.
257 ENFORCEPRECISION=0
258 
259 
260 ###################
261 # LAPACK
262 # can easily see if MKL already setup by doing:
263 # echo ${MKLROOT}
264 # in bash and see if defined
265 #
266 # otherwise must do "source" command below before compiling with lapack:
267 # on 64-bit emulated machines (most intel/amd machines):
268 # source /opt/intel/mkl/10.0.3.020/tools/environment/mklvarsem64t.sh
269 # For true 64-bit machines and 32-bit machines different source
270 # true 64-bit:
271 # source /opt/intel/mkl/10.0.3.020/tools/environment/mklvars64.sh
272 # true 32-bit:
273 # source /opt/intel/mkl/10.0.3.020/tools/environment/mklvars32.sh
274 # and recall the directory will be different on each machine
275 #
276 # on ki-rh39 and orange:
277 # source /u/ki/jmckinne/intel/mkl/10.0.5.025/tools/environment/mklvarsem64t.sh
278 # or:
279 # source /u/ki/jmckinne/intel/mkl/10.0.3.020/tools/environment/mklvarsem64t.sh
280 #
281 # also see:
282 # http://www.netlib.org/eispack/
283 # http://www.netlib.org/lapack/double/dsyev.f
284 #
285 ifneq ($(filter $(LAPACKTARGETS), $(MYMAKECMDGOALS)),)
286 # choice for below
287 USELAPACK=1
288 # below is for new form of library -l line
289 USELAPACKNEW=1
290 else
291 # NO choice for below
292 USELAPACK=0
293 USELAPACKNEW=0
294 endif
295 #
296 ####################
297 
298 
299 # choice for below
300 # For Kraken, choose USEGSL=0 and comment-out #include "gslincludes.h" in global.general.h : Kraken doesn't have newer GSL that's required (missing gsl/gsl_odeiv2.h) and anyways has compile time issue for some reason.
301 USEGSL=0
302 #
303 ########################
304 
305 
306 
307 
308 
309 
310 
311 
312 
313 ##########################
314 #
315 # report
316 #
317 ##########################
318 
319 $(warning USEMPI is $(USEMPI))
320 $(warning USEOPENMP is $(USEOPENMP))
321 $(warning USEPTHREAD is $(USEPTHREAD))
322 $(warning USELAPACK is $(USELAPACK))
323 $(warning USELAPACKNEW is $(USELAPACKNEW))
324 $(warning ENFORCEPRECISION is $(ENFORCEPRECISION))
325 
326 
327 
328 #END
329 
330