Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runs but confusing result #868

Draft
wants to merge 10 commits into
base: vara-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,19 @@ def __str__(self) -> str:

return stringify

def _translate_region_id(self, region_id) -> str:
"""Translates the given region_id to a feature name."""
if region_id not in self.__region_name_map:
# TODO: Identify why this happens
return "Unknown"

return self.__region_name_map[region_id]

def _translate_interaction(self, interaction: str) -> str:
sub_terms = interaction.split('*')
return "*".join(
map(
lambda region_id: self.__region_name_map[int(region_id)],
lambda region_id: self._translate_region_id(int(region_id)),
sub_terms
)
)
Expand Down
72 changes: 72 additions & 0 deletions varats/varats/experiments/vara/test_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""Module for feature performance experiments that instrument and measure the
execution performance of each binary that is produced by a project."""
import typing as tp

from benchbuild.extensions import compiler, run, time
from benchbuild.utils import actions

from varats.experiment.experiment_util import (
get_default_compile_error_wrapped,
WithUnlimitedStackSize,
)
from varats.experiments.vara.feature_experiment import (
FeatureExperiment,
RunVaRATracedWorkloads,
RunVaRATracedXRayWorkloads,
FeatureInstrType,
)
from varats.project.varats_project import VProject
from varats.report.report import ReportSpecification
from varats.data.reports.performance_influence_trace_report import PerfInfluenceTraceReport


class TestRunner(FeatureExperiment, shorthand="TES"):
"""Test runner for feature performance."""

NAME = "Test"

REPORT_SPEC = ReportSpecification(PerfInfluenceTraceReport)

def actions_for_project(
self, project: VProject
) -> tp.MutableSequence[actions.Step]:
"""
Returns the specified steps to run the project(s) specified in the call
in a fixed order.

