-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
408 lines (317 loc) · 15.8 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
#########################################################
# GENERAL DIRECTOIRES #
#########################################################
# globals binaary /bin/accel-graph name doesn't need to match main/accel-graph.c
APP ?= open-graph
# test name needs to match the file name test/test_accel-graph.c
APP_TEST ?= test_open-graph-match
# dirs Root app
APP_DIR ?= .
# BENCHMARKS_DIR ?= ../../01_GraphDatasets
BENCHMARKS_DIR ?= ../01_test_graphs
#dir root/managed_folders
SRC_DIR ?= src
OBJ_DIR ?= obj
INC_DIR ?= include
BIN_DIR ?= bin
RES_DIR ?= results
#if you want to compile from cmake you need this directory
#cd build
#cmake ..
BUILD_DIR ?= build
# relative directories used for managing src/obj files
STRUCT_DIR ?= structures
PREPRO_DIR ?= preprocess
ALGO_DIR ?= algorithms
UTIL_DIR ?= utils
CONFIG_DIR ?= config
#contains the tests use make run-test to compile what in this directory
TEST_DIR ?= tests
#contains the main for the graph processing framework
MAIN_DIR ?= main
##################################################
##################################################
#########################################################
# ACCEL RUN GRAPH ARGUMENTS #
#########################################################
# export BENCHMARKS_DIR ?= ../../01_GraphDatasets
export BENCHMARKS_DIR ?= ../01_test_graphs
export GRAPH_SUIT ?= TEST
# export GRAPH_SUIT ?= LAW
# export GRAPH_SUIT ?= GAP
# export GRAPH_SUIT ?= SNAP
# export GRAPH_SUIT ?= KONECT
# export GRAPH_SUIT ?= GONG
# TEST # small test graphs
# export GRAPH_NAME ?= test
# export GRAPH_NAME ?= v51_e1021
# export GRAPH_NAME ?= v300_e2730
export GRAPH_NAME ?= graphbrew
# GONG # https://gonglab.pratt.duke.edu/google-dataset
# export GRAPH_NAME ?= GONG-gplus
# export GRAPH_NAME ?= Gong-gplus
# GAP # https://sparse.tamu.edu/MM/GAP/
# export GRAPH_NAME ?= GAP-twitter
# export GRAPH_NAME ?= GAP-road
# SNAP # https://snap.stanford.edu/data/
# export GRAPH_NAME ?= SNAP-cit-Patents
# export GRAPH_NAME ?= SNAP-com-Orkut
# export GRAPH_NAME ?= SNAP-soc-LiveJournal1
# export GRAPH_NAME ?= SNAP-soc-Pokec
# export GRAPH_NAME ?= SNAP-web-Google
# KONECT # http://konect.cc/networks/wikipedia_link_en/
# export GRAPH_NAME ?= KONECT-wikipedia_link_en
# LAW # https://sparse.tamu.edu/MM/LAW/
# export GRAPH_NAME ?= LAW-amazon-2008
# export GRAPH_NAME ?= LAW-arabic-2005
# export GRAPH_NAME ?= LAW-cnr-2000
# export GRAPH_NAME ?= LAW-dblp-2010
# export GRAPH_NAME ?= LAW-enron
# export GRAPH_NAME ?= LAW-eu-2005
# export GRAPH_NAME ?= LAW-hollywood-2009
# export GRAPH_NAME ?= LAW-in-2004
# export GRAPH_NAME ?= LAW-indochina-2004
# export GRAPH_NAME ?= LAW-it-2004
# export GRAPH_NAME ?= LAW-ljournal-2008
# export GRAPH_NAME ?= LAW-uk-2002
# export GRAPH_NAME ?= LAW-uk-2005
# export GRAPH_NAME ?= LAW-webbase-2001
# export FILE_BIN_TYPE ?= graph
export FILE_BIN_TYPE ?= graph.bin
# export FILE_BIN_TYPE ?= graph.wbin
# export FILE_LABEL_TYPE ?= graph_Gorder.labels
export FILE_LABEL_TYPE ?= graph_Rabbit.labels
#GRAPH file
export FILE_BIN = $(BENCHMARKS_DIR)/$(GRAPH_SUIT)/$(GRAPH_NAME)/$(FILE_BIN_TYPE)
export FILE_LABEL = $(BENCHMARKS_DIR)/$(GRAPH_SUIT)/$(GRAPH_NAME)/$(FILE_LABEL_TYPE)
#ALGORITHM
export PULL_PUSH ?= 0
export ALGORITHMS ?= 1
#GRAPH DATA_STRUCTURES
export SORT_TYPE ?= 1
export DATA_STRUCTURES ?= 0
export REORDER_LAYER1 ?= 4
export REORDER_LAYER2 ?= 0
export REORDER_LAYER3 ?= 0
export CACHE_SIZE ?= 32768
#ALGORITHM SPECIFIC ARGS
export ROOT ?= 46050
export TOLERANCE ?= 1e-8
export DELTA ?= 800
export NUM_ITERATIONS ?= 100
#PERFORMANCE
# export NUM_THREADS_PRE ?= $(shell grep -c ^processor /proc/cpuinfo)
# export NUM_THREADS_ALGO ?= $(shell grep -c ^processor /proc/cpuinfo)
# export NUM_THREADS_KER ?= 1
export NUM_THREADS_PRE ?= 1
export NUM_THREADS_ALGO ?= 1
export NUM_THREADS_KER ?= 1
#EXPERIMENTS
export NUM_TRIALS ?= 1
#GRAPH FROMAT EDGELIST
export FILE_FORMAT ?= 1
export CONVERT_FORMAT ?= 0
#STATS COLLECTION VARIABLES
export BIN_SIZE ?= 1000
export INOUT_STATS ?= 0
export MASK_MODE ?= 0
##################################################
export ARGS ?= -k -M $(MASK_MODE) -j $(INOUT_STATS) -g $(BIN_SIZE) -z $(FILE_FORMAT) -d $(DATA_STRUCTURES) -a $(ALGORITHMS) -r $(ROOT) -n $(NUM_THREADS_PRE) -N $(NUM_THREADS_ALGO) -K $(NUM_THREADS_KER) -i $(NUM_ITERATIONS) -o $(SORT_TYPE) -p $(PULL_PUSH) -t $(NUM_TRIALS) -e $(TOLERANCE) -F $(FILE_LABEL) -l $(REORDER_LAYER1) -L $(REORDER_LAYER2) -O $(REORDER_LAYER3) -b $(DELTA) -C $(CACHE_SIZE)
##############################################
# ACCEL GRAPH COMPILATION VARIABLES #
##############################################
#each implementation is contained in a separate folder. when you compile for openmp for example the files in openmp folder gets included
SRC_FILES_ALGO_OPENMP = $(wildcard $(APP_DIR)/$(SRC_DIR)/$(ALGO_DIR)/openmp/*.c)
SRC_FILES_UTIL = $(wildcard $(APP_DIR)/$(SRC_DIR)/$(UTIL_DIR)/*.c)
SRC_FILES_PREPRO = $(wildcard $(APP_DIR)/$(SRC_DIR)/$(PREPRO_DIR)/*.c)
SRC_FILES_STRUCT = $(wildcard $(APP_DIR)/$(SRC_DIR)/$(STRUCT_DIR)/*.c)
SRC_FILES_MAIN = $(wildcard $(APP_DIR)/$(SRC_DIR)/$(MAIN_DIR)/*.c)
SRC_FILES_TEST = $(wildcard $(APP_DIR)/$(SRC_DIR)/$(TEST_DIR)/*.c)
INC_FILES_ALGO_OPENMP = $(wildcard $(APP_DIR)/$(INC_DIR)/$(ALGO_DIR)/openmp/*.h)
INC_FILES_UTIL = $(wildcard $(APP_DIR)/$(INC_DIR)/$(UTIL_DIR)/*.h)
INC_FILES_PREPRO = $(wildcard $(APP_DIR)/$(INC_DIR)/$(PREPRO_DIR)/*.h)
INC_FILES_STRUCT = $(wildcard $(APP_DIR)/$(INC_DIR)/$(STRUCT_DIR)/*.h)
INC_FILES_CONFIG = $(wildcard $(APP_DIR)/$(INC_DIR)/$(CONFIG_DIR)/*.h)
ALL_HEADER_FILES = $(INC_FILES_ALGO_OPENMP) $(INC_FILES_UTIL) $(INC_FILES_PREPRO) $(INC_FILES_STRUCT) $(INC_FILES_CONFIG)
#create object file rules for the final binary target
OBJ_FILES_ALGO_OPENMP = $(patsubst $(APP_DIR)/$(SRC_DIR)/$(ALGO_DIR)/openmp/%.c,$(APP_DIR)/$(OBJ_DIR)/$(ALGO_DIR)/openmp/%.o,$(SRC_FILES_ALGO_OPENMP))
OBJ_FILES_UTIL = $(patsubst $(APP_DIR)/$(SRC_DIR)/$(UTIL_DIR)/%.c,$(APP_DIR)/$(OBJ_DIR)/$(UTIL_DIR)/%.o,$(SRC_FILES_UTIL))
OBJ_FILES_PREPRO = $(patsubst $(APP_DIR)/$(SRC_DIR)/$(PREPRO_DIR)/%.c,$(APP_DIR)/$(OBJ_DIR)/$(PREPRO_DIR)/%.o,$(SRC_FILES_PREPRO))
OBJ_FILES_STRUCT = $(patsubst $(APP_DIR)/$(SRC_DIR)/$(STRUCT_DIR)/%.c,$(APP_DIR)/$(OBJ_DIR)/$(STRUCT_DIR)/%.o,$(SRC_FILES_STRUCT))
OBJ_FILES_MAIN = $(patsubst $(APP_DIR)/$(SRC_DIR)/$(MAIN_DIR)/%.c,$(APP_DIR)/$(OBJ_DIR)/$(MAIN_DIR)/%.o,$(SRC_FILES_MAIN))
OBJ_FILES_TEST = $(patsubst $(APP_DIR)/$(SRC_DIR)/$(TEST_DIR)/%.c,$(APP_DIR)/$(OBJ_DIR)/$(TEST_DIR)/%.o,$(SRC_FILES_TEST))
CC = gcc
OPENMP_INC = -I$(APP_DIR)/$(INC_DIR)/$(STRUCT_DIR) \
-I$(APP_DIR)/$(INC_DIR)/$(ALGO_DIR)/$(INTEGRATION) \
-I$(APP_DIR)/$(INC_DIR)/$(PREPRO_DIR) \
-I$(APP_DIR)/$(INC_DIR)/$(UTIL_DIR) \
-I$(APP_DIR)/$(INC_DIR)/$(CONFIG_DIR)
# flags
CFLAGS = -O3 -Wall -m64 -fopenmp -g
LFLAGS = -lm -lJudy
# TEST PASS OR FAIL
PASS = \033[92mPASS\033[0m
FAIL = \033[91mFAIL\033[0m
##################################################
##################################################
#########################################################
# ACCEL GRAPH GENERATION #
#########################################################
.PHONY: app-openmp
app-openmp : directories directories-openmp $(APP_DIR)/$(BIN_DIR)/$(APP)-openmp
@echo "\n ****************************************************************************** "
@echo " * DONE!! NOTHING ELSE TO COMPILE ---> OpenGraph-openmp: ./$(word 3,$^)"
@echo " ****************************************************************************** \n"
.PHONY: test-openmp
test-openmp : directories directories-openmp $(APP_DIR)/$(BIN_DIR)/$(APP_TEST)-openmp
@echo "\n ****************************************************************************** "
@echo " * DONE!! NOTHING ELSE TO COMPILE ---> TEST: ./$(word 3,$^)"
@echo " ****************************************************************************** \n"
.PHONY: directories
directories :
@mkdir -p $(APP_DIR)/$(BIN_DIR)
@mkdir -p $(APP_DIR)/$(OBJ_DIR)
@mkdir -p $(APP_DIR)/$(OBJ_DIR)/$(UTIL_DIR)
@mkdir -p $(APP_DIR)/$(OBJ_DIR)/$(PREPRO_DIR)
@mkdir -p $(APP_DIR)/$(OBJ_DIR)/$(STRUCT_DIR)
@mkdir -p $(APP_DIR)/$(OBJ_DIR)/$(MAIN_DIR)
@mkdir -p $(APP_DIR)/$(OBJ_DIR)/$(TEST_DIR)
.PHONY: directories-openmp
directories-openmp :
@mkdir -p $(APP_DIR)/$(OBJ_DIR)/$(ALGO_DIR)/openmp
@mkdir -p $(APP_DIR)/openmp-results
$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp : $(APP_DIR)/$(OBJ_DIR)/$(MAIN_DIR)/$(APP).o $(OBJ_FILES_UTIL) $(OBJ_FILES_ALGO_OPENMP) $(OBJ_FILES_PREPRO) $(OBJ_FILES_STRUCT)
@$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS)
$(APP_DIR)/$(BIN_DIR)/$(APP_TEST)-openmp : $(APP_DIR)/$(OBJ_DIR)/$(TEST_DIR)/$(APP_TEST).o $(OBJ_FILES_UTIL) $(OBJ_FILES_ALGO_OPENMP) $(OBJ_FILES_PREPRO) $(OBJ_FILES_STRUCT)
@$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS)
$(APP_DIR)/$(OBJ_DIR)/$(MAIN_DIR)/$(APP).o : $(APP_DIR)/$(SRC_DIR)/$(MAIN_DIR)/$(APP).c $(ALL_HEADER_FILES)
$(CC) $(CFLAGS) $(OPENMP_INC) $(MODE) -c -o $@ $<
$(APP_DIR)/$(OBJ_DIR)/$(TEST_DIR)/$(APP_TEST).o : $(APP_DIR)/$(SRC_DIR)/$(TEST_DIR)/$(APP_TEST).c $(ALL_HEADER_FILES)
$(CC) $(CFLAGS) $(OPENMP_INC) $(MODE) -c -o $@ $<
$(APP_DIR)/$(OBJ_DIR)/$(UTIL_DIR)/%.o : $(APP_DIR)/$(SRC_DIR)/$(UTIL_DIR)/%.c $(INC_FILES_UTIL)
$(CC) $(CFLAGS) $(OPENMP_INC) $(MODE) -c -o $@ $<
$(APP_DIR)/$(OBJ_DIR)/$(ALGO_DIR)/openmp/%.o : $(APP_DIR)/$(SRC_DIR)/$(ALGO_DIR)/openmp/%.c $(ALL_HEADER_FILES)
$(CC) $(CFLAGS) $(OPENMP_INC) $(MODE) -c -o $@ $<
$(APP_DIR)/$(OBJ_DIR)/$(PREPRO_DIR)/%.o : $(APP_DIR)/$(SRC_DIR)/$(PREPRO_DIR)/%.c $(INC_FILES_PREPRO)
$(CC) $(CFLAGS) $(OPENMP_INC) $(MODE) -c -o $@ $<
$(APP_DIR)/$(OBJ_DIR)/$(STRUCT_DIR)/%.o : $(APP_DIR)/$(SRC_DIR)/$(STRUCT_DIR)/%.c $(INC_FILES_STRUCT)
$(CC) $(CFLAGS) $(OPENMP_INC) $(MODE) -c -o $@ $<
.PHONY: clean
clean:
@rm -fr $(APP_DIR)/$(OBJ_DIR)
@rm -fr $(APP_DIR)/$(BIN_DIR)
.PHONY: clean-stats
clean-stats:
@rm -f $(BENCHMARKS_DIR)/*.perf
@rm -f $(BENCHMARKS_DIR)/*/*.perf
@rm -f $(BENCHMARKS_DIR)/*/*.stats
@rm -fr $(APP_DIR)/openmp-results
##################################################
##################################################
##################################################
##################################################
##############################################
# ACCEL GRAPH TOP LEVEL RULES #
##############################################
.PHONY: help
help: INTEGRATION = openmp
help: app-openmp
./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp --help
.PHONY: run
run: run-openmp
.PHONY: run-openmp
run-openmp: INTEGRATION = openmp
run-openmp: app-openmp
./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -f $(FILE_BIN) $(ARGS)
.PHONY: convert
convert: INTEGRATION = openmp
convert: app-openmp
./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -k -x -c $(CONVERT_FORMAT) -f $(FILE_BIN) -z $(FILE_FORMAT) -l $(REORDER_LAYER1) -L $(REORDER_LAYER2) -O $(REORDER_LAYER3) -F $(FILE_LABEL)
.PHONY: sweep-convert
sweep-convert: INTEGRATION = openmp
sweep-convert: app-openmp
@for dir in ${BENCHMARKS_DIR}/*; \
do \
for graph_dir in $${dir}/*; \
do \
if [ -e $${graph_dir}/graph.bin ]; then \
echo "convert $${graph_dir}/graph.bin"; \
./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -x -c 0 -f $${graph_dir}/graph.bin -z 1 -l 10 -L 10 -O 10;\
mv $${graph_dir}/graph.bin.txt $${graph_dir}/graph.rand; \
mv $${graph_dir}/graph_Gorder.labels $${graph_dir}/graph_Gorder.org.labels; \
mv $${graph_dir}/graph_Rabbit.labels $${graph_dir}/graph_Rabbit.org.labels; \
../../06_Gorder/Gorder $${graph_dir}/graph.rand ; \
../../05_rabbit_order/demo/reorder $${graph_dir}/graph.rand ; \
mv $${graph_dir}/graph_Gorder.labels $${graph_dir}/graph_Gorder.rand.labels; \
mv graph_Rabbit.labels $${graph_dir}/graph_Rabbit.rand.labels; \
./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -x -c 1 -f $${graph_dir}/graph.rand -z 0 ;\
rm $${graph_dir}/graph.rand; \
fi; \
done \
done
# ./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -x -c $(CONVERT_FORMAT) -f $${graph_dir}/$(FILE_BIN_TYPE) -z $(FILE_FORMAT) -l 0 -L 0 -O 0 -F $(FILE_LABEL);\
# /home/ab/Documents/github_repos/12_pcpm/csr_gen/a.out $${graph_dir}/$(FILE_BIN_TYPE) $${graph_dir}/$(FILE_BIN_TYPE).csr;\
.PHONY: sweep-convert-2
sweep-convert-2: INTEGRATION = openmp
sweep-convert-2: app-openmp
@for dir in ${BENCHMARKS_DIR}/*; \
do \
for graph_dir in $${dir}/*; \
do \
if [ -e $${graph_dir}/$(FILE_BIN_TYPE) ]; then \
echo "convert 2 $${graph_dir}/$(FILE_BIN_TYPE)"; \
/home/ab/Documents/github_repos/13_Corder-TPDS-21/corder -d $${graph_dir}/$(FILE_BIN_TYPE).csr -a 6 -s 512 ;\
fi; \
done \
done
.PHONY: convert-w
convert-w: INTEGRATION = openmp
convert-w: app-openmp
./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -k -w -x -c $(CONVERT_FORMAT) -f $(FILE_BIN) -z $(FILE_FORMAT) -l $(REORDER_LAYER1) -L $(REORDER_LAYER2) -O $(REORDER_LAYER3) -F $(FILE_LABEL)
.PHONY: stats-openmp
stats-openmp: INTEGRATION = openmp
stats-openmp: app-openmp
./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -x -f $(FILE_BIN) -n 4 $(NUM_THREADS) -i $(BIN_SIZE) -o $(SORT_TYPE) -l $(REORDER_LAYER1) -L $(REORDER_LAYER2) -O $(REORDER_LAYER3) -j $(INOUT_STATS)
.PHONY: debug-openmp
debug-openmp: INTEGRATION = openmp
debug-openmp: app-openmp
gdb -ex=r --args ./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -f $(FILE_BIN) $(ARGS)
.PHONY: debug-memory-openmp
debug-memory-openmp: INTEGRATION = openmp
debug-memory-openmp: app-openmp
valgrind --leak-check=full --show-leak-kinds=all ./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -f $(FILE_BIN) $(ARGS)
.PHONY: test-verbose
test-verbose: INTEGRATION = openmp
test-verbose:
$(MAKE) run-test -C $(APP_DIR) | grep -E 'PASS|FAIL'
# test files
.PHONY: test
test: INTEGRATION = openmp
test:
@if $(MAKE) run-test -C $(APP_DIR) | grep FAIL > /dev/null; \
then exit 1; \
fi
.PHONY: run-test
run-test: INTEGRATION = openmp
run-test: run-test-openmp
.PHONY: run-test-openmp
run-test-openmp: INTEGRATION = openmp
run-test-openmp: test-openmp
./$(APP_DIR)/$(BIN_DIR)/$(APP_TEST)-openmp >> $(APP_DIR)/openmp-results/full_results_$(NUM_THREADS_KER).perf
.PHONY: debug-test-openmp
debug-test-openmp: INTEGRATION = openmp
debug-test-openmp: test-openmp
gdb ./$(APP_DIR)/$(BIN_DIR)/$(APP_TEST)-openmp
.PHONY: debug-memory-test-openmp
debug-memory-test-openmp: INTEGRATION = openmp
debug-memory-test-openmp: test-openmp
valgrind --leak-check=full --show-leak-kinds=all ./$(APP_DIR)/$(BIN_DIR)/$(APP_TEST)-openmp
# cache performance
.PHONY: cachegrind-perf-openmp
cachegrind-perf-openmp: INTEGRATION = openmp
cachegrind-perf-openmp: app-openmp
valgrind --tool=cachegrind ./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -f $(FILE_BIN) $(ARGS)
.PHONY: cache-perf-openmp
cache-perf-openmp: INTEGRATION = openmp
cache-perf-openmp: app-openmp
sudo perf record -d ./$(APP_DIR)/$(BIN_DIR)/$(APP)-openmp -f $(FILE_BIN) $(ARGS)