-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
537 lines (459 loc) · 12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# Makefile for DDSCAT.7.3
vers=7.3.0
# upper-level targets:
# calltarget
# ddscat
# ddpostprocess
# vtrconvert
#--------- do NOT alter the following definitions: -------------------------
MPI_f = mpi_subs.f90 \
mpi_bcast_char.f90 mpi_bcast_cplx.f90 mpi_bcast_int.f90\
mpi_bcast_int2.f90 mpi_bcast_real.f90
MPI_o = mpi_subs.o \
mpi_bcast_char.o mpi_bcast_cplx.o mpi_bcast_int.o\
mpi_bcast_int2.o mpi_bcast_real.o
MKL_f = cxfft3_mkl.f90 mkl_dfti.f90
MKL_o = cxfft3_mkl.o mkl_dfti.o
MKL_m = mkl_dfti.mod
#---------------------------------------------------------------------------
# Here we explain the different strings that need to be defined:
# PRECISION
# ddscat can be compiled to use either single (sp) or double precision (dp)
# For most applications, sp appears to work fine, and is recommended for
# normal use.
# However, if ddscat is converging only very slowly or not at all, you can
# experiment with switching from sp to dp to see whether roundoff errors
# are compromising performance of the conjugate gradient solver.
# ** Important** : if you change from sp to dp, or from dp to sp:
# you must type
# make clean
# before typing
# make ddscat
# to use single precision, set
# PRECISION = sp
# to use double precision, set
# PRECISION = dp
#---------------------------------------------------------------------------
# OpenMP support
# OpenMP (www.openmp.org) can be used to use multiple threads on
# shared-memory nodes (e.g., a dual quad-core cpus can support up to
# 8 simultaneous threads).
# If OpenMP is not installed, leave OPENMP undefined:
# DOMP =
# OPENMP =
# If OpenMP is installed, and you would like to use it:
# DOMP = -Dopenmp
# OPENMP = -openmp
# or, on some systems (e.g., gfortran)
# OPENMP = -fopenmp
#-----------------------------------------------------------------------
# FFTMKL support
# If the Intel MKL library is installed, then set
# CXFFTMKL.f = $(MKL_f)
# CXFFTMKL.o = $(MKL_o)
# MKLM = $(MKL_m)
# If the Intel MKL library is not installed on system, then set
# CXFFTMKL.f = cxfft3_mkl_fake.f90
# CXFFTMKL.o = cxfft3_mkl_fake.o
# MKLM =
#-----------------------------------------------------------------------------
# MPI support
# Module DDSCAT.f90 require very minor editing to prepare it for
# either non-MPI use or use on a system with MPI support.
# Consult either the UserGuide (section 24.1) or comments within DDSCAT.f90
# for instructions on which line needs to be enabled
# and which line needs to be commented out.
# The strings MPI.f and MPI.o need to be appropriately defined.
# If MPI support is desired and the MPI library is installed, these are
# MPI.f = $(MPI_f)
# MPI.o = $(MPI_o)
# DMPI = -Dmpi
#
# If MPI support is not required, these are
# MPI.f = mpi_fake.f90
# MPI.o = mpi_fake.o
# DMPI =
#******************************************************************************
#
# Compiler and options
#
# FC specifies the fortran 90 compiler
# FFLAGS are compilation options
# LFLAGS are flags for linking
#
#############################################################################
# Examples
# 1. gfortran compiler
# dp + no MKL + OpenMP + no MPI
# define the following:
PRECISION = dp
CXFFTMKL.f = cxfft3_mkl_fake.f90
CXFFTMKL.o = cxfft3_mkl_fake.o
MKLM =
DOMP = -Dopenmp
OPENMP = -fopenmp
MPI.f = mpi_fake.f90
MPI.o = mpi_fake.o
DMPI =
FC = gfortran
FFLAGS = -O2 -march=native -ffloat-store
LFLAGS =
# 1.b gfortran compiler
# dp + no MKL + no OpenMP + no MPI
# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = gfortran
#FFLAGS = -O2 -march=native
#LFLAGS =
#-------------------------------------------------------------------
# 2. g95 compiler
# sp + no MKL + no OpenMP + no MPI
# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = g95
#FFLAGS = -O2
#LFLAGS =
#----------------------------------------------------------------------
# 3. ifort compiler
# sp + no MKL + no OpenMP + no MPI
# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS =
#----------------------------------------------------------------------
# 3.b ifort compiler
# dp + no MKL + no OpenMP + no MPI,
# define the following:
#PRECISION = dp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2 -C
#LFLAGS =
#----------------------------------------------------------------------
# 5. ifort compiler
# sp + MKL + no OpenMP + no MPI,
# define the following:
#PRECISION = sp
#CXFFTMKL.f = $(MKL_f)
#CXFFTMKL.o = $(MKL_o)
#MKLM = $(MKL_m)
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS =
#----------------------------------------------------------------------
# 6. ifort compiler
# sp + no MKL + OpenMP + no MPI,
# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP = -Dopenmp
#OPENMP = -openmp
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS =
#----------------------------------------------------------------------
# 7. ifort compiler
# sp + MKL + OpenMP + no MPI
# following definitions work for artemis
# before compiling, type
# module purge
# module load intel-mkl
# define the following:
#PRECISION = sp
#CXFFTMKL.f = $(MKL_f)
#CXFFTMKL.o = $(MKL_o)
#MKLM = $(MKL_m)
#DOMP = -Dopenmp
#OPENMP = -openmp
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS = -traceback -lmkl_em64t -lmkl_intel_thread -lmkl_core \
# -lguide -lpthread -lmkl_intel_lp64
#----------------------------------------------------------------------
# 8. ifort compiler (via mpif90)
# sp + MKL + OpenMP + MPI
# following definitions work for artemis
# before compiling, type
# module purge
# module load intel-mkl openmpi
# define the following:
#PRECISION = sp
#CXFFTMKL.f = $(MKL_f)
#CXFFTMKL.o = $(MKL_o)
#MKLM = $(MKL_m)
#DOMP = -Dopenmp
#OPENMP = -openmp
#MPI.f = $(MPI_f)
#MPI.o = $(MPI_o)
#DMPI = -Dmpi
#FC = mpif90
#FFLAGS = -O2
#LFLAGS = -traceback -lmkl_em64t -lmkl_intel_thread -lmkl_core \
# -lguide -lpthread -lmkl_intel_lp64 -lmpi
#******************************************************************************
#
# End of option specifications.
#
#******************************************************************************
# general rule for compilation of most .o files:
%.o: %.f90 ddprecision.mod ddcommon_1.mod cgmodule.mod
$(FC) -c $(FFLAGS) $(OPENMP) $< -o $@
# special cases:
DDSCAT.o: DDSCAT.f90 ddprecision.mod ddcommon_1.mod cgmodule.mod
cpp -P -traditional-cpp $(DMPI) $(DOMP) DDSCAT.f90 DDSCAT_cpp.f90
$(FC) -c $(FFLAGS) $(OPENMP) DDSCAT_cpp.f90 -o DDSCAT.o
rm DDSCAT_cpp.f90
DDVTR.o: DDVTR.f90 ddprecision.mod vtr.mod
$(FC) -c $(FFLAGS) DDVTR.f90 -o DDVTR.o
DDPOSTPROCESS.o: DDPOSTPROCESS.f90 ddprecision.mod readnf_bcom.mod \
readnf_ecom.mod vtr.mod
$(FC) -c $(FFLAGS) $(OPENMP) DDPOSTPROCESS.f90 \
-o DDPOSTPROCESS.o
bself.o: bself.f90 ddprecision.mod
cpp -P -traditional-cpp $(DOMP) bself.f90 bself_cpp.f90
$(FC) -c $(FFLAGS) $(OPENMP) bself_cpp.f90 -o bself.o
rm bself_cpp.f90
cgcommon.o: cgcommon.f90 ddprecision.mod
cpp -P -traditional-cpp -D$(PRECISION) cgcommon.f90 cgcommon_cpp.f90
$(FC) -c $(FFLAGS) $(OPENMP) cgcommon_cpp.f90 -o cgcommon.o
rm cgcommon_cpp.f90
cxfft3_mkl.o: cxfft3_mkl.f90 ddprecision.mod mkl_dfti.mod
$(FC) -c $(FFLAGS) $(OPENMP) cxfft3_mkl.f90 \
-o cxfft3_mkl.o
eself.o: eself.f90 ddprecision.mod
cpp -P -traditional-cpp $(DOMP) eself.f90 eself_cpp.f90
$(FC) -c $(FFLAGS) $(OPENMP) eself_cpp.f90 -o eself.o
rm eself_cpp.f90
scat.o: scat.f90 ddprecision.mod ddcommon_1.mod
cpp -P -traditional-cpp $(DOMP) scat.f90 scat_cpp.f90
$(FC) -c $(FFLAGS) $(OPENMP) scat_cpp.f90 -o scat.o
rm scat_cpp.f90
readnf.o: readnf.f90 ddprecision.mod readnf_bcom.mod readnf_ecom.mod
$(FC) -c $(FFLAGS) $(OPENMP) readnf.f90 \
-o readnf.o
# dependencies for ddscat:
OBJS = DDSCAT.o\
alphadiag.o\
blas.o\
bself.o \
ccgpack.o\
cgcommon.o\
cglib2.o\
cglib3.o\
cgsarkar2.o\
cgsarkar3.o\
cisi.o\
copyit.o\
cprod.o\
cxfft3n.o\
$(CXFFTMKL.o)\
cxfftw_fake.o\
ddcommon.o\
dielec.o\
divide.o\
dsyevj3.o\
dummy.o\
errmsg.o\
eself.o\
evala.o\
evale.o\
besseli0.o \
besseli1.o \
besselk0.o \
besselk1.o \
evalq.o\
extend.o\
gasdev.o\
getfml.o\
getmueller.o\
gpbicg.o\
gpfa.o\
interp.o\
$(MPI.o)\
namer.o\
namer2.o\
namid.o\
nearfield.o\
nuller.o\
orient.o\
p_lm.o\
pbcscavec.o\
pim.o\
prinaxis.o\
qmrpim2.o\
ran3.o\
reapar.o\
reashp.o\
reduce.o\
restore.o\
rot2.o\
rotate.o\
scat.o\
scavec.o\
tangcg.o\
tar2el.o\
tar2sp.o\
tar3el.o\
taranirec.o\
tarblocks.o\
tarcel.o\
tarcyl.o\
tarcylcap.o\
tarell.o\
target.o\
targspher.o\
tarhex.o\
tarlyrslab.o\
tarnas.o\
tarnsp.o\
tarpbxn.o\
tarprsm.o\
tarrctblk3.o\
tarrctell.o\
tarrec.o\
tarrecrec.o\
tarslbhol.o\
tartet.o\
timeit.o\
unreduce.o\
version.o\
wrimsg.o\
writebin.o\
writefml.o\
writepol.o\
writesca.o\
zbcg2wp.o
# dependencies for calltarget:
OBJS2 = CALLTARGET.o\
ddcommon.o\
dsyevj3.o\
errmsg.o\
gasdev.o\
p_lm.o\
prinaxis.o\
ran3.o\
reashp.o\
sizer.o\
tar2el.o\
tar2sp.o\
tar3el.o\
taranirec.o\
tarblocks.o\
tarcel.o\
tarcyl.o\
tarcylcap.o\
tarell.o\
target.o\
targspher.o\
tarhex.o\
tarlyrslab.o\
tarnas.o\
tarnsp.o\
tarpbxn.o\
tarprsm.o\
tarrctblk3.o\
tarrctell.o\
tarrec.o\
tarrecrec.o\
tarslbhol.o\
tartet.o\
wrimsg.o
# dependencies for ddpostprocess:
OBJS3 = DDPOSTPROCESS.o\
readnf_bcom.o\
readnf_ecom.o\
readnf.o\
vtr.o
# dependencies for vtrconvert:
OBJS4 = VTRCONVERT.o\
vtr.o
all: ddscat calltarget ddpostprocess vtrconvert
ddscat: ddprecision.mod ddcommon_1.mod $(MKLM) $(OBJS)
@echo 'LOADEDMODULES='$(LOADEDMODULES)
@echo 'LOADEDMODULES_modshare='$(LOADEDMODULES_modshare)
@echo 'LD_LIBRARY_PATH='$(LD_LIBRARY_PATH)
@echo 'LD_LIBRARY_PATH_modshare='$(LD_LIBRARY_PATH_modshare)
@echo 'MKLROOT='$(MKLROOT)
@echo 'CPATH='$(CPATH)
@echo 'FPATH='$(FPATH)
@echo 'DYLD_LIBRARY_PATH='$(DYLD_LIBRARY_PATH)
@echo 'INCLUDE='$(INCLUDE)
@echo 'LIBRARY_PATH='$(LIBRARY_PATH)
$(FC) -o ddscat \
$(OBJS) $(LFLAGS) $(OPENMP)
calltarget: ddprecision.mod ddcommon_1.mod $(OBJS2)
$(FC) -o calltarget \
$(OBJS2) $(LFLAGS)
ddpostprocess: ddprecision.mod readnf_bcom.mod readnf_ecom.mod vtr.mod $(OBJS3)
$(FC) -o ddpostprocess \
$(OBJS3) $(LFLAGS)
vtrconvert: ddprecision.mod vtr.o $(OBJS4)
$(FC) -o vtrconvert \
$(OBJS4) $(LFLAGS)
#--------------- modules ---------------------------------------------
cgmodule.mod: ddprecision.mod cgmodule.f90
$(FC) -c cgmodule.f90 -o cgmodule.o
ddprecision.mod: ddprecision.f90
cpp -P -traditional-cpp -D$(PRECISION) ddprecision.f90 \
ddprecision_cpp.f90
$(FC) -c $(FFLAGS) ddprecision_cpp.f90 -o ddprecision.o
rm ddprecision_cpp.f90
ddcommon_1.mod: ddprecision.mod ddcommon.f90
$(FC) -c ddcommon.f90 -o ddcommon.o
mkl_dfti.mod: mkl_dfti.f90
$(FC) -c mkl_dfti.f90 -o mkl_dfti.o
readnf_bcom.mod: readnf_bcom.f90
$(FC) -c readnf_bcom.f90 -o readnf_bcom.o
readnf_ecom.mod: readnf_ecom.f90
$(FC) -c readnf_ecom.f90 -o readnf_ecom.o
vtr.mod: vtr.f90
$(FC) -c vtr.f90 -o vtr.o
#---------------------------------------------------------------------
clean:; rm -f *.o make.out* *.mod
veryclean: clean
rm -f calltarget ddscat ddpostprocess