-
Notifications
You must be signed in to change notification settings - Fork 35
/
Make.Microphysics
238 lines (171 loc) · 7.4 KB
/
Make.Microphysics
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
AMREX_HOME ?= /path/to/amrex
MICROPHYSICS_HOME ?= /path/to/Castro
# use our .clang-tidy with the AMReX USE_CLANG_TIDY=TRUE build
CLANG_TIDY_CONFIG_FILE := $(MICROPHYSICS_HOME)/.clang-tidy
# space-separated list of paths to skip when running clang-tidy
CLANG_TIDY_IGNORE_SOURCES = $(AMREX_HOME)/Src
# default is not to compile with CUDA
USE_CUDA ?= FALSE
CUDA_VERBOSE ?= FALSE
# default is not to compile in the conductivity
USE_CONDUCTIVITY ?= FALSE
TOP := $(MICROPHYSICS_HOME)
# default microphysics locations
EOS_HOME ?= $(TOP)/EOS
NETWORK_HOME ?= $(TOP)/networks
CONDUCTIVITY_HOME ?= $(TOP)/conductivity
NSE_TABULAR_HOME ?= $(TOP)/nse_tabular
EBASE ?= main
# EXTERN_CORE is simply a list of the directories we use in EOS,
# Networks and Util this list will be searched for runtime parameters
EXTERN_CORE ?=
ifeq ($(USE_MICROPHYSICS_DEBUG),TRUE)
DEFINES += -DMICROPHYSICS_DEBUG
endif
# Require C++17
CXXSTD := c++17
ifeq ($(USE_GPU_PRINTF),TRUE)
DEFINES += -DALLOW_GPU_PRINTF
endif
include $(AMREX_HOME)/Tools/GNUMake/Make.defs
MICROPHYSICS_AUTO_SOURCE_DIR := $(TmpBuildDir)/microphysics_sources/$(optionsSuffix).EXE
all: build_status $(executable) starkiller_library
@echo SUCCESS
build_status:
$(AMREX_HOME)/Tools/C_scripts/describe_sources.py \
--git_names "Microphysics AMReX" \
--git_dirs "$(TOP) $(AMREX_HOME)"
starkiller_library: $(executable)
ifeq ($(USE_COMPILE_WITH_F2PY), TRUE)
@echo Wrapping sources with f90wrap ...
sh dowrap.sh
@echo Linking objects with f2py ...
sh dof2py.sh
endif
# Use a coarse grained OMP approach
DEFINES += -DCRSEGRNDOMP
# OpenACC support
ifeq ($(USE_ACC), TRUE)
DEFINES += -DACC
endif
ifeq ($(USE_REACT), TRUE)
DEFINES += -DREACTIONS
endif
ifeq ($(USE_REACT_SPARSE_JACOBIAN), TRUE)
DEFINES += -DREACT_SPARSE_JACOBIAN
# The following is sometimes useful to turn on for debugging sparse J indices
# (if a get/set/scale is called with (row, col) not in the sparse J, stop)
# Otherwise, set/scale do nothing, and get returns 0.
ifeq ($(USE_SPARSE_STOP_ON_OOB), TRUE)
DEFINES += -DSPARSE_STOP_ON_OOB
endif
endif
ifeq ($(USE_COMPILE_WITH_F2PY), TRUE)
DEFINES += -DCOMPILE_WITH_F2PY
endif
#------------------------------------------------------------------------------
# AMReX
#------------------------------------------------------------------------------
# core AMReX directories -- note the Make.package for these adds these
# directories into VPATH_LOCATIONS and INCLUDE_LOCATIONS for us, so we
# don't need to do it here
ifeq ($(USE_AMR_CORE), TRUE)
Pdirs := Base AmrCore Amr Boundary
else
Pdirs := Base
endif
Bpack += $(foreach dir, $(Pdirs), $(AMREX_HOME)/Src/$(dir)/Make.package)
#------------------------------------------------------------------------------
# microphysics
#------------------------------------------------------------------------------
NETWORK_OUTPUT_PATH := $(MICROPHYSICS_AUTO_SOURCE_DIR)
include $(MICROPHYSICS_HOME)/Make.Microphysics_extern
Bpack += $(foreach dir, $(EXTERN_CORE), $(dir)/Make.package)
Blocs += $(foreach dir, $(EXTERN_CORE), $(dir))
#------------------------------------------------------------------------------
# include all of the necessary directories
#------------------------------------------------------------------------------
include $(Bpack)
INCLUDE_LOCATIONS += $(Blocs)
VPATH_LOCATIONS += $(Blocs)
#------------------------------------------------------------------------------
# make generated source files location
#------------------------------------------------------------------------------
VPATH_LOCATIONS += $(MICROPHYSICS_AUTO_SOURCE_DIR)
INCLUDE_LOCATIONS += $(MICROPHYSICS_AUTO_SOURCE_DIR)
#------------------------------------------------------------------------------
# runtime parameters
#------------------------------------------------------------------------------
CEXE_sources += extern_parameters.cpp
CEXE_headers += extern_parameters.H
# for dependency resolution
AUTO_BUILD_SOURCES += $(MICROPHYSICS_AUTO_SOURCE_DIR)/extern_parameters.H
# these are for finding runtime parameters
EXTERN_SEARCH += $(EXTERN_CORE) $(MICROPHYSICS_HOME)/unit_test
ifdef MICROPHYSICS_HOME
EXTERN_SEARCH += $(MICROPHYSICS_HOME)/networks/
endif
EXTERN_PARAMETERS := $(shell $(MICROPHYSICS_HOME)/util/build_scripts/findparams.py $(EXTERN_SEARCH))
$(MICROPHYSICS_AUTO_SOURCE_DIR)/extern_parameters.cpp: $(MICROPHYSICS_AUTO_SOURCE_DIR)/extern_parameters.H
$(MICROPHYSICS_AUTO_SOURCE_DIR)/extern_parameters.H: $(EXTERN_PARAMETERS) $(EXTERN_TEMPLATE)
@if [ ! -d $(MICROPHYSICS_AUTO_SOURCE_DIR) ]; then mkdir -p $(MICROPHYSICS_AUTO_SOURCE_DIR); fi
$(MICROPHYSICS_HOME)/util/build_scripts/write_probin.py \
--cxx_prefix $(MICROPHYSICS_AUTO_SOURCE_DIR)/extern \
--pa "$(EXTERN_PARAMETERS)"
# for debugging
test_extern_params: $(MICROPHYSICS_AUTO_SOURCE_DIR)/extern_parameters.cpp
#------------------------------------------------------------------------------
# build info
#------------------------------------------------------------------------------
# job_info support
CEXE_headers += $(AMREX_HOME)/Tools/C_scripts/AMReX_buildInfo.H
INCLUDE_LOCATIONS += $(AMREX_HOME)/Tools/C_scripts
MNAMES := EOS=$(EOS_PATH) NETWORK=$(NETWORK_PATH) INTEGRATOR=$(INTEGRATOR_DIR)
# we make AMReX_buildInfo.cpp as we make the .o file, so we can delete
# it immediately. this way if the build is interrupted, we are
# guaranteed to remake it
objForExecs += $(objEXETempDir)/AMReX_buildInfo.o
.FORCE:
.PHONE: .FORCE
# set BUILD_GIT_NAME and BUILD_GIT_DIR if you are building in a
# git-controlled dir not under Castro/
EXTRA_BUILD_INFO :=
ifdef BUILD_GIT_NAME
EXTRA_BUILD_INFO := --build_git_name "$(BUILD_GIT_NAME)" \
--build_git_dir "$(BUILD_GIT_DIR)"
endif
$(objEXETempDir)/AMReX_buildInfo.o: .FORCE
$(AMREX_HOME)/Tools/C_scripts/makebuildinfo_C.py \
--amrex_home "$(AMREX_HOME)" \
--COMP "$(COMP)" --COMP_VERSION "$(COMP_VERSION)" \
--CXX_comp_name "$(CXX)" --CXX_flags "$(CXXFLAGS) $(CPPFLAGS) $(includes)" \
--F_comp_name "$(F90)" --F_flags "$(F90FLAGS)" \
--link_flags "$(LDFLAGS)" --libraries "$(libraries)" \
--MODULES "$(MNAMES)" $(EXTRA_BUILD_INFO) \
--GIT "$(TOP) $(AMREX_HOME) $(MICROPHYSICS_HOME)"
@if [ ! -d $(objEXETempDir) ]; then mkdir -p $(objEXETempDir); fi
$(SILENT) $(CCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(CXXEXEFLAGS) AMReX_buildInfo.cpp -o $(objEXETempDir)/AMReX_buildInfo.o
$(SILENT) $(RM) AMReX_buildInfo.cpp
#------------------------------------------------------------------------------
# finish up
#------------------------------------------------------------------------------
include $(AMREX_HOME)/Tools/GNUMake/Make.rules
clean::
$(SILENT) $(RM) extern.F90
$(SILENT) $(RM) network_properties.F90 network_properties.H
$(SILENT) $(RM) $(MICROPHYSICS_AUTO_SOURCE_DIR)/*.H $(MICROPHYSICS_AUTO_SOURCE_DIR)/*.[fF]90
$(SILENT) $(RM) extern_parameters.cpp extern_parameters_F.H extern_parameters.H
# Older versions of CASTRO generated a "network.f90" file when using
# the general_null network, which conflicts with our generalized
# network.f90 file. So we should delete the local copy if we are
# trying to rebuild from an old directory.
# The same is true for "extern.f90".
clean::
$(RM) network.f90
$(RM) extern.f90
# for debugging. To see the value of a Makefile variable,
# e.g. Fmlocs, simply do "make print-Fmlocs". This will print out the
# value.
print-%::
@echo "$* is $($*)"
@$(RM) AMReX_buildInfo.cpp