Skip to content

Commit

Permalink
Merge branch 'vara-dev' into f-FeatureCaseStudies
Browse files Browse the repository at this point in the history
  • Loading branch information
vulder authored Nov 27, 2023
2 parents 89ae7ee + 8eed404 commit e03d6ed
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Patch with a regression severity
path: bug.patch
project_name: FeaturePerfCSCollection
shortname: regression-severity
regression_severity: 1000
39 changes: 31 additions & 8 deletions tests/provider/test_patch_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
FeaturePerfCSCollection,
)
from varats.provider.patch.patch_provider import PatchProvider, Patch, PatchSet
from varats.utils.git_util import ShortCommitHash
from varats.utils.git_util import (
ShortCommitHash,
get_all_revisions_between,
get_initial_commit,
)


class TestPatchProvider(unittest.TestCase):
Expand All @@ -35,6 +39,25 @@ def test_get_patch_by_shortname(self):
patch = provider.get_by_shortname("dummy-patch")
self.assertIsNone(patch)

def test_parse_regression_severity(self):
regression_patch = Patch.from_yaml(
Path(
TEST_INPUTS_DIR /
'patch_configs/FeaturePerfCSCollection/regression-severity.info'
)
)

other_patch = Patch.from_yaml(
Path(
TEST_INPUTS_DIR /
'patch_configs/FeaturePerfCSCollection/unrestricted-range.info'
)
)

self.assertIsNotNone(regression_patch.regression_severity)
self.assertEqual(1000, regression_patch.regression_severity)
self.assertIsNone(other_patch.regression_severity)


class TestPatchRevisionRanges(unittest.TestCase):

Expand All @@ -53,14 +76,14 @@ def setUpClass(cls) -> None:

project_git_source.fetch()

repo_git = _get_git_for_path(
target_prefix() + "/FeaturePerfCSCollection"
)
repo_git_path = Path(target_prefix() + "/FeaturePerfCSCollection")

cls.all_revisions = {
ShortCommitHash(h) for h in
repo_git('log', '--pretty=%H', '--first-parent').strip().split()
}
cls.all_revisions = set(
get_all_revisions_between(
get_initial_commit(repo_git_path).hash, "", ShortCommitHash,
repo_git_path
)
)

