-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
170 lines (148 loc) · 6.05 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
// #######################################
// # Copyright (C) 2020-2023 Otmar Ertl. #
// # All rights reserved. #
// #######################################
import java.security.MessageDigest
ext {
paperDir = 'paper'
pythonDir = 'python'
cppDir = 'c++'
bagCppDir = 'bagminhash/c++'
dartCppDir = 'dartminhash'
wyhashDir = "wyhash"
dataDir = 'data'
wyhashCppDir = "${cppDir}/${wyhashDir}"
wyhashHeaderFile = "wyhash.h"
}
task buildPerformanceTestExecutable(type: Exec) {
inputs.files \
"${cppDir}/performance_test.cpp",
"${cppDir}/weighted_minwise_hashing.hpp",
"${cppDir}/bitstream_random.hpp",
"${cppDir}/data_generation.hpp",
"${cppDir}/exponential_distribution.hpp",
"${bagCppDir}/weighted_minwise_hashing.hpp",
"${bagCppDir}/bitstream_random.hpp",
"${bagCppDir}/data_generation.hpp",
"${bagCppDir}/exponential_distribution.hpp",
"${bagCppDir}/xxhash/xxhash.h",
"${bagCppDir}/xxhash/libxxhash.a",
"${dartCppDir}/dartminhash.hpp",
"${dartCppDir}/darthash.hpp",
"${dartCppDir}/similarity.hpp",
"${dartCppDir}/hashing.hpp",
"${wyhashCppDir}/${wyhashHeaderFile}",
"${wyhashCppDir}/${wyhashHeaderFile}"
outputs.files "$cppDir/performance_test.out"
standardOutput = new ByteArrayOutputStream()
commandLine 'g++','-O3','-march=native','-DNDEBUG','-std=c++17','-Wall',"${cppDir}/performance_test.cpp","${bagCppDir}/xxhash/libxxhash.a",'-o',"${cppDir}/performance_test.out"
}
task buildErrorTestExecutable(type: Exec) {
inputs.files \
"${cppDir}/error_test.cpp",
"${cppDir}/weighted_minwise_hashing.hpp",
"${cppDir}/bitstream_random.hpp",
"${cppDir}/data_generation.hpp",
"${cppDir}/exponential_distribution.hpp",
"${bagCppDir}/weighted_minwise_hashing.hpp",
"${bagCppDir}/bitstream_random.hpp",
"${bagCppDir}/data_generation.hpp",
"${bagCppDir}/exponential_distribution.hpp",
"${bagCppDir}/xxhash/xxhash.h",
"${bagCppDir}/xxhash/libxxhash.a",
"${dartCppDir}/dartminhash.hpp",
"${dartCppDir}/darthash.hpp",
"${dartCppDir}/similarity.hpp",
"${dartCppDir}/hashing.hpp",
"${wyhashCppDir}/${wyhashHeaderFile}",
"${wyhashCppDir}/${wyhashHeaderFile}"
outputs.files "${cppDir}/error_test.out"
standardOutput = new ByteArrayOutputStream()
commandLine 'g++','-O3','-march=native', '-std=c++17','-fopenmp','-Wall',"${cppDir}/error_test.cpp","${bagCppDir}/xxhash/libxxhash.a",'-o',"${cppDir}/error_test.out"
}
task buildInnerProductTestExecutable(type: Exec) {
inputs.files \
"${cppDir}/inner_product_test.cpp",
"${cppDir}/weighted_minwise_hashing.hpp",
"${cppDir}/bitstream_random.hpp",
"${cppDir}/data_generation.hpp",
"${cppDir}/exponential_distribution.hpp",
"${wyhashCppDir}/${wyhashHeaderFile}",
"${wyhashCppDir}/${wyhashHeaderFile}"
outputs.files "${cppDir}/inner_product_test.out"
standardOutput = new ByteArrayOutputStream()
commandLine 'g++','-O3','-march=native', '-std=c++17','-Wall',"${cppDir}/inner_product_test.cpp","${bagCppDir}/xxhash/libxxhash.a",'-o',"${cppDir}/inner_product_test.out"
}
def hashSizes = [256, 1024, 4096]
def dataSizes = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000 /*, 2000000, 5000000, 10000000*/]
def generateMD5(String s) {
MessageDigest digest = MessageDigest.getInstance("MD5")
digest.update(s.bytes)
new BigInteger(1, digest.digest()).longValue()
}
def performanceTestDatFiles = []
def performanceTestTasks = []
for(hashSize in hashSizes) {
for(dataSize in dataSizes) {
def performanceTestTaskName = "doPerformanceTest_${hashSize}_${dataSize}"
def performanceTestDatFile = "$dataDir/performance_test_result_${hashSize}_${dataSize}.dat"
def seed = generateMD5(performanceTestTaskName)
task "$performanceTestTaskName" (type: Exec) {
workingDir cppDir
inputs.files "$cppDir/performance_test.out"
outputs.files performanceTestDatFile
doFirst {
standardOutput = new FileOutputStream(performanceTestDatFile)
}
commandLine './performance_test.out', seed, hashSize, dataSize
dependsOn 'buildPerformanceTestExecutable'
}
performanceTestDatFiles.add performanceTestDatFile
performanceTestTasks.add performanceTestTaskName
}
}
def executeErrorTestOutput = "${dataDir}/error_test.csv"
task executeErrorTest (type: Exec) {
group 'TreeMinHash'
inputs.files "${cppDir}/error_test.out"
outputs.files executeErrorTestOutput
doFirst {
standardOutput = new FileOutputStream(executeErrorTestOutput)
}
commandLine "${cppDir}/error_test.out"
dependsOn buildErrorTestExecutable
}
task executePerformanceTests {
group 'TreeMinHash'
dependsOn performanceTestTasks
doLast {
}
}
task execute {
group 'TreeMinHash'
dependsOn executePerformanceTests, executeErrorTest
doLast {
}
}
def speedChartsFigs = ["${paperDir}/speed_charts.pdf", "${paperDir}/speed_charts.svg"]
def errorChartsFigs = ["${paperDir}/error_charts.pdf", "${paperDir}/speed_charts.svg"]
def figFiles = speedChartsFigs + errorChartsFigs
task makeErrorFigures (type: Exec) {
inputs.files executeErrorTestOutput, "${pythonDir}/error_charts.py","${pythonDir}/color_defs.py"
outputs.files errorChartsFigs
doFirst {
standardOutput = new ByteArrayOutputStream()
}
commandLine 'python3', "${pythonDir}/error_charts.py"
}
task makeSpeedTestFigures (type: Exec) {
inputs.files performanceTestDatFiles, "${pythonDir}/speed_charts.py","${pythonDir}/color_defs.py"
outputs.files speedChartsFigs
commandLine 'python3', "${pythonDir}/speed_charts.py"
}
task figures {
dependsOn makeErrorFigures, makeSpeedTestFigures
}
task buildAll {
dependsOn buildPerformanceTestExecutable, buildErrorTestExecutable, buildInnerProductTestExecutable
}