forked from wenqiang-geophys/dynfd3dcuda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
195 lines (161 loc) · 5.89 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
##############################################################################
# Makefile
##############################################################################
# configure CUDA and MPI path
#CUDAHOME := /home/wqzhang/cuda-10.1
#MPIHOME := /home/wqzhang/install/openmpi-gnu
CUDAHOME := /data/software/cuda-10.0
MPIHOME := /data/software/openmpi-gnu
NETCDFHOME := /public/software/netcdf-gnu
CC := $(MPIHOME)/bin/mpicxx
#CC := $(MPIHOME)/bin/mpicc
#CC := g++ -O2
#GC := nvcc -arch=sm_61 #--use_fast_math
#GC := nvcc -O3 -arch=sm_61 --ptxas-options=-v -maxrregcount=64
#GC := nvcc -O3 -arch=sm_61 -Xptxas=-v -maxrregcount=127
#GC := nvcc -O3 -arch=sm_61 -Xptxas=-v
GC := $(CUDAHOME)/bin/nvcc -O2 -arch=sm_61 -rdc=true #
#GC += -Xptxas=-v
#GC += -maxrregcount=127
#GC += -Xcompiler -march=native -ccbin g++ -m64
LIB := -L$(CUDAHOME)/lib64 -lcudart -L$(MPIHOME)/lib -lmpi
#LIB := -L$(CUDAHOME)/lib64 -L$(MPIHOME)/lib -lmpi
INC := -I$(CUDAHOME)/include -I$(MPIHOME)/include
DIR_BIN := ./bin
DIR_SRC := ./srcd
DIR_OBJ := ./obj
#=============================================================================
# Macros
#=============================================================================
# use double precison or not [optional]
DoublePrecision :=
# use PML or use Cerjan(1985) for absorbing [optional]
useCerjan :=
usePML := ON
# add traction free boundary condition [optional]
FreeSurface := ON
# choose data format (netCDF or binary data)
# Notice! useBin is not working at this stage,
# it will be completed in the future if necessary
useNetCDF := ON
useBin :=
# Dynamic rupture simulation [optional]
# elasitc wave simulation can be performed if the Rupture macro is not defined
Rupture := ON
# if the Rupture is ON, then select one of fault friction laws
# SW: slip weakening
# RS: rate-state
# [must choose one of them if Rupture is ON]
#SW := ON
#RS := ON
#-----------------------------------------------------------------------------
# benchmark problems of SECE/USGS website (http://scecdata.usc.edu/cvws/)
# these macros are defined to easily perform TPV problems
# [optional]
TPV6 :=
TPV10 :=
TPV28 :=
TPV29 :=
TPV101 :=
TPV102 :=
TPV103 :=
TPV104 :=
#-----------------------------------------------------------------------------
# use conservative form to solve moment equations [optional]
Conservative :=
#-----------------------------------------------------------------------------
# use traction image method (Zhang, 2006) to deal with the derivative of
# tractions on the fault, or just use low order FD schemes
# [must choose one of them]
TractionLow :=
TractionImg := ON
#-----------------------------------------------------------------------------
# use High-Order Compact FD scheme for calculating velocity derivatives
# near the fault surface
# [optional]
VHOC :=
#-----------------------------------------------------------------------------
DxV_OSD :=
DxV_OSD1 :=
DxV_NCFD :=
DxV_T1 := ON
DxV_T1f :=
DxV_24 :=
DyzV_center :=
DxV_hT1 :=
# perform gaussian smooth for the curved fault
FaultSmooth :=
#-----------------------------------------------------------------------------
# adpatively select long and short FD stencil on the fault
# [optional]
SelectStencil :=
RupSensor :=
#-----------------------------------------------------------------------------
# Prakash-Clifton Regularization for Bimaterial case
# [optional]
Regularize :=
#-----------------------------------------------------------------------------
# Grid Refinement in the Normal (x) direction of the fault
# [optional]
NormalRefine := ON
# Trial Traction Implementation in Runge-Kutte scheme
RKtrial :=
# thermpress
#Thermpress := ON
#-----------------------------------------------------------------------------
DFLAG_LIST := DoublePrecision FreeSurface useCerjan usePML \
useNetCDF useBin \
Rupture Regularize NormalRefine \
FaultSmooth SelectStencil \
Conservative \
TractionLow TractionImg \
VHOC DxV_OSD DxV_OSD1 DxV_NCFD DxV_T1 DxV_T1f DxV_hT1 DxV_24 DyzV_center \
RKtrial TP \
TPV6 TPV10 TPV28 TPV29 TPV101 TPV102 TPV103 TPV104
#SW RS \
DFLAGS := $(foreach flag,$(DFLAG_LIST),$(if $($(flag)),-D$(flag),)) $(DFLAGS)
DFLAGS := $(strip $(DFLAGS))
#=============================================================================
# use NetCDF or not
INC := $(INC) $(if $(useNetCDF), -I$(NETCDFHOME)/include)
LIB := $(LIB) $(if $(useNetCDF), -L$(NETCDFHOME)/lib -lnetcdf)
OBJS := cjson.o set_params.o alloc.o device.o init.o cerjan.o \
coord.o wave.o media.o source.o \
fault_coef.o \
rk4.o mathFuncs.o metric.o \
mod_mpi.o \
io_wave_xy.o io_wave_xz.o io_wave_yz.o \
rup_sensor.o \
main.o io_recv.o
OBJS += $(if $(usePML),init_pml.o pmlx.o pmly.o pmlz.o)
OBJS += $(if $(Rupture),\
transform.o fault_dvelo.o fault_dstrs_f.o fault_dstrs_b.o \
mod_mpi_fault.o io_fault.o)
#OBJS += $(if $(Rupture)$(SW),trial_slipweakening.o)
#OBJS += $(if $(Rupture)$(RS),trial_ratestate.o)
OBJS += $(if $(SW),trial_slipweakening.o)
OBJS += $(if $(RS),trial_ratestate.o)
OBJS += trial_slipweakening.o
OBJS += trial_ratestate.o
OBJS += $(if $(FaultSmooth),smooth.o)
#OBJS += $(if $(Thermpress),thermpress.o)
OBJS += thermpress.o
#OBJS += $(if $(TP),thermpress.o)
#OBJS += $(if $(FaultSmooth),filter.o)
OBJS := $(addprefix $(DIR_OBJ)/,$(OBJS))
vpath %.c .
vpath %.cu .
#
$(DIR_BIN)/a.out: $(OBJS)
$(GC) $^ $(LIB) -o $@
$(DIR_OBJ)/%.o : $(DIR_SRC)/%.c
$(CC) $(DFLAGS) $(INC) -c $^ -o $@
$(DIR_OBJ)/%.o : $(DIR_SRC)/%.cu
$(GC) $(DFLAGS) $(INC) -c $^ -o $@
tool:
g++ -Wall $(DIR_SRC)/tool_cal_fault_metric.c \
-o $(DIR_BIN)/tool_cal_fault_metric \
-I$(NETCDFHOME)/include -L$(NETCDFHOME)/lib -lnetcdf
clean:
rm -rf $(OBJS)
rm -rf $(DIR_BIN)/a.out