Commit 98262034 authored by Noric Couderc's avatar Noric Couderc
Browse files

Print raw features without aggregation

We used to run the benchmark many times are aggregate the values of
counters (median) before. Now when we print the features, we don't do
that anymore. We print the raw data.

Doing this required to add an "iteration" number for each specific run.
parent 08fb8642
......@@ -24,7 +24,7 @@ class SyntheticBenchmarkFeaturePrinter(out: Writer,
* (They are printed in long form)
*/
override fun printHeader() {
printer.printRecord("benchmark_id", "feature", "feature_type", "value")
printer.printRecord("benchmark_id", "iteration", "feature", "feature_type", "value")
}
/**
......@@ -36,19 +36,29 @@ class SyntheticBenchmarkFeaturePrinter(out: Writer,
println("Extracting features for benchmark: $identifier")
// Getting the collection name, printing it.
val collection = syntheticBenchmark.dataStructureSimpleName
printer.printRecord(identifier, "collection", "collection", collection)
val runResults = benchmarkResults[identifier]!!.sortedBy { it.iteration }
printSoftwareCounters(syntheticBenchmark, identifier)
// For some features, we don't want to print them once for each counter
// We just want to print them once
val selectedCounter = runResults.map { it.counter }.first()
printHardwareCounters(identifier, benchmarkResults)
for (r in runResults) {
if (r.counter == selectedCounter) {
val collection = syntheticBenchmark.dataStructureSimpleName
printer.printRecord(identifier, r.iteration, "collection", "collection", collection)
printStopWatchCounters(syntheticBenchmark, identifier)
printSoftwareCounters(r)
printStopWatchCounters(r)
}
printHardwareCounters(r)
}
}
private fun printStopWatchCounters(syntheticBenchmark: BCBenchmarkPackage<*>, identifier: String) {
val counters = stopWatchRunner.getStopWatchCounters(syntheticBenchmark)
private fun printStopWatchCounters(runData: PapiRunner.BenchmarkRunData) {
val identifier = runData.benchmark.benchmarkIdentifier
val counters = stopWatchRunner.getStopWatchCounters(runData.benchmark)
for (c in counters) {
val value = when (normalizeFeatures) {
......@@ -56,26 +66,29 @@ class SyntheticBenchmarkFeaturePrinter(out: Writer,
false -> c.absolute
}
printer.printRecord(identifier, c.stopWatchType, "hardware", value)
printer.printRecord(identifier, runData.iteration, c.stopWatchType, "hardware", value)
}
}
private fun printHardwareCounters(identifier: String, results: Map<String, List<PapiRunner.BenchmarkRunData>>) {
val hardwareFeatures = results[identifier]!!
for (benchData in hardwareFeatures) {
printer.printRecord(identifier, benchData.counter, "hardware", benchData.value)
}
private fun printHardwareCounters(runData : PapiRunner.BenchmarkRunData) {
printer.printRecord(runData.benchmark.benchmarkIdentifier,
runData.iteration,
runData.counter,
"hardware",
runData.value)
}
private fun printSoftwareCounters(syntheticBenchmark: BCBenchmarkPackage<*>, identifier: String) {
private fun printSoftwareCounters(runData : PapiRunner.BenchmarkRunData) {
val identifier = runData.benchmark.benchmarkIdentifier
// Getting the software perf counters
val softwareCounters =
when (normalizeFeatures) {
true -> syntheticBenchmark.methodNormalizedHistogram()
false -> syntheticBenchmark.methodHistogram()
true -> runData.benchmark.methodNormalizedHistogram()
false -> runData.benchmark.methodHistogram()
}
for (kvp in softwareCounters) {
printer.printRecord(identifier, getMethodName(kvp.key), "software", kvp.value)
printer.printRecord(identifier, runData.iteration,
getMethodName(kvp.key), "software", kvp.value)
}
}
......@@ -89,7 +102,7 @@ class SyntheticBenchmarkFeaturePrinter(out: Writer,
true -> papiRunner.runApplicationsNormalized(syntheticBenchmarks).groupBy {
it.benchmark.benchmarkIdentifier
}
false -> papiRunner.runApplicationsMedian(syntheticBenchmarks).groupBy {
false -> papiRunner.runApplications(syntheticBenchmarks).groupBy {
it.benchmark.benchmarkIdentifier
}
}
......
......@@ -3,7 +3,6 @@ package se.lth.cs
import org.openjdk.jmh.infra.Blackhole
import papi.EventSet
import papi.Papi
import papi.PapiException
import se.lth.cs.bcgen.BCBenchmarkPackage
import java.io.FileWriter
......@@ -15,9 +14,11 @@ open class PapiRunner(private val numRuns: Int, counters: CounterSpecification)
val counterSpec = counters
data class BenchmarkRunData(val benchmark : BCBenchmarkPackage<*>,
val counter : String,
val value : Double)
data class BenchmarkRunData(
val benchmark: BCBenchmarkPackage<*>,
val iteration: Int,
val counter: String,
val value: Double)
protected var blackhole = Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.")
......@@ -160,8 +161,7 @@ open class PapiRunner(private val numRuns: Int, counters: CounterSpecification)
return result.toMap()
}
fun runApplications(syntheticBenchmarks: List<BCBenchmarkPackage<*>>): List<Triple<BCBenchmarkPackage<*>, String, List<Long>>> {
fun runApplications(syntheticBenchmarks: List<BCBenchmarkPackage<*>>): List<BenchmarkRunData> {
// return syntheticBenchmarks.map { b -> runApplication(iterations, b) }
val specs = createRunSpecs(syntheticBenchmarks)
val numberBenchmarks = specs.size
......@@ -173,28 +173,32 @@ open class PapiRunner(private val numRuns: Int, counters: CounterSpecification)
Pair(it, samples)
}
println("Finished running specs.")
return spectToCounters.map {
Triple(it.first.syntheticBenchmark,
// We create a report for a run for each individual sample
return spectToCounters.flatMap {
it.second.mapIndexed { index, sample ->
BenchmarkRunData(it.first.syntheticBenchmark,
index,
it.first.counter,
it.second)
sample.toDouble())
}
}
}
fun runApplicationsMedian(syntheticBenchmarks: List<BCBenchmarkPackage<*>>) : List<BenchmarkRunData> {
val samples = runApplications(syntheticBenchmarks)
return samples.map {
BenchmarkRunData(it.first, it.second, medianLong(it.third))
}
}
fun runApplicationsNormalized(syntheticBenchmarks: List<BCBenchmarkPackage<*>>) : List<BenchmarkRunData> {
val countersMedians = runApplicationsMedian(syntheticBenchmarks)
val instructionsForBenchmark = countersMedians.filter { it.counter == "PAPI_TOT_INS" }
.associate { Pair(it.benchmark, it.value) }
val benchmarkRuns = runApplications(syntheticBenchmarks)
val instructionsForRun = benchmarkRuns.filter { it.counter == "PAPI_TOT_INS" }
.associate {
val k = Pair(it.benchmark, it.iteration)
val v = it.value
Pair(k, v)
}
return countersMedians.map {
BenchmarkRunData(it.benchmark, it.counter, it.value / instructionsForBenchmark[it.benchmark]!!)
return benchmarkRuns.map {
val k = Pair(it.benchmark, it.iteration)
val numberInstructions = instructionsForRun[k]
BenchmarkRunData(it.benchmark, it.iteration, it.counter, it.value / numberInstructions!!)
}
}
......
......@@ -74,13 +74,13 @@ public class PapiRunnerTest {
3,
100
);
List<PapiRunner.BenchmarkRunData> data = runner.runApplicationsMedian(syntheticBenchmarks);
List<PapiRunner.BenchmarkRunData> data = runner.runApplications(syntheticBenchmarks);
// We check all known Papi counters are in the map
Assertions.assertFalse(data.isEmpty());
for (PapiRunner.BenchmarkRunData counters : data) {
Assertions.assertTrue(
specification.getCurrentSpec().containsKey(counters.component2())
specification.getCurrentSpec().containsKey(counters.getCounter())
);
Assertions.assertTrue( counters.getValue() >= 0 );
}
......@@ -97,26 +97,6 @@ public class PapiRunnerTest {
}
}
@Test
public void testPapiRunBenchmarkMedian() {
BCBenchmarkPackage<Map<Object, Object>> bench = BCBenchmarkPackage.MAP(0, 100, 0, new HashMap());
ArrayList<BCBenchmarkPackage<?>> benches = new ArrayList<>();
benches.add(bench);
List<PapiRunner.BenchmarkRunData> results = runner.runApplicationsMedian(benches);
Assertions.assertFalse(results.isEmpty());
// Check that no counter is repeated twice.
Map<String, List<PapiRunner.BenchmarkRunData>> groups =
results.stream().collect(Collectors.groupingBy(PapiRunner.BenchmarkRunData::getCounter));
Assertions.assertFalse(groups.isEmpty());
for (String counter : groups.keySet()) {
List<?> matches = groups.get(counter);
Assertions.assertTrue(matches.size() == 1);
}
}
@Test
public void testRunManyBenchmarks() {
// We want to test our setup can handle many benchmarks without crashing.
......@@ -127,10 +107,9 @@ public class PapiRunnerTest {
benchmarks.add(bench);
}
List<Triple<BCBenchmarkPackage<?>, String, List<Long>>> results = runner.runApplications(benchmarks);
for (Triple<BCBenchmarkPackage<?>, String, List<Long>> r : results) {
Assertions.assertFalse(r.component3().isEmpty());
}
List<PapiRunner.BenchmarkRunData> results = runner.runApplications(benchmarks);
Assertions.assertFalse(results.isEmpty());
}
@Test
......
......@@ -31,7 +31,7 @@ class SyntheticBenchmarkFeaturePrinterTest {
val papiRunner = MockupPapiRunner( 10, counterSpec)
val papiRunner = MockupPapiRunner( 3, counterSpec)
val stopWatchRunner = MockupStopWatchRunner()
......@@ -48,7 +48,7 @@ class SyntheticBenchmarkFeaturePrinterTest {
csvPrinter.printToCSV(toPrint)
Assertions.assertEquals(
"benchmark_id,feature,feature_type,value", writer.toString().lineSequence().first())
"benchmark_id,iteration,feature,feature_type,value", writer.toString().lineSequence().first())
}
/**
......@@ -102,23 +102,55 @@ class SyntheticBenchmarkFeaturePrinterTest {
csvPrinter.printToCSV(listOf<BCBenchmarkPackage<*>>(benchmark))
val expectedText = """
benchmark_id,feature,feature_type,value
Synth:POLYA:0:10:Map:0:HashMap,collection,collection,HashMap
Synth:POLYA:0:10:Map:0:HashMap,runContainsValue,software,2
Synth:POLYA:0:10:Map:0:HashMap,runClear,software,1
Synth:POLYA:0:10:Map:0:HashMap,runPut,software,3
Synth:POLYA:0:10:Map:0:HashMap,runRemove2,software,1
Synth:POLYA:0:10:Map:0:HashMap,runKeySet,software,1
Synth:POLYA:0:10:Map:0:HashMap,runSize,software,1
Synth:POLYA:0:10:Map:0:HashMap,runContainsKey,software,1
Synth:POLYA:0:10:Map:0:HashMap,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,PAPI_TOT_INS,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,cyclesIterations,hardware,1000.0
benchmark_id,iteration,feature,feature_type,value
Synth:POLYA:0:10:Map:0:HashMap,0,collection,collection,HashMap
Synth:POLYA:0:10:Map:0:HashMap,0,runContainsValue,software,2
Synth:POLYA:0:10:Map:0:HashMap,0,runClear,software,1
Synth:POLYA:0:10:Map:0:HashMap,0,runPut,software,3
Synth:POLYA:0:10:Map:0:HashMap,0,runRemove2,software,1
Synth:POLYA:0:10:Map:0:HashMap,0,runKeySet,software,1
Synth:POLYA:0:10:Map:0:HashMap,0,runSize,software,1
Synth:POLYA:0:10:Map:0:HashMap,0,runContainsKey,software,1
Synth:POLYA:0:10:Map:0:HashMap,0,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,0,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,0,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,0,cyclesIterations,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,0,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,0,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,0,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,0,PAPI_TOT_INS,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,1,collection,collection,HashMap
Synth:POLYA:0:10:Map:0:HashMap,1,runContainsValue,software,2
Synth:POLYA:0:10:Map:0:HashMap,1,runClear,software,1
Synth:POLYA:0:10:Map:0:HashMap,1,runPut,software,3
Synth:POLYA:0:10:Map:0:HashMap,1,runRemove2,software,1
Synth:POLYA:0:10:Map:0:HashMap,1,runKeySet,software,1
Synth:POLYA:0:10:Map:0:HashMap,1,runSize,software,1
Synth:POLYA:0:10:Map:0:HashMap,1,runContainsKey,software,1
Synth:POLYA:0:10:Map:0:HashMap,1,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,1,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,1,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,1,cyclesIterations,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,1,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,1,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,1,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,1,PAPI_TOT_INS,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,2,collection,collection,HashMap
Synth:POLYA:0:10:Map:0:HashMap,2,runContainsValue,software,2
Synth:POLYA:0:10:Map:0:HashMap,2,runClear,software,1
Synth:POLYA:0:10:Map:0:HashMap,2,runPut,software,3
Synth:POLYA:0:10:Map:0:HashMap,2,runRemove2,software,1
Synth:POLYA:0:10:Map:0:HashMap,2,runKeySet,software,1
Synth:POLYA:0:10:Map:0:HashMap,2,runSize,software,1
Synth:POLYA:0:10:Map:0:HashMap,2,runContainsKey,software,1
Synth:POLYA:0:10:Map:0:HashMap,2,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,2,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,2,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,2,cyclesIterations,hardware,1000.0
Synth:POLYA:0:10:Map:0:HashMap,2,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,2,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,2,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:Map:0:HashMap,2,PAPI_TOT_INS,hardware,0.0
""".trimIndent()
......@@ -142,18 +174,40 @@ class SyntheticBenchmarkFeaturePrinterTest {
val expectedText =
"""
benchmark_id,feature,feature_type,value
Trace:Test benchmark:75023265:4:List:0:ArrayList,collection,collection,ArrayList
Trace:Test benchmark:75023265:4:List:0:ArrayList,runGet,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,runAdd,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,PAPI_L1_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,PAPI_L2_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,PAPI_TOT_CYC,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,PAPI_TOT_INS,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,cyclesInsertions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,cyclesDeletions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,cyclesSearches,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,cyclesIterations,hardware,0.1
benchmark_id,iteration,feature,feature_type,value
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,collection,collection,ArrayList
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,runGet,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,runAdd,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,cyclesInsertions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,cyclesDeletions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,cyclesSearches,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,cyclesIterations,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,PAPI_L1_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,PAPI_L2_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,PAPI_TOT_CYC,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,0,PAPI_TOT_INS,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,collection,collection,ArrayList
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,runGet,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,runAdd,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,cyclesInsertions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,cyclesDeletions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,cyclesSearches,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,cyclesIterations,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,PAPI_L1_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,PAPI_L2_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,PAPI_TOT_CYC,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,1,PAPI_TOT_INS,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,collection,collection,ArrayList
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,runGet,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,runAdd,software,0.5
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,cyclesInsertions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,cyclesDeletions,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,cyclesSearches,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,cyclesIterations,hardware,0.1
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,PAPI_L1_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,PAPI_L2_DCM,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,PAPI_TOT_CYC,hardware,1.0
Trace:Test benchmark:75023265:4:List:0:ArrayList,2,PAPI_TOT_INS,hardware,1.0
""".trimIndent()
......@@ -180,39 +234,103 @@ class SyntheticBenchmarkFeaturePrinterTest {
val expectedText =
"""
benchmark_id,feature,feature_type,value
Synth:POLYA:0:10:List:0:ArrayList,collection,collection,ArrayList
Synth:POLYA:0:10:List:0:ArrayList,runToString,software,1
Synth:POLYA:0:10:List:0:ArrayList,runIndexOf,software,1
Synth:POLYA:0:10:List:0:ArrayList,runSort,software,3
Synth:POLYA:0:10:List:0:ArrayList,runContainsAll,software,1
Synth:POLYA:0:10:List:0:ArrayList,runContains,software,2
Synth:POLYA:0:10:List:0:ArrayList,runSize,software,2
Synth:POLYA:0:10:List:0:ArrayList,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,PAPI_TOT_INS,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,cyclesIterations,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,collection,collection,ArrayList
Synth:POLYA:1:10:List:0:ArrayList,runToArray2,software,1
Synth:POLYA:1:10:List:0:ArrayList,runRetainAll,software,2
Synth:POLYA:1:10:List:0:ArrayList,runListIterator,software,1
Synth:POLYA:1:10:List:0:ArrayList,runEquals,software,2
Synth:POLYA:1:10:List:0:ArrayList,runToArray,software,1
Synth:POLYA:1:10:List:0:ArrayList,runContains,software,1
Synth:POLYA:1:10:List:0:ArrayList,runContainsAll,software,1
Synth:POLYA:1:10:List:0:ArrayList,runHashCode,software,1
Synth:POLYA:1:10:List:0:ArrayList,PAPI_L1_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,PAPI_L2_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,PAPI_TOT_CYC,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,PAPI_TOT_INS,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,cyclesInsertions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,cyclesDeletions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,cyclesSearches,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,cyclesIterations,hardware,1000.0
benchmark_id,iteration,feature,feature_type,value
Synth:POLYA:0:10:List:0:ArrayList,0,collection,collection,ArrayList
Synth:POLYA:0:10:List:0:ArrayList,0,runToString,software,1
Synth:POLYA:0:10:List:0:ArrayList,0,runIndexOf,software,1
Synth:POLYA:0:10:List:0:ArrayList,0,runSort,software,3
Synth:POLYA:0:10:List:0:ArrayList,0,runContainsAll,software,1
Synth:POLYA:0:10:List:0:ArrayList,0,runContains,software,2
Synth:POLYA:0:10:List:0:ArrayList,0,runSize,software,2
Synth:POLYA:0:10:List:0:ArrayList,0,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,0,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,0,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,0,cyclesIterations,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,0,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,0,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,0,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,0,PAPI_TOT_INS,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,1,collection,collection,ArrayList
Synth:POLYA:0:10:List:0:ArrayList,1,runToString,software,1
Synth:POLYA:0:10:List:0:ArrayList,1,runIndexOf,software,1
Synth:POLYA:0:10:List:0:ArrayList,1,runSort,software,3
Synth:POLYA:0:10:List:0:ArrayList,1,runContainsAll,software,1
Synth:POLYA:0:10:List:0:ArrayList,1,runContains,software,2
Synth:POLYA:0:10:List:0:ArrayList,1,runSize,software,2
Synth:POLYA:0:10:List:0:ArrayList,1,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,1,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,1,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,1,cyclesIterations,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,1,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,1,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,1,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,1,PAPI_TOT_INS,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,2,collection,collection,ArrayList
Synth:POLYA:0:10:List:0:ArrayList,2,runToString,software,1
Synth:POLYA:0:10:List:0:ArrayList,2,runIndexOf,software,1
Synth:POLYA:0:10:List:0:ArrayList,2,runSort,software,3
Synth:POLYA:0:10:List:0:ArrayList,2,runContainsAll,software,1
Synth:POLYA:0:10:List:0:ArrayList,2,runContains,software,2
Synth:POLYA:0:10:List:0:ArrayList,2,runSize,software,2
Synth:POLYA:0:10:List:0:ArrayList,2,cyclesInsertions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,2,cyclesDeletions,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,2,cyclesSearches,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,2,cyclesIterations,hardware,1000.0
Synth:POLYA:0:10:List:0:ArrayList,2,PAPI_L1_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,2,PAPI_L2_DCM,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,2,PAPI_TOT_CYC,hardware,0.0
Synth:POLYA:0:10:List:0:ArrayList,2,PAPI_TOT_INS,hardware,0.0
Synth:POLYA:1:10:List:0:ArrayList,0,collection,collection,ArrayList
Synth:POLYA:1:10:List:0:ArrayList,0,runToArray2,software,1
Synth:POLYA:1:10:List:0:ArrayList,0,runRetainAll,software,2
Synth:POLYA:1:10:List:0:ArrayList,0,runListIterator,software,1
Synth:POLYA:1:10:List:0:ArrayList,0,runEquals,software,2
Synth:POLYA:1:10:List:0:ArrayList,0,runToArray,software,1
Synth:POLYA:1:10:List:0:ArrayList,0,runContains,software,1
Synth:POLYA:1:10:List:0:ArrayList,0,runContainsAll,software,1
Synth:POLYA:1:10:List:0:ArrayList,0,runHashCode,software,1
Synth:POLYA:1:10:List:0:ArrayList,0,cyclesInsertions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,0,cyclesDeletions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,0,cyclesSearches,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,0,cyclesIterations,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,0,PAPI_L1_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,0,PAPI_L2_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,0,PAPI_TOT_CYC,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,0,PAPI_TOT_INS,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,1,collection,collection,ArrayList
Synth:POLYA:1:10:List:0:ArrayList,1,runToArray2,software,1
Synth:POLYA:1:10:List:0:ArrayList,1,runRetainAll,software,2
Synth:POLYA:1:10:List:0:ArrayList,1,runListIterator,software,1
Synth:POLYA:1:10:List:0:ArrayList,1,runEquals,software,2
Synth:POLYA:1:10:List:0:ArrayList,1,runToArray,software,1
Synth:POLYA:1:10:List:0:ArrayList,1,runContains,software,1
Synth:POLYA:1:10:List:0:ArrayList,1,runContainsAll,software,1
Synth:POLYA:1:10:List:0:ArrayList,1,runHashCode,software,1
Synth:POLYA:1:10:List:0:ArrayList,1,cyclesInsertions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,1,cyclesDeletions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,1,cyclesSearches,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,1,cyclesIterations,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,1,PAPI_L1_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,1,PAPI_L2_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,1,PAPI_TOT_CYC,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,1,PAPI_TOT_INS,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,2,collection,collection,ArrayList
Synth:POLYA:1:10:List:0:ArrayList,2,runToArray2,software,1
Synth:POLYA:1:10:List:0:ArrayList,2,runRetainAll,software,2
Synth:POLYA:1:10:List:0:ArrayList,2,runListIterator,software,1
Synth:POLYA:1:10:List:0:ArrayList,2,runEquals,software,2
Synth:POLYA:1:10:List:0:ArrayList,2,runToArray,software,1
Synth:POLYA:1:10:List:0:ArrayList,2,runContains,software,1
Synth:POLYA:1:10:List:0:ArrayList,2,runContainsAll,software,1
Synth:POLYA:1:10:List:0:ArrayList,2,runHashCode,software,1
Synth:POLYA:1:10:List:0:ArrayList,2,cyclesInsertions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,2,cyclesDeletions,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,2,cyclesSearches,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,2,cyclesIterations,hardware,1000.0
Synth:POLYA:1:10:List:0:ArrayList,2,PAPI_L1_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,2,PAPI_L2_DCM,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,2,PAPI_TOT_CYC,hardware,1.0
Synth:POLYA:1:10:List:0:ArrayList,2,PAPI_TOT_INS,hardware,1.0
""".trimIndent()
......
......@@ -256,6 +256,7 @@ def remove_weakmap_hashmap(dataframe):
#%%
# NOT USED
def generate_polynomial_features(features):
"""
features: A matrix of feature vectors
......@@ -442,7 +443,7 @@ def prepare_long_form_data(jmh_data, features_data):
Takes features and jmh data to create data JBrainy can
use for training
The "features" data should be a long-form dataframe with columns
(benchmark_id, feature, feature_type, value)
(benchmark_id, iteration, feature, feature_type, value)
"""
validate_jmh_data(jmh_data)
validate_features_data(features_data, len(jmh_data))
......@@ -454,7 +455,7 @@ def prepare_long_form_data(jmh_data, features_data):
features_data_wide = pd.pivot(features_data,
columns="feature",
values="value",
index="benchmark_id").reset_index().fillna(value=0)
index=["benchmark_id", "iteration"]).reset_index().fillna(value=0)
hardware_features = features_data[features_data["feature_type"] == "hardware"]
hardware_selected_columns = list(hardware_features["feature"].drop_duplicates())
......@@ -467,7 +468,8 @@ def prepare_long_form_data(jmh_data, features_data):
merged_table = pd.merge(jmh_with_best, features_data_wide, on="benchmark_id")
assert len(merged_table) == len(jmh_data)
# I think there should be one row for each iteration of each benchmark
assert len(merged_table) == len(features_data.get(["benchmark_id", "iteration"])
# Return data that should replace the original data.
return { "data" : merged_table,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment