Skip to content

Commit 05ace75

Browse files
authored
Merge pull request #7 from arincdemir/dense-timescales-tests
Added timescales as tests and fixed the timing issues making them fail
2 parents 337a28e + ee5bcd2 commit 05ace75

2 files changed

Lines changed: 615 additions & 25 deletions

File tree

benchmarks/benchmark_engine.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ TEST_CASE("Dense AbsentAQ", "[dense_benchmarks][AbsentAQ]") {
5757
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
5858

5959
BENCHMARK_ADVANCED("AbsentAQ " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
60-
IntervalSetHolder holder = newHolder(100000);
60+
IntervalSetHolder holder = newHolder(1000);
6161
Node q{empty(holder), empty(holder), NodeType::PROPOSITION, 0, 0, 0, 0};
6262
Node p{empty(holder), empty(holder), NodeType::PROPOSITION, 0, 0, 0, 0};
6363
Node once{empty(holder), empty(holder), NodeType::EVENTUALLY, 0, 0, 0, TIMINGS};
@@ -68,11 +68,12 @@ TEST_CASE("Dense AbsentAQ", "[dense_benchmarks][AbsentAQ]") {
6868
std::vector<Node> nodes{q, p, once, notNode, since, implies, always};
6969

7070
std::string file_name = "data/fullsuite/AbsentAQ/" + CONDENSATION + "/1M/AbsentAQ" + std::to_string(TIMINGS) +".row.bin";
71-
const auto& allInputs = InputCache::get(file_name); meter.measure([&] {
71+
const auto& allInputs = InputCache::get(file_name);
72+
meter.measure([&] {
7273
IntervalSet finalOutput;
7374
for (int i = 1; i < allInputs.size(); i++){
7475
auto newInput = allInputs[i];
75-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p});
76+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p});
7677
finalOutput = output;
7778
swapBuffers(holder);
7879
}
@@ -110,7 +111,7 @@ TEST_CASE("Dense AbsentBQR", "[dense_benchmarks][AbsentBQR]") {
110111
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
111112

112113
BENCHMARK_ADVANCED("AbsentBQR " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
113-
IntervalSetHolder holder = newHolder(100000);
114+
IntervalSetHolder holder = newHolder(1000);
114115

115116
const int since_a = 3 * (TIMINGS / 10);
116117
const int since_b = TIMINGS;
@@ -136,7 +137,7 @@ TEST_CASE("Dense AbsentBQR", "[dense_benchmarks][AbsentBQR]") {
136137
for (int i = 1; i < allInputs.size(); i++){
137138
auto newInput = allInputs[i];
138139
// Order matches nodes: q, p, r
139-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p, newInput.r});
140+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p, allInputs[i - 1].r});
140141
finalOutput = output;
141142
swapBuffers(holder);
142143
}
@@ -165,7 +166,7 @@ TEST_CASE("Dense AbsentBR", "[dense_benchmarks][AbsentBR]") {
165166
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
166167

167168
BENCHMARK_ADVANCED("AbsentBR " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
168-
IntervalSetHolder holder = newHolder(100000);
169+
IntervalSetHolder holder = newHolder(1000);
169170

170171
const int inner_always_b = TIMINGS;
171172

@@ -186,7 +187,7 @@ TEST_CASE("Dense AbsentBR", "[dense_benchmarks][AbsentBR]") {
186187
for (int i = 1; i < allInputs.size(); i++){
187188
auto newInput = allInputs[i];
188189
// Order matches nodes: q, p, r
189-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p, newInput.r});
190+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p, allInputs[i - 1].r});
190191
finalOutput = output;
191192
swapBuffers(holder);
192193
}
@@ -215,7 +216,7 @@ TEST_CASE("Dense AlwaysAQ", "[dense_benchmarks][AlwaysAQ]") {
215216
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
216217

217218
BENCHMARK_ADVANCED("AlwaysAQ " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
218-
IntervalSetHolder holder = newHolder(100000);
219+
IntervalSetHolder holder = newHolder(1000);
219220

220221
const int once_b = TIMINGS;
221222

@@ -236,7 +237,7 @@ TEST_CASE("Dense AlwaysAQ", "[dense_benchmarks][AlwaysAQ]") {
236237
for (int i = 1; i < allInputs.size(); i++){
237238
auto newInput = allInputs[i];
238239
// Order matches nodes: q, p, r
239-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p, newInput.r});
240+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p, allInputs[i - 1].r});
240241
finalOutput = output;
241242
swapBuffers(holder);
242243
}
@@ -265,7 +266,7 @@ TEST_CASE("Dense AlwaysBQR", "[dense_benchmarks][AlwaysBQR]") {
265266
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
266267

267268
BENCHMARK_ADVANCED("AlwaysBQR " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
268-
IntervalSetHolder holder = newHolder(100000);
269+
IntervalSetHolder holder = newHolder(1000);
269270

270271
const int since_a = 3 * (TIMINGS / 10);
271272
const int since_b = TIMINGS;
@@ -291,7 +292,7 @@ TEST_CASE("Dense AlwaysBQR", "[dense_benchmarks][AlwaysBQR]") {
291292
for (int i = 1; i < allInputs.size(); i++){
292293
auto newInput = allInputs[i];
293294
// Order matches nodes: q, p, r
294-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p, newInput.r});
295+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p, allInputs[i - 1].r});
295296
finalOutput = output;
296297
swapBuffers(holder);
297298
}
@@ -320,7 +321,7 @@ TEST_CASE("Dense AlwaysBR", "[dense_benchmarks][AlwaysBR]") {
320321
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
321322

322323
BENCHMARK_ADVANCED("AlwaysBR " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
323-
IntervalSetHolder holder = newHolder(100000);
324+
IntervalSetHolder holder = newHolder(1000);
324325

325326
const int inner_always_b = TIMINGS;
326327

@@ -340,7 +341,7 @@ TEST_CASE("Dense AlwaysBR", "[dense_benchmarks][AlwaysBR]") {
340341
for (int i = 1; i < allInputs.size(); i++){
341342
auto newInput = allInputs[i];
342343
// Order matches nodes: q, p, r
343-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p, newInput.r});
344+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p, allInputs[i - 1].r});
344345
finalOutput = output;
345346
swapBuffers(holder);
346347
}
@@ -369,7 +370,7 @@ TEST_CASE("Dense RecurBQR", "[dense_benchmarks][RecurBQR]") {
369370
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
370371

371372
BENCHMARK_ADVANCED("RecurBQR " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
372-
IntervalSetHolder holder = newHolder(100000);
373+
IntervalSetHolder holder = newHolder(1000);
373374

374375
const int inner_once_b = TIMINGS;
375376

@@ -395,7 +396,7 @@ TEST_CASE("Dense RecurBQR", "[dense_benchmarks][RecurBQR]") {
395396
for (int i = 1; i < allInputs.size(); i++){
396397
auto newInput = allInputs[i];
397398
// Order matches nodes: q, p, r
398-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p, newInput.r});
399+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p, allInputs[i - 1].r});
399400
finalOutput = output;
400401
swapBuffers(holder);
401402
}
@@ -426,7 +427,7 @@ TEST_CASE("Dense RecurGLB", "[dense_benchmarks][RecurGLB]") {
426427
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
427428

428429
BENCHMARK_ADVANCED("RecurGLB " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
429-
IntervalSetHolder holder = newHolder(100000);
430+
IntervalSetHolder holder = newHolder(1000);
430431
Node p{empty(holder), empty(holder), NodeType::PROPOSITION, 0, 0, 0, 0};
431432
Node once{empty(holder), empty(holder), NodeType::EVENTUALLY, 0, 0, 0, TIMINGS};
432433
Node always{empty(holder), empty(holder), NodeType::ALWAYS, 0, 1, 0, B_INFINITY};
@@ -439,7 +440,7 @@ TEST_CASE("Dense RecurGLB", "[dense_benchmarks][RecurGLB]") {
439440
for (int i = 1; i < allInputs.size(); i++){
440441
auto newInput = allInputs[i];
441442
// Order matches nodes: just p
442-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.p});
443+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].p});
443444
finalOutput = output;
444445
swapBuffers(holder);
445446
}
@@ -470,7 +471,7 @@ TEST_CASE("Dense RespondBQR", "[dense_benchmarks][RespondBQR]") {
470471
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
471472

472473
BENCHMARK_ADVANCED("RespondBQR " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
473-
IntervalSetHolder holder = newHolder(1000000);
474+
IntervalSetHolder holder = newHolder(1000);
474475

475476
const int once_a = 3 * (TIMINGS / 10);
476477
const int once_b = TIMINGS;
@@ -503,7 +504,7 @@ TEST_CASE("Dense RespondBQR", "[dense_benchmarks][RespondBQR]") {
503504
for (int i = 1; i < allInputs.size(); i++){
504505
auto newInput = allInputs[i];
505506
// Order matches nodes: q, p, s, r
506-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.q, newInput.p, newInput.s, newInput.r});
507+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].q, allInputs[i - 1].p, allInputs[i - 1].s, allInputs[i - 1].r});
507508
finalOutput = output;
508509
swapBuffers(holder);
509510
}
@@ -533,7 +534,7 @@ TEST_CASE("Dense RespondGLB", "[dense_benchmarks][RespondGLB]") {
533534
std::string benchmarkName = CONDENSATION + " " + std::to_string(TIMINGS);
534535

535536
BENCHMARK_ADVANCED("RespondGLB " + benchmarkName)(Catch::Benchmark::Chronometer meter) {
536-
IntervalSetHolder holder = newHolder(100000);
537+
IntervalSetHolder holder = newHolder(1000);
537538

538539
const int once_a = 3 * (TIMINGS / 10);
539540
const int once_b = TIMINGS;
@@ -556,9 +557,8 @@ TEST_CASE("Dense RespondGLB", "[dense_benchmarks][RespondGLB]") {
556557
meter.measure([&] {
557558
IntervalSet finalOutput;
558559
for (int i = 1; i < allInputs.size(); i++){
559-
auto newInput = allInputs[i];
560560
// Order matches nodes: p, s
561-
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, newInput.time, {newInput.p, newInput.s});
561+
IntervalSet output = run_evaluation(nodes, holder, allInputs[i - 1].time, allInputs[i].time, {allInputs[i - 1].p, allInputs[i - 1].s});
562562
finalOutput = output;
563563
swapBuffers(holder);
564564
}

0 commit comments

Comments
 (0)