def __test_patch_revisions(
self, shortname: str, expected_revisions: set[ShortCommitHash]
Expand Down
23 changes: 21 additions & 2 deletions varats-core/varats/provider/patch/patch_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,20 @@ def __init__(
path: Path,
valid_revisions: tp.Optional[tp.Set[CommitHash]] = None,
tags: tp.Optional[tp.Set[str]] = None,
feature_tags: tp.Optional[tp.Set[str]] = None
feature_tags: tp.Optional[tp.Set[str]] = None,
regression_severity: tp.Optional[int] = None
):
"""
Args:
project_name: Project name that this patch belongs to
shortname: Short name to uniquely identify a patch
description: Textual description of the patch
path: Path to the patch file
valid_revisions: List of revisions that the patch is applicable to
tags: Tags of the patch
feature_tags: Feature specific tags of a patch (Used for PatchConfiguration)
regression_severity: Regression severity in milliseconds (If applicable)
"""
self.project_name: str = project_name
self.shortname: str = shortname
self.description: str = description
Expand All @@ -49,6 +61,7 @@ def __init__(
CommitHash] = valid_revisions if valid_revisions else set()
self.tags: tp.Optional[tp.Set[str]] = tags
self.feature_tags: tp.Optional[tp.Set[str]] = feature_tags
self.regression_severity: tp.Optional[int] = regression_severity

@staticmethod
def from_yaml(yaml_path: Path) -> 'Patch':
Expand Down Expand Up @@ -119,9 +132,15 @@ def parse_revisions(
parse_revisions(yaml_dict["exclude_revisions"])
)

regression_severity: tp.Optional[int]
if "regression_severity" in yaml_dict:
regression_severity = yaml_dict["regression_severity"]
else:
regression_severity = None

return Patch(
project_name, shortname, description, path, include_revisions, tags,
feature_tags
feature_tags, regression_severity
)

def __repr__(self) -> str:
Expand Down
6 changes: 5 additions & 1 deletion varats-core/varats/utils/git_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ def init_all_submodules(folder: Path) -> None:
git("-C", folder.absolute(), "submodule", "init")


def update_all_submodules(folder: Path, recursive: bool = True) -> None:
def update_all_submodules(
folder: Path, recursive: bool = True, init: bool = False
) -> None:
"""Updates all submodules."""
git_params = ["submodule", "update"]
if recursive:
git_params.append("--recursive")
if init:
git_params.append("--init")
git("-C", folder, git_params)


Expand Down
59 changes: 46 additions & 13 deletions varats/varats/projects/cpp_projects/hyteg.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Adds the HyTeg framework as a project to VaRA-TS."""
import logging
import os
import typing as tp

import benchbuild as bb
from benchbuild.command import WorkloadSet, SourceRoot
from benchbuild.utils.cmd import make, cmake, mkdir
from benchbuild.utils.cmd import ninja, cmake, mkdir
from benchbuild.utils.revision_ranges import SingleRevision
from benchbuild.utils.settings import get_number_of_jobs
from plumbum import local
Expand All @@ -22,21 +24,42 @@
from varats.utils.git_util import ShortCommitHash, RevisionBinaryMap
from varats.utils.settings import bb_cfg

LOG = logging.getLogger(__name__)


class HyTeg(VProject):
"""
C++ framework for large scale high performance finite element simulations
based on (but not limited to) matrix-free geometric multigrid.
Note:
Currently HyTeg CANNOT be compiled with the Phasar passes activated
in vara.
Trying to do so will crash the compiler
Notes:
1.
Currently, HyTeg CANNOT be compiled with the Phasar passes activated
in vara. Trying to do so will crash the compiler
If you use Dune with an experiment that uses the vara compiler,
add `-mllvm --vara-disable-phasar` to the projects `cflags` to
disable phasar passes.
This will still allow to analyse compile-time variability.
2.
Due to the way that benchbuild generates the build folder names when
running experiments in different configurations, HyTeg currently DOES
NOT work out of the box when creating a case study with multiple
configurations. This is due to benchbuild creating a temporary folder
name with a comma in it to separate the revision and configuration
id.
This comma will be misinterpreted when the path for the eigen library
is passed onto the linker.
There is a limited workaround for this:
1. Copy the eigen library revision that you want HyTeg to use to some
other accessible location (That has no comma in its absolute path)
2. Set the environment variable EIGEN_PATH to point to the absolute
path of that directory
- This can be achieved by either EXPORT-ing it manually, adding it
to your .benchbuild.yml configuration or (when running with slurm)
adding the export to your slurm scripts
"""
NAME = 'HyTeg'
GROUP = 'cpp_projects'
Expand Down Expand Up @@ -89,22 +112,32 @@ def compile(self) -> None:
cc_compiler = bb.compiler.cc(self)
cxx_compiler = bb.compiler.cxx(self)

cmake_args = [
"-G", "Ninja", "..", "-DWALBERLA_BUILD_WITH_MPI=OFF",
"-DHYTEG_BUILD_DOC=OFF"
]

if (eigen_path := os.getenv("EIGEN_PATH")):
cmake_args.append(f"-DEIGEN_DIR={eigen_path}")
else:
LOG.warning(
"EIGEN_PATH environment variable not set! This will cause"
" compilation errors when using configurations"
)

with local.cwd(hyteg_source / "build"):
with local.env(CC=str(cc_compiler), CXX=str(cxx_compiler)):
bb.watch(cmake)(
"..", "-DWALBERLA_BUILD_WITH_MPI=OFF",
"-DHYTEG_BUILD_DOC=OFF"
)
bb.watch(cmake)(*cmake_args)

with local.cwd(hyteg_source / "build" / "apps" / "profiling"):
bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
with local.cwd(hyteg_source / "build"):
bb.watch(ninja)("ProfilingApp")

def recompile(self) -> None:
"""Recompiles HyTeg e.g. after a patch has been applied."""
hyteg_source = local.path(self.source_of(self.primary_source))

with local.cwd(hyteg_source / "build" / "apps" / "profiling"):
bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
with local.cwd(hyteg_source / "build"):
bb.watch(ninja)("ProfilingApp")

def run_tests(self) -> None:
pass

0 comments on commit e03d6ed

Please sign in to comment.