-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
128 lines (97 loc) · 3.54 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
######################################################################
# Makefile: GPU-Cornell Multigrid Coupled Tsunami (GPUCOMCOT) Model #
# LAST REVISED: TAO CHIU MARCH 2018 #
#####################################################################
### Plese specify your fortran, cuda compiler and GPU's compute capabilities #####
FC = gfortran -g -cpp
FC_FLAGS = -O2
NVCC = nvcc -g
NVFLAGS =
NVCC_OPT = -arch=sm_61 -lineinfo
NVLIB = -L/usr/local/cuda-9.2/lib64
##################################################################################
NV_OBJECTS = GPUcomcot.o\
GPUall_grids.o\
GPUMass_s.o\
GPUMoment_s.o\
GPUOpen_BD.o\
GPUOutput.o
NV_DEVOBJ = nvobj.o
F90_MOD = type_module.o
F90_OBJECTS = comcot.o initialization.o output.o\
deform.o mass.o moment.o\
boundaries.o all_grids.o hotstart.o\
landslide.o wavemaker.o dispersion.o
.PHONY: cleandat cleanall cleanf90 cleancu clean
comcot: $(F90_OBJECTS) $(NV_OBJECTS) $(NV_DEVOBJ)
$(FC) -lstdc++ $(FC_FLAGS) $(F90_OBJECTS) $(F90_MOD) $(NVLIB) -lcudart $(NV_OBJECTS) $(NV_DEVOBJ) -o comcot
cleandat:
for file in *.[dt][ax]t ; do\
if [[ "$$file" = z_[0-9][0-9]_*.dat ]] ||\
[[ "$$file" = arrival_*.dat ]] ||\
[[ "$$file" = M1Layer*.txt ]] ||\
[[ "$$file" = [fhijmnvz]max_layer*.dat ]] ||\
[[ "$$file" = layer*.dat ]] ||\
[[ "$$file" = ts_record*.dat ]] ||\
[[ "$$file" = zmin_layer*.dat ]] ||\
[[ "$$file" = deform_seg[0-9][0-9][0-9].dat ]] ||\
[[ "$$file" = *_[0-9][0-9]_*.dat ]]; then\
$(RM) "$$file" ;\
fi;\
done
cleanf90:
rm comcot $(F90_OBJECTS) $(F90_MOD)
cleancu:
rm $(NV_OBJECTS) $(NV_DEVOBJ)
clean:
make cleanf90
make cleancu
cleanall:
make clean
make cleandat
########################## RULES FOR CUDA C ###########################
$(NV_DEVOBJ): $(NV_OBJECTS)
$(NVCC) $(NVCC_OPT) --device-link $(NV_OBJECTS) -o $(NV_DEVOBJ)
$(NV_OBJECTS) $(NV_DEVOBJ): GPUConfig.h GPUHeader.h
GPUcomcot.o: GPUcomcot.cu
$(NVCC) -c -rdc=true $(NVCC_OPT) $(NVFLAGS) GPUcomcot.cu
GPUMass_s.o: GPUMass_s.cu
$(NVCC) -c -rdc=true $(NVCC_OPT) $(NVFLAGS) GPUMass_s.cu
GPUMoment_s.o: GPUMoment_s.cu
$(NVCC) -c -rdc=true $(NVCC_OPT) $(NVFLAGS) GPUMoment_s.cu
GPUOpen_BD.o: GPUOpen_BD.cu
$(NVCC) -c -rdc=true $(NVCC_OPT) $(NVFLAGS) GPUOpen_BD.cu
GPUOutput.o: GPUOutput.cu
$(NVCC) -c -rdc=true $(NVCC_OPT) $(NVFLAGS) GPUOutput.cu
GPUall_grids.o: GPUall_grids.cu
$(NVCC) -c -rdc=true $(NVCC_OPT) $(NVFLAGS) GPUall_grids.cu
#######################################################################
################# RULES FOR FORTRAN #################
$(F90_MOD): type_module.f90
$(FC) -c $(FC_FLAGS) type_module.f90
$(F90_OBJECTS): $(F90_MOD)
comcot.o: comcot.f90
$(FC) -c $(FC_FLAGS) comcot.f90
initialization.o: initialization.f90
$(FC) -c $(FC_FLAGS) initialization.f90
output.o: output.f90
$(FC) -c $(FC_FLAGS) output.f90
deform.o: deform.f90
$(FC) -c $(FC_FLAGS) deform.f90
mass.o: mass.f90
$(FC) -c $(FC_FLAGS) mass.f90
moment.o: moment.f90
$(FC) -c $(FC_FLAGS) moment.f90
boundaries.o: boundaries.f90
$(FC) -c $(FC_FLAGS) boundaries.f90
all_grids.o: all_grids.f90
$(FC) -c $(FC_FLAGS) all_grids.f90
hotstart.o: hotstart.f90
$(FC) -c $(FC_FLAGS) hotstart.f90
landslide.o: landslide.f90
$(FC) -c $(FC_FLAGS) landslide.f90
wavemaker.o: wavemaker.f90
$(FC) -c $(FC_FLAGS) wavemaker.f90
dispersion.o: dispersion.f90
$(FC) -c $(FC_FLAGS) dispersion.f90
####################################################