-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
268 lines (201 loc) · 9.14 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
VERSION := $(shell grep . VERSION.txt | cut -f1 -d:)
PROGRAM_NAME := project
CC := g++
# CC := g++-mp-7 # typical macports compiler name
# CC := g++-7 # typical homebrew compiler name
# Check for environment definitions of compiler
# e.g., on CC = g++-7 on OSX
ifdef PHYSICELL_CPP
CC := $(PHYSICELL_CPP)
endif
ARCH := native # best auto-tuning
# ARCH := core2 # a reasonably safe default for most CPUs since 2007
# ARCH := corei7
# ARCH := core-avx-i # i7 ivy bridge or newer
# ARCH := core-avx2 # i7 with Haswell or newer
# ARCH := silvermont
# ARCH := skylake-avx512
# ARCH := nocona #64-bit pentium 4 or later
# CFLAGS := -march=$(ARCH) -Ofast -s -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11
CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11
ifeq ($(OS),Windows_NT)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
var := $(shell which $(CC) | xargs file)
ifeq ($(lastword $(var)),arm64)
CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -fopenmp -m64 -std=c++11
endif
endif
endif
COMPILE_COMMAND := $(CC) $(CFLAGS)
BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \
BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o
PhysiCell_core_OBJECTS := PhysiCell_phenotype.o PhysiCell_cell_container.o PhysiCell_standard_models.o \
PhysiCell_cell.o PhysiCell_custom.o PhysiCell_utilities.o PhysiCell_constants.o PhysiCell_basic_signaling.o
PhysiCell_module_OBJECTS := PhysiCell_SVG.o PhysiCell_pathology.o PhysiCell_MultiCellDS.o PhysiCell_various_outputs.o \
PhysiCell_pugixml.o PhysiCell_settings.o PhysiCell_geometry.o
# put your custom objects here (they should be in the custom_modules directory)
PhysiCell_custom_module_OBJECTS := .o
pugixml_OBJECTS := pugixml.o
PhysiCell_OBJECTS := $(BioFVM_OBJECTS) $(pugixml_OBJECTS) $(PhysiCell_core_OBJECTS) $(PhysiCell_module_OBJECTS)
ALL_OBJECTS := $(PhysiCell_OBJECTS) $(PhysiCell_custom_module_OBJECTS)
EXAMPLES := ./examples/PhysiCell_test_mechanics_1.cpp ./examples/PhysiCell_test_mechanics_2.cpp \
./examples/PhysiCell_test_DCIS.cpp ./examples/PhysiCell_test_HDS.cpp \
./examples/PhysiCell_test_cell_cycle.cpp ./examples/PhysiCell_test_volume.cpp
all:
make moa_proliferation
make
# PhysiPKPD examples
moa_proliferation:
cp ./PhysiPKPD_examples/moa_proliferation/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./PhysiPKPD_examples/moa_proliferation/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./PhysiPKPD_examples/moa_proliferation/Makefile .
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp ./PhysiPKPD_examples/moa_proliferation/config/* ./config/
moa_apoptosis:
cp ./PhysiPKPD_examples/moa_apoptosis/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./PhysiPKPD_examples/moa_apoptosis/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./PhysiPKPD_examples/moa_apoptosis/Makefile .
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp ./PhysiPKPD_examples/moa_apoptosis/config/* ./config/
moa_necrosis:
cp ./PhysiPKPD_examples/moa_necrosis/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./PhysiPKPD_examples/moa_necrosis/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./PhysiPKPD_examples/moa_necrosis/Makefile .
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp ./PhysiPKPD_examples/moa_necrosis/config/* ./config/
moa_motility:
cp ./PhysiPKPD_examples/moa_motility/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./PhysiPKPD_examples/moa_motility/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./PhysiPKPD_examples/moa_motility/Makefile .
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp ./PhysiPKPD_examples/moa_motility/config/* ./config/
combo:
cp ./PhysiPKPD_examples/combo/custom_modules/* ./custom_modules/
touch main.cpp && cp main.cpp main-backup.cpp
cp ./PhysiPKPD_examples/combo/main.cpp ./main.cpp
cp Makefile Makefile-backup
cp ./PhysiPKPD_examples/combo/Makefile .
cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml
cp ./PhysiPKPD_examples/combo/config/* ./config/
# PhysiPKPD examples
# PhysiCell core components
PhysiCell_phenotype.o: ./core/PhysiCell_phenotype.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_phenotype.cpp
PhysiCell_digital_cell_line.o: ./core/PhysiCell_digital_cell_line.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_digital_cell_line.cpp
PhysiCell_cell.o: ./core/PhysiCell_cell.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_cell.cpp
PhysiCell_cell_container.o: ./core/PhysiCell_cell_container.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_cell_container.cpp
PhysiCell_standard_models.o: ./core/PhysiCell_standard_models.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_standard_models.cpp
PhysiCell_utilities.o: ./core/PhysiCell_utilities.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_utilities.cpp
PhysiCell_custom.o: ./core/PhysiCell_custom.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_custom.cpp
PhysiCell_constants.o: ./core/PhysiCell_constants.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_constants.cpp
# BioFVM core components (needed by PhysiCell)
BioFVM_vector.o: ./BioFVM/BioFVM_vector.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_vector.cpp
BioFVM_agent_container.o: ./BioFVM/BioFVM_agent_container.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_agent_container.cpp
BioFVM_mesh.o: ./BioFVM/BioFVM_mesh.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_mesh.cpp
BioFVM_microenvironment.o: ./BioFVM/BioFVM_microenvironment.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_microenvironment.cpp
BioFVM_solvers.o: ./BioFVM/BioFVM_solvers.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_solvers.cpp
BioFVM_utilities.o: ./BioFVM/BioFVM_utilities.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_utilities.cpp
BioFVM_basic_agent.o: ./BioFVM/BioFVM_basic_agent.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_basic_agent.cpp
BioFVM_matlab.o: ./BioFVM/BioFVM_matlab.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_matlab.cpp
BioFVM_MultiCellDS.o: ./BioFVM/BioFVM_MultiCellDS.cpp
$(COMPILE_COMMAND) -c ./BioFVM/BioFVM_MultiCellDS.cpp
pugixml.o: ./BioFVM/pugixml.cpp
$(COMPILE_COMMAND) -c ./BioFVM/pugixml.cpp
# standard PhysiCell modules
PhysiCell_SVG.o: ./modules/PhysiCell_SVG.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_SVG.cpp
PhysiCell_pathology.o: ./modules/PhysiCell_pathology.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_pathology.cpp
PhysiCell_MultiCellDS.o: ./modules/PhysiCell_MultiCellDS.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_MultiCellDS.cpp
PhysiCell_various_outputs.o: ./modules/PhysiCell_various_outputs.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_various_outputs.cpp
PhysiCell_pugixml.o: ./modules/PhysiCell_pugixml.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_pugixml.cpp
PhysiCell_settings.o: ./modules/PhysiCell_settings.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_settings.cpp
PhysiCell_basic_signaling.o: ./core/PhysiCell_basic_signaling.cpp
$(COMPILE_COMMAND) -c ./core/PhysiCell_basic_signaling.cpp
PhysiCell_geometry.o: ./modules/PhysiCell_geometry.cpp
$(COMPILE_COMMAND) -c ./modules/PhysiCell_geometry.cpp
# user-defined PhysiCell modules
# cleanup
reset:
rm -f *.cpp PhysiCell_cell.o
cp ./PhysiPKPD_examples/Makefile-default Makefile
rm -f ./custom_modules/*
touch ./custom_modules/empty.txt
touch ALL_CITATIONS.txt
touch ./core/PhysiCell_cell.cpp
rm ALL_CITATIONS.txt
cp ./config/PhysiCell_settings-backup.xml ./config/PhysiCell_settings.xml
touch ./config/empty.csv
rm ./config/*.csv
clean:
rm -f *.o
rm -f $(PROGRAM_NAME)*
data-cleanup:
rm -rf ./output
mkdir ./output
touch ./output/empty.txt
# archival
checkpoint:
zip -r $$(date +%b_%d_%Y_%H%M).zip Makefile *.cpp *.h config/*.xml custom_modules/*
zip:
zip -r latest.zip Makefile* *.cpp *.h BioFVM/* config/* core/* custom_modules/* matlab/* modules/* PhysiPKPD_examples/*
cp latest.zip $$(date +%b_%d_%Y_%H%M).zip
cp latest.zip VERSION_$(VERSION).zip
mv *.zip archives/
tar:
tar --ignore-failed-read -czf latest.tar Makefile* *.cpp *.h BioFVM/* config/* core/* custom_modules/* matlab/* modules/* PhysiPKPD_examples/*
cp latest.tar $$(date +%b_%d_%Y_%H%M).tar
cp latest.tar VERSION_$(VERSION).tar
mv *.tar archives/
unzip:
cp ./archives/latest.zip .
unzip latest.zip
untar:
cp ./archives/latest.tar .
tar -xzf latest.tar
# easier animation
FRAMERATE := 24
OUTPUT := output
jpeg:
@magick identify -format "%h" $(OUTPUT)/initial.svg >> __H.txt
@magick identify -format "%w" $(OUTPUT)/initial.svg >> __W.txt
@expr 2 \* \( $$(grep . __H.txt) / 2 \) >> __H1.txt
@expr 2 \* \( $$(grep . __W.txt) / 2 \) >> __W1.txt
@echo "$$(grep . __W1.txt)!x$$(grep . __H1.txt)!" >> __resize.txt
@magick mogrify -format jpg -resize $$(grep . __resize.txt) $(OUTPUT)/s*.svg
rm -f __H*.txt __W*.txt __resize.txt
gif:
magick convert $(OUTPUT)/s*.svg $(OUTPUT)/out.gif
movie:
ffmpeg -r $(FRAMERATE) -f image2 -i $(OUTPUT)/snapshot%08d.jpg -vcodec libx264 -pix_fmt yuv420p -strict -2 -tune animation -crf 15 -acodec none $(OUTPUT)/out.mp4
data-plots:
python custom_modules/createDataPlots.py -i $(OUTPUT)/cell_counts.csv -o $(OUTPUT)/cell_plot.png