Args:
project: to analyze
"""
instr_type = FeatureInstrType.PERF_INFLUENCE_TRACE

project.cflags += self.get_vara_feature_cflags(project)

project.cflags += self.get_vara_tracing_cflags(
instr_type, project=project, instruction_threshold=0
)

project.ldflags += self.get_vara_tracing_ldflags()

# Add the required runtime extensions to the project(s).
project.runtime_extension = run.RuntimeExtension(project, self) \
<< time.RunWithTime()

# Add the required compiler extensions to the project(s).
project.compiler_extension = compiler.RunCompiler(project, self) \
<< WithUnlimitedStackSize()

# Add own error handler to compile step.
project.compile = get_default_compile_error_wrapped(
self.get_handle(), project, PerfInfluenceTraceReport
)

analysis_actions = []

analysis_actions.append(actions.Compile(project))
analysis_actions.append(
RunVaRATracedWorkloads(project, self.get_handle())
)
analysis_actions.append(actions.Clean(project))

return analysis_actions

235 changes: 233 additions & 2 deletions varats/varats/projects/c_projects/bzip2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import benchbuild as bb
from benchbuild.command import SourceRoot, WorkloadSet
from benchbuild.source import HTTPMultiple
from benchbuild.source import HTTPMultiple, HTTPUntar
from benchbuild.utils.cmd import cmake, make
from benchbuild.utils.revision_ranges import RevisionRange, GoodBadSubgraph
from benchbuild.utils.settings import get_number_of_jobs
Expand Down Expand Up @@ -72,6 +72,13 @@ class Bzip2(VProject):
"countries-land-10m.geo.json.bz2",
"countries-land-1m.geo.json.bz2"
]
),
HTTPUntar(
local="cantrbry.tar.gz",
remote={
"1.0":
"http://corpus.canterbury.ac.nz/resources/cantrbry.tar.gz"
}
)
]
_AUTOTOOLS_VERSIONS = GoodBadSubgraph([
Expand All @@ -94,7 +101,231 @@ class Bzip2(VProject):
), (_MAKE_VERSIONS, get_base_image(ImageBase.DEBIAN_10))
]

files = ["alice29.txt", "asyoulik.txt", "cp.html", "fields.c", "grammar.lsp",
"kennedy.xls", "lcet10.txt", "plrabn12.txt", "ptt5", "sum", "xargs.1"]

configs = [
['-5'],
['-v', '-v', '-5'],
['-v', '-v', '-3'],
['-v', '-1'],
['-9'],
['-v', '-v', '-v', '-v', '-3'],
['-v', '-3'],
['-v', '-9'],
['-v', '-7'],
['-v', '-v', '-v', '-3'],
['-v', '-v', '-v', '-9'],
['-v', '-5'],
['-v', '-v', '-1'],
['-v', '-v', '-9'],
['-v', '-v', '-v', '-v', '-9'],
['-v', '-v', '-v', '-v', '-7'],
['-v', '-v', '-v', '-v', '-1'],
['-1'],
['-v', '-v', '-v', '-v', '-5'],
['-7'],
['-v', '-v', '-v', '-5'],
['-v', '-v', '-7'],
['-v', '-v', '-v', '-7'],
['-v', '-v', '-v', '-1'],
['-3'],
['--force', '-5'],
['--force', '-v', '-v', '-5'],
['--force', '-v', '-v', '-3'],
['--force', '-v', '-1'],
['--force', '-9'],
['--force', '-v', '-v', '-v', '-v', '-3'],
['--force', '-v', '-3'],
['--force', '-v', '-9'],
['--force', '-v', '-7'],
['--force', '-v', '-v', '-v', '-3'],
['--force', '-v', '-v', '-v', '-9'],
['--force', '-v', '-5'],
['--force', '-v', '-v', '-1'],
['--force', '-v', '-v', '-9'],
['--force', '-v', '-v', '-v', '-v', '-9'],
['--force', '-v', '-v', '-v', '-v', '-7'],
['--force', '-v', '-v', '-v', '-v', '-1'],
['--force', '-1'],
['--force', '-v', '-v', '-v', '-v', '-5'],
['--force', '-7'],
['--force', '-v', '-v', '-v', '-5'],
['--force', '-v', '-v', '-7'],
['--force', '-v', '-v', '-v', '-7'],
['--force', '-v', '-v', '-v', '-1'],
['--force', '-3'],
['--quiet', '-5'],
['--quiet', '-v', '-v', '-5'],
['--quiet', '-v', '-v', '-3'],
['--quiet', '-v', '-1'],
['--quiet', '-9'],
['--quiet', '-v', '-v', '-v', '-v', '-3'],
['--quiet', '-v', '-3'],
['--quiet', '-v', '-9'],
['--quiet', '-v', '-7'],
['--quiet', '-v', '-v', '-v', '-3'],
['--quiet', '-v', '-v', '-v', '-9'],
['--quiet', '-v', '-5'],
['--quiet', '-v', '-v', '-1'],
['--quiet', '-v', '-v', '-9'],
['--quiet', '-v', '-v', '-v', '-v', '-9'],
['--quiet', '-v', '-v', '-v', '-v', '-7'],
['--quiet', '-v', '-v', '-v', '-v', '-1'],
['--quiet', '-1'],
['--quiet', '-v', '-v', '-v', '-v', '-5'],
['--quiet', '-7'],
['--quiet', '-v', '-v', '-v', '-5'],
['--quiet', '-v', '-v', '-7'],
['--quiet', '-v', '-v', '-v', '-7'],
['--quiet', '-v', '-v', '-v', '-1'],
['--quiet', '-3'],
['--small', '-5'],
['--small', '-v', '-v', '-5'],
['--small', '-v', '-v', '-3'],
['--small', '-v', '-1'],
['--small', '-9'],
['--small', '-v', '-v', '-v', '-v', '-3'],
['--small', '-v', '-3'],
['--small', '-v', '-9'],
['--small', '-v', '-7'],
['--small', '-v', '-v', '-v', '-3'],
['--small', '-v', '-v', '-v', '-9'],
['--small', '-v', '-5'],
['--small', '-v', '-v', '-1'],
['--small', '-v', '-v', '-9'],
['--small', '-v', '-v', '-v', '-v', '-9'],
['--small', '-v', '-v', '-v', '-v', '-7'],
['--small', '-v', '-v', '-v', '-v', '-1'],
['--small', '-1'],
['--small', '-v', '-v', '-v', '-v', '-5'],
['--small', '-7'],
['--small', '-v', '-v', '-v', '-5'],
['--small', '-v', '-v', '-7'],
['--small', '-v', '-v', '-v', '-7'],
['--small', '-v', '-v', '-v', '-1'],
['--small', '-3'],
['--force', '--quiet', '-5'],
['--force', '--quiet', '-v', '-v', '-5'],
['--force', '--quiet', '-v', '-v', '-3'],
['--force', '--quiet', '-v', '-1'],
['--force', '--quiet', '-9'],
['--force', '--quiet', '-v', '-v', '-v', '-v', '-3'],
['--force', '--quiet', '-v', '-3'],
['--force', '--quiet', '-v', '-9'],
['--force', '--quiet', '-v', '-7'],
['--force', '--quiet', '-v', '-v', '-v', '-3'],
['--force', '--quiet', '-v', '-v', '-v', '-9'],
['--force', '--quiet', '-v', '-5'],
['--force', '--quiet', '-v', '-v', '-1'],
['--force', '--quiet', '-v', '-v', '-9'],
['--force', '--quiet', '-v', '-v', '-v', '-v', '-9'],
['--force', '--quiet', '-v', '-v', '-v', '-v', '-7'],
['--force', '--quiet', '-v', '-v', '-v', '-v', '-1'],
['--force', '--quiet', '-1'],
['--force', '--quiet', '-v', '-v', '-v', '-v', '-5'],
['--force', '--quiet', '-7'],
['--force', '--quiet', '-v', '-v', '-v', '-5'],
['--force', '--quiet', '-v', '-v', '-7'],
['--force', '--quiet', '-v', '-v', '-v', '-7'],
['--force', '--quiet', '-v', '-v', '-v', '-1'],
['--force', '--quiet', '-3'],
['--force', '--small', '-5'],
['--force', '--small', '-v', '-v', '-5'],
['--force', '--small', '-v', '-v', '-3'],
['--force', '--small', '-v', '-1'],
['--force', '--small', '-9'],
['--force', '--small', '-v', '-v', '-v', '-v', '-3'],
['--force', '--small', '-v', '-3'],
['--force', '--small', '-v', '-9'],
['--force', '--small', '-v', '-7'],
['--force', '--small', '-v', '-v', '-v', '-3'],
['--force', '--small', '-v', '-v', '-v', '-9'],
['--force', '--small', '-v', '-5'],
['--force', '--small', '-v', '-v', '-1'],
['--force', '--small', '-v', '-v', '-9'],
['--force', '--small', '-v', '-v', '-v', '-v', '-9'],
['--force', '--small', '-v', '-v', '-v', '-v', '-7'],
['--force', '--small', '-v', '-v', '-v', '-v', '-1'],
['--force', '--small', '-1'],
['--force', '--small', '-v', '-v', '-v', '-v', '-5'],
['--force', '--small', '-7'],
['--force', '--small', '-v', '-v', '-v', '-5'],
['--force', '--small', '-v', '-v', '-7'],
['--force', '--small', '-v', '-v', '-v', '-7'],
['--force', '--small', '-v', '-v', '-v', '-1'],
['--force', '--small', '-3'],
['--quiet', '--small', '-5'],
['--quiet', '--small', '-v', '-v', '-5'],
['--quiet', '--small', '-v', '-v', '-3'],
['--quiet', '--small', '-v', '-1'],
['--quiet', '--small', '-9'],
['--quiet', '--small', '-v', '-v', '-v', '-v', '-3'],
['--quiet', '--small', '-v', '-3'],
['--quiet', '--small', '-v', '-9'],
['--quiet', '--small', '-v', '-7'],
['--quiet', '--small', '-v', '-v', '-v', '-3'],
['--quiet', '--small', '-v', '-v', '-v', '-9'],
['--quiet', '--small', '-v', '-5'],
['--quiet', '--small', '-v', '-v', '-1'],
['--quiet', '--small', '-v', '-v', '-9'],
['--quiet', '--small', '-v', '-v', '-v', '-v', '-9'],
['--quiet', '--small', '-v', '-v', '-v', '-v', '-7'],
['--quiet', '--small', '-v', '-v', '-v', '-v', '-1'],
['--quiet', '--small', '-1'],
['--quiet', '--small', '-v', '-v', '-v', '-v', '-5'],
['--quiet', '--small', '-7'],
['--quiet', '--small', '-v', '-v', '-v', '-5'],
['--quiet', '--small', '-v', '-v', '-7'],
['--quiet', '--small', '-v', '-v', '-v', '-7'],
['--quiet', '--small', '-v', '-v', '-v', '-1'],
['--quiet', '--small', '-3'],
['--force', '--quiet', '--small', '-5'],
['--force', '--quiet', '--small', '-v', '-v', '-5'],
['--force', '--quiet', '--small', '-v', '-v', '-3'],
['--force', '--quiet', '--small', '-v', '-1'],
['--force', '--quiet', '--small', '-9'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-v', '-3'],
['--force', '--quiet', '--small', '-v', '-3'],
['--force', '--quiet', '--small', '-v', '-9'],
['--force', '--quiet', '--small', '-v', '-7'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-3'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-9'],
['--force', '--quiet', '--small', '-v', '-5'],
['--force', '--quiet', '--small', '-v', '-v', '-1'],
['--force', '--quiet', '--small', '-v', '-v', '-9'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-v', '-9'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-v', '-7'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-v', '-1'],
['--force', '--quiet', '--small', '-1'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-v', '-5'],
['--force', '--quiet', '--small', '-7'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-5'],
['--force', '--quiet', '--small', '-v', '-v', '-7'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-7'],
['--force', '--quiet', '--small', '-v', '-v', '-v', '-1'],
['--force', '--quiet', '--small', '-3'],
]

commands = []


for file in files:
for i, config in enumerate(configs):
command = VCommand(
SourceRoot("bzip2") / RSBinary("bzip2"),
*config,
"--keep", # needed for repeating with the same workload
"cantrbry.tar.gz/" + file,
label=file + "-config" + "{:04d}".format(i),
creates=["cantrbry.tar.gz/" + file + ".bz2"]
)


commands.append(command)

WORKLOADS = {
WorkloadSet(WorkloadCategory.EXAMPLE): commands,
WorkloadSet(WorkloadCategory.MEDIUM): [
VCommand(
SourceRoot("bzip2") / RSBinary("bzip2"),
Expand Down Expand Up @@ -211,4 +442,4 @@ def recompile(self) -> None:
bb.watch(cmake)(
"--build", ".", "--config", "Release", "-j",
get_number_of_jobs(bb_cfg())
)
)
Loading