-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
94 lines (78 loc) · 3.18 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
BENCHES := ""
BENCHFLAGS := #"--benchmark-group-by=func"
# Pytest Specific Flags
#IGNORE := numpy/image.py
IGNORE += taco
IGNORE_FLAGS := $(addprefix --ignore=,$(IGNORE))
benches_name := $(patsubst %.py,%,$(BENCHES))
benches_name := $(subst /,_,$(benches_name))
benches_name := $(subst *,_,$(benches_name))
NUMPY_JSON ?= results/numpy/$(benches_name)benches_$(shell date +%Y_%m_%d_%H%M%S).json
NUMPY_JSON := $(NUMPY_JSON)
# Taco Specific Flags
ifeq ($(TACO_OUT),)
TACO_OUT := results/taco/$(benches_name)benches_$(shell date +%Y_%m_%d_%H%M%S).csv
endif
# Set GRAPHBLAS=ON if compiling GraphBLAS benchmarks.
ifeq ($(GRAPHBLAS),)
GRAPHBLAS := "OFF"
endif
# Set OPENMP=ON if compiling TACO with OpenMP support.
ifeq ($(OPENMP),)
OPENMP := "OFF"
endif
# Set LANKA=ON if compiling on the MIT Lanka cluster.
ifeq ($(LANKA),)
LANKA := "OFF"
endif
ifeq ("$(LANKA)","ON")
CMD := OMP_PROC_BIND=true LD_LIBRARY_PATH=taco/build/lib/:$(LD_LIBRARY_PATH) numactl -C 0,2,4,6,8,10,24,26,28,30,32,34 -m 0 taco/build/taco-bench $(BENCHFLAGS)
else
CMD := LD_LIBRARY_PATH=taco/build/lib/:$(LD_LIBRARY_PATH) taco/build/taco-bench $(BENCHFLAGS)
endif
export TACO_TENSOR_PATH = data/
# To group benchmark output by benchmark, use BENCHFLAGS=--benchmark-group-by=func.
# To additionally group by a parameterized value, add on ",param:<paramname>" to the
# command above.
python-bench: results numpy/*.py
echo $(benches_name)
-pytest $(IGNORE_FLAGS) --benchmark-json=$(NUMPY_JSON) $(BENCHFLAGS) $(BENCHES)
python numpy/converter.py --json_name $(NUMPY_JSON)
# Separate target to run the python benchmarks with numpy-taco cross validation logic.
validate-python-bench: numpy/*.py validation-path
pytest $(IGNORE_FLAGS) $(BENCHFLAGS) $(BENCHES)
.PHONY: convert-csv-all
convert-csv-all:
python numpy/converter.py --all
taco-bench: taco/build/taco-bench
ifeq ($(BENCHES),"")
$(CMD) --benchmark_out_format="csv" --benchmark_out="$(TACO_OUT)" --benchmark_repetitions=10 --benchmark_counters_tabular=true
else
$(CMD) --benchmark_filter="$(BENCHES)" --benchmark_out_format="csv" --benchmark_out="$(TACO_OUT)" --benchmark_repetitions=10 --benchmark_counters_tabular=true
endif
# Separate target to run the TACO benchmarks with numpy-taco cross validation logic.
validate-taco-bench: taco/build/taco-bench validation-path
ifeq ($(BENCHES),"")
$(CMD) --benchmark_repetitions=1
else
$(CMD) --benchmark_filter="$(BENCHES)" --benchmark_repetitions=1
endif
.PHONY: validation-path
validation-path:
ifeq ($(VALIDATION_OUTPUT_PATH),)
$(error VALIDATION_OUTPUT_PATH is undefined)
endif
taco/build/taco-bench: results check-and-reinit-submodules taco/benchmark/googletest
mkdir -p taco/build/ && cd taco/build/ && cmake -DOPENMP=$(OPENMP) -DGRAPHBLAS=$(GRAPHBLAS) -DLANKA=$(LANKA) ../ && $(MAKE) taco-bench
taco/benchmark/googletest: check-and-reinit-submodules
if [ ! -d "taco/benchmark/googletest" ] ; then git clone https://github.com/google/googletest taco/benchmark/googletest; fi
.PHONY: results
results:
mkdir -p results/taco
mkdir -p results/numpy
.PHONY: check-and-reinit-submodules
check-and-reinit-submodules:
@if git submodule status | egrep -q '^[-]|^[+]' ; then \
echo "INFO: Need to reinitialize git submodules"; \
git submodule update --init; \
fi