-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (71 loc) · 3.02 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
# -*- coding: utf-8 -*-
# Copyright (c) 2022, Reinis Cirpons + J. D. Mitchell
#
# Distributed under the terms of the GPL license version 3.
#
# The full license is in the file LICENSE, distributed with this software.
doc:
cd docs && make html
clean-benchmarks:
rm -rf .benchmarks
rm -f benchmarks/bench_minimize_*.py
rm -f benchmarks/bench_interval_multiply_*.py
clean-prof:
rm -rf prof
clean-doc:
rm -rf docs/_build
clean: clean-doc clean-prof clean-benchmarks
rm -rf *.egg-info
rm -rf docs/build
rm -rf build/
rm -rf __pycache__/
rm -rf dist/
rm -rf htmlcov/
rm -rf *.egg-info
rm -rf .tox
rm -rf tests/__pycache__
rm -rf freebandlib/__pycache__
superclean: clean
git clean -xdf --exclude *.swp --exclude *.swo
.PHONY: superclean
INTERVAL_TEST_CASES = 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19
define benchmark_function
pytest -n auto -v benchmarks/bench_$(1).py --benchmark-storage=file://./benchmarks/raw_benchmark_data/ --benchmark-save=$(2)
endef
benchmark-minimize-generate-benchmarks:
$(foreach var,$(INTERVAL_TEST_CASES),sed 's/{{NUM}}/$(var)/g' ./benchmarks/templates/bench_minimize.py > ./benchmarks/bench_minimize_$(var).py;)
benchmark-interval-multiply-generate-benchmarks:
$(foreach var,$(INTERVAL_TEST_CASES),sed 's/{{NUM}}/$(var)/g' ./benchmarks/templates/bench_interval_multiply.py > ./benchmarks/bench_interval_multiply_$(var).py;)
benchmark-minimize: benchmark-minimize-generate-benchmarks
mkdir -p ./benchmarks/raw_benchmark_data/
rm -f ./benchmarks/raw_benchmark_data/*/*_minimize.json
$(foreach var,$(INTERVAL_TEST_CASES),$(call benchmark_function,minimize_$(var),minimize);)
benchmark-interval-multiply: benchmark-interval-multiply-generate-benchmarks
mkdir -p ./benchmarks/raw_benchmark_data/
rm -f ./benchmarks/raw_benchmark_data/*/*_interval_multiply.json
$(foreach var,$(INTERVAL_TEST_CASES),$(call benchmark_function,interval_multiply_$(var),interval_multiply);)
benchmark-interval:
mkdir -p ./benchmarks/raw_benchmark_data/
rm -f ./benchmarks/raw_benchmark_data/*/*_interval.json
$(call benchmark_function,interval,interval)
benchmark-equal:
mkdir -p ./benchmarks/raw_benchmark_data/
rm -f ./benchmarks/raw_benchmark_data/*/*_equal.json
$(call benchmark_function,equal,equal)
benchmark-minimal-multiply:
mkdir -p ./benchmarks/raw_benchmark_data/
rm -f ./benchmarks/raw_benchmark_data/*/*_minimal_multiply.json
$(call benchmark_function,minimal_multiply,minimal_multiply)
benchmark-isomorphism:
mkdir -p ./benchmarks/raw_benchmark_data/
rm -f ./benchmarks/raw_benchmark_data/*/*_isomorphism.json
$(call benchmark_function,isomorphism,isomorphism)
benchmark-minword:
mkdir -p ./benchmarks/raw_benchmark_data/
rm -f ./benchmarks/raw_benchmark_data/*/*_minword.json
$(call benchmark_function,minword,minword)
benchmark-all: benchmark-interval benchmark-equal benchmark-minimize benchmark-interval-multiply benchmark-minimal-multiply benchmark-isomorphism benchmark-minword
coverage:
@coverage run --source . --omit="tests/*" -m py.test
@coverage html
@echo "See: htmlcov/index.html"