-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
230 lines (201 loc) · 6.61 KB
/
build.gradle
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
//
// Copyright (c) 2024 Dynatrace LLC. All rights reserved.
//
// This software and associated documentation files (the "Software")
// are being made available by Dynatrace LLC for the sole purpose of
// illustrating the implementation of certain algorithms which have
// been published by Dynatrace LLC. Permission is hereby granted,
// free of charge, to any person obtaining a copy of the Software,
// to view and use the Software for internal, non-production,
// non-commercial purposes only – the Software may not be used to
// process live data or distributed, sublicensed, modified and/or
// sold either alone or as part of or in combination with any other
// software.
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
plugins {
id 'com.diffplug.spotless' version '6.25.0'
}
def figFiles = []
def mvpFigFiles = [
"paper/mvp_martingale.pdf",
"paper/mvp_lower_bound.pdf",
"paper/mvp_compressed.pdf",
"paper/mvp_compressed_martingale.pdf"
]
task makeMvpCharts (type: Exec) {
doFirst {
standardOutput = new FileOutputStream("results/mvp.txt")
}
inputs.files "python/preamble.py", "python/plot_mvp_charts.py", "python/mvp.py", "paper/symbols.tex"
outputs.files mvpFigFiles, "results/mvp.txt"
commandLine 'python', "python/plot_mvp_charts.py"
}
figFiles +=mvpFigFiles
def graEfficiencyFigFiles = ["paper/gra_efficiency.pdf"]
task makeGraEfficiencyCharts (type: Exec) {
inputs.files "python/preamble.py", "python/plot_estimator_efficiency_charts.py", "python/mvp.py", "paper/symbols.tex"
outputs.files graEfficiencyFigFiles
commandLine 'python', "python/plot_estimator_efficiency_charts.py"
}
figFiles +=graEfficiencyFigFiles
def compressionInputFiles = [
"results/compression/compression8.csv",
"results/compression/compression12.csv",
"results/compression/compression16.csv"
]
def compressionFigFiles = ["paper/compression.pdf"]
task makeCompressionCharts (type: Exec) {
inputs.files compressionInputFiles, "python/preamble.py", "python/mvp.py", "python/compression.py", "paper/symbols.tex"
outputs.files compressionFigFiles
commandLine 'python', "python/compression.py"
}
figFiles +=compressionFigFiles
def errorInputFiles = [
"hash4j/test-results/ultraloglog-estimation-error-p08.csv",
"hash4j/test-results/ultraloglog-estimation-error-p12.csv",
"hash4j/test-results/ultraloglog-estimation-error-p16.csv"
]
def errorFigFiles = [
"paper/estimation_error.pdf"
]
task makeErrorCharts (type: Exec) {
inputs.files errorInputFiles, "python/preamble.py", "python/mvp.py", "python/estimation_error_evaluation.py", "paper/symbols.tex"
outputs.files errorFigFiles
commandLine 'python', "python/estimation_error_evaluation.py"
}
figFiles +=errorFigFiles
def performanceFigFiles = [
"paper/add_performance.pdf",
"paper/estimation_performance.pdf",
"paper/estimation_performance_over_error.pdf"
]
task makePerformanceCharts (type: Exec) {
inputs.files "results/benchmark-results.json", "python/mvp.py", "python/benchmark.py", "python/preamble.py", "paper/symbols.tex"
outputs.files performanceFigFiles
commandLine 'python', "python/benchmark.py"
}
figFiles +=performanceFigFiles
def relativeApproximationErrorFigFiles = [
"paper/relative_approximation_error.pdf"
]
task makeRelativeApproximationErrorCharts (type: Exec) {
inputs.files "python/preamble.py", "python/mvp.py", "python/relative_approximation_error_charts.py", "paper/symbols.tex"
outputs.files relativeApproximationErrorFigFiles
commandLine 'python', "python/relative_approximation_error_charts.py"
}
figFiles += relativeApproximationErrorFigFiles
task pdfFigures {
group 'Main'
dependsOn makeMvpCharts, makeRelativeApproximationErrorCharts,makeCompressionCharts,makeErrorCharts, makePerformanceCharts, makeGraEfficiencyCharts
}
static def readPythonLicense(licenseName) {
File licenseFile = new File('licenses/' + licenseName + '.txt')
def line
def s = '#\n'
licenseFile.withReader { reader ->
while ((line = reader.readLine()) != null) {
s += '#'
if(!line.isEmpty()) {
s += ' '
s += line
}
s += '\n'
}
}
s += '#'
return s
}
static def readJavaLicense(licenseName) {
File licenseFile = new File('licenses/' + licenseName + '.txt')
def line
def s = '//\n'
licenseFile.withReader { reader ->
while ((line = reader.readLine()) != null) {
s += '//'
if(!line.isEmpty()) {
s += ' '
s += line
}
s += '\n'
}
}
s += '//'
return s
}
spotless {
def googleJavaFormatVersion = '1.20.0'
def eclipseCdtVersion = '11.3'
def blackVersion = '24.4.0'
def greclipseVersion = '4.29'
ratchetFrom 'origin/main'
apply plugin: 'groovy'
groovyGradle {
target '*.gradle','java/*.gradle'
greclipse(greclipseVersion)
licenseHeader readJavaLicense('license'), 'plugins'
}
python {
target 'python/**/*.py'
black(blackVersion)
licenseHeader readPythonLicense('license'), '(import|from)'
}
cpp {
target 'c++/empiricalMvpComputation.cpp'
eclipseCdt(eclipseCdtVersion)
licenseHeader readJavaLicense('license')
}
java {
target 'java/**/*.java'
importOrder()
removeUnusedImports()
googleJavaFormat(googleJavaFormatVersion)
licenseHeader readJavaLicense('license')
}
}
repositories {
mavenCentral()
}
task buildEmpiricalMVPComputationCpp (type: Exec) {
workingDir 'c++'
outputs.files "c++/empiricalMvpComputation"
commandLine "g++", "-std=c++20", "-Wall", "-O3", "empiricalMvpComputation.cpp", "-o", "empiricalMvpComputation"
standardOutput = new ByteArrayOutputStream()
outputs.upToDateWhen { false }
}
task runEmpiricalMVPComputationCpp (type: Exec) {
group 'main'
inputs.files "c++/empiricalMvpComputation"
outputs.files \
'results/comparison-empirical-mvp/HyperLogLogLog.csv'
standardOutput = new ByteArrayOutputStream()
commandLine "c++/empiricalMvpComputation"
dependsOn buildEmpiricalMVPComputationCpp
}
task runEmpiricalMVPComputationJava {
group 'main'
dependsOn ':java:runEmpiricalMVPComputation'
}
task runEmpiricalMVPComputation {
group 'main'
dependsOn runEmpiricalMVPComputationCpp, runEmpiricalMVPComputationJava
}
task runCompressionSimulation {
group 'main'
dependsOn ':java:runCompressionSimulation'
}
task runBenchmarks {
group 'main'
dependsOn ':java:jmh'
}