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

Add Dune project #794

Merged
merged 26 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6df8f64
- Initial simple version of dune project
May 12, 2023
1cc2d34
Implemented binary_for_revision for dune project
May 14, 2023
9b758a5
Added workloads for dune examples
May 14, 2023
888250b
Fixed formatting
May 14, 2023
b249419
Added container support to Dune
May 14, 2023
f75c35a
Formatting
May 14, 2023
ddd81f9
Added missing import
May 14, 2023
ac210a6
Merge branch 'vara-dev' into f-DuneExamples
vulder Jun 27, 2023
c20a069
Merge branch 'vara-dev' into f-DuneExamples
Jul 13, 2023
ea37e8c
Merge branch 'vara-dev' into f-DuneExamples
Jul 21, 2023
81d8fea
Fixed imports in dune project
Aug 23, 2023
b9a0faa
Merge branch 'vara-dev' into f-DuneExamples
Aug 25, 2023
3d04757
Fixed workload/binary locations
Aug 30, 2023
7f0ab0b
Add flags to disable phasar
Sep 1, 2023
73d135e
Fixed cflags
Sep 5, 2023
6b122d8
Merge branch 'vara-dev' into f-DuneExamples
Sep 5, 2023
7cfc8f0
Slight change in parse revisions handling to handle open-ended includ…
Sep 5, 2023
059fb8c
* Add short comment about required disable-phasar flag
Sep 5, 2023
a62b68e
* Remove unused opts argument for recompile
Sep 5, 2023
a0e2b1f
Merge branch 'vara-dev' into f-DuneExamples
Oct 4, 2023
b7b4f1e
* Added new binary names for Dune
Oct 6, 2023
20b9607
* Removed c_flags and env from recompile in dune
Oct 6, 2023
c697317
* Removed explicit cflags from dune project and added Note for reference
Oct 6, 2023
ee889b2
Merge branch 'vara-dev' into f-DuneExamples
vulder Oct 6, 2023
52f9360
Apply suggestions from code review
vulder Oct 6, 2023
13b2c26
Apply suggestions from code review
vulder Oct 6, 2023
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
2 changes: 1 addition & 1 deletion varats-core/varats/report/gnu_time_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def summary(self) -> str:

class WLTimeReportAggregate(
WorkloadSpecificReportAggregate[TimeReport],
shorthand=TimeReport.SHORTHAND + ReportAggregate.SHORTHAND,
shorthand="WL" + TimeReport.SHORTHAND + ReportAggregate.SHORTHAND,
LuAbelt marked this conversation as resolved.
Show resolved Hide resolved
file_type=ReportAggregate.FILE_TYPE
):
"""Context Manager for parsing multiple time reports stored inside a zip
Expand Down
303 changes: 303 additions & 0 deletions varats/varats/projects/cpp_projects/dune.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
"""Project file for Dune."""
import typing as tp

import benchbuild as bb
from benchbuild.command import WorkloadSet, Command, SourceRoot
from benchbuild.utils import cmd
from benchbuild.utils.revision_ranges import RevisionRange
from plumbum import local

from varats.containers.containers import get_base_image, ImageBase
from varats.experiment.workload_util import RSBinary, WorkloadCategory
from varats.paper.paper_config import PaperConfigSpecificGit
from varats.project.project_domain import ProjectDomains
from varats.project.project_util import (
get_local_project_git_path,
BinaryType,
ProjectBinaryWrapper,
)
from varats.project.varats_project import VProject
from varats.utils.git_util import ShortCommitHash, RevisionBinaryMap


class DunePerfRegression(VProject):
"""
Simulation framework for various applications in mathematics and physics.

Note:
Currently Dune 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
vulder marked this conversation as resolved.
Show resolved Hide resolved
disable phasar passes.
This will still allow to analyse compile-time variability.
"""

NAME = 'DunePerfRegression'
GROUP = 'cpp_projects'
DOMAIN = ProjectDomains.CPP_LIBRARY

SOURCE = [
PaperConfigSpecificGit(
project_name='DunePerfRegression',
remote='[email protected]:se-sic/dune-VaRA.git',
local='dune-VaRA',
refspec='origin/HEAD',
limit=None,
shallow=False
)
]

CONTAINER = get_base_image(ImageBase.DEBIAN_10)

WORKLOADS = {
WorkloadSet(WorkloadCategory.EXAMPLE): [
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('dune-performance-regressions'),
label='dune-helloworld'
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson-test'),
label='poisson-non-separated',
creates=[
'poisson_UG_Pk_2d.vtu', 'poisson-yasp-Q1-2d.vtu',
'poisson-yasp-Q1-3d.vtu', 'poisson-yasp-Q2-2d.vtu',
'poisson-yasp-Q2-3d.vtu'
]
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson-ug-pk-2d'),
label='poisson-ug-pk-2d',
creates=['poisson-UG-Pk-2d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson-yasp-q1-2d'),
label='poisson-yasp-q1-2d',
creates=['poisson-yasp-q1-2d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson-yasp-q1-3d'),
label='poisson-yasp-q1-3d',
creates=['poisson-yasp-q1-3d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson-yasp-q2-2d'),
label='poisson-yasp-q2-2d',
creates=['poisson-yasp-q2-2d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson-yasp-q2-3d'),
label='poisson-yasp-q2-3d',
creates=['poisson-yasp-q2-3d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('dune_performance_regressions'),
label='dune_helloworld'
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson_test'),
label='poisson_non_separated',
creates=[
'poisson_UG_Pk_2d.vtu', 'poisson-yasp-Q1-2d.vtu',
'poisson-yasp-Q1-3d.vtu', 'poisson-yasp-Q2-2d.vtu',
'poisson-yasp-Q2-3d.vtu'
]
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson_ug_pk_2d'),
label='poisson_ug_pk_2d',
creates=['poisson-UG-Pk-2d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson_yasp_q1_2d'),
label='poisson_yasp_q1_2d',
creates=['poisson-yasp-q1-2d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson_yasp_q1_3d'),
label='poisson_yasp_q1_3d',
creates=['poisson-yasp-q1-3d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson_yasp_q2_2d'),
label='poisson_yasp_q2_2d',
creates=['poisson-yasp-q2-2d.vtu']
),
Command(
SourceRoot(
"dune-VaRA/dune-performance-regressions/build-cmake/src"
) / RSBinary('poisson_yasp_q2_3d'),
label='poisson_yasp_q2_3d',
creates=['poisson-yasp-q2-3d.vtu']
)
]
}

@staticmethod
def binaries_for_revision(
revision: ShortCommitHash
) -> tp.List['ProjectBinaryWrapper']:
binary_map = RevisionBinaryMap(
get_local_project_git_path(DunePerfRegression.NAME)
)

binary_map.specify_binary(
'dune-performance-regressions', BinaryType.EXECUTABLE
)

binary_map.specify_binary(
'poisson-test',
BinaryType.EXECUTABLE,
only_valid_in=RevisionRange(
'0d02b7b9acddfc57c3a0c905d6374fabbcaa0f58', 'main'
)
)

separated_poisson_range = RevisionRange(
'97fecde34910ba1f81c988ac2e1331aecddada06', 'main'
)

binary_map.specify_binary(
'poisson-alberta',
BinaryType.EXECUTABLE,
only_valid_in=separated_poisson_range
)

binary_map.specify_binary(
'poisson-ug-pk-2d',
BinaryType.EXECUTABLE,
only_valid_in=separated_poisson_range
)

binary_map.specify_binary(
'poisson-yasp-q1-2d',
BinaryType.EXECUTABLE,
only_valid_in=separated_poisson_range
)

binary_map.specify_binary(
'poisson-yasp-q2-3d',
BinaryType.EXECUTABLE,
only_valid_in=separated_poisson_range
)

binary_map.specify_binary(
'poisson-yasp-q2-2d',
BinaryType.EXECUTABLE,
only_valid_in=separated_poisson_range
)

binary_map.specify_binary(
'poisson-yasp-q1-3d',
BinaryType.EXECUTABLE,
only_valid_in=separated_poisson_range
)

new_binary_naming_range = RevisionRange(
'332a9af0b7e3336dd72c4f4b74e09df525b6db0d', 'main'
)

binary_map.specify_binary(
'dune_performance_regressions',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

binary_map.specify_binary(
'poisson_test',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

binary_map.specify_binary(
'poisson_alberta',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

binary_map.specify_binary(
'poisson_ug_pk_2d',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

binary_map.specify_binary(
'poisson_yasp_q1_2d',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

binary_map.specify_binary(
'poisson_yasp_q2_3d',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

binary_map.specify_binary(
'poisson_yasp_q2_2d',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

binary_map.specify_binary(
'poisson_yasp_q1_3d',
BinaryType.EXECUTABLE,
only_valid_in=new_binary_naming_range
)

return binary_map[revision]

def compile(self) -> None:
"""Compile the project using the in-built tooling from dune."""
version_source = local.path(self.source_of(self.primary_source))

c_compiler = bb.compiler.cc(self)
cxx_compiler = bb.compiler.cxx(self)

with local.cwd(version_source):
with local.env(CC=c_compiler, CXX=cxx_compiler):
dunecontrol = cmd['./dune-common/bin/dunecontrol']

bb.watch(dunecontrol
)('--module=dune-performance-regressions', 'all')

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

with local.cwd(version_source):
dunecontrol = cmd['./dune-common/bin/dunecontrol']

bb.watch(dunecontrol
)('--module=dune-performance-regressions', 'make')

def run_tests(self) -> None:
pass
3 changes: 2 additions & 1 deletion varats/varats/tools/bb_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def update_projects(
'varats.projects.cpp_projects.poppler',
'varats.projects.cpp_projects.z3',
'varats.projects.cpp_projects.ect',
'varats.projects.cpp_projects.lepton'
'varats.projects.cpp_projects.lepton',
'varats.projects.cpp_projects.dune'
]
projects_conf.value[:] += [
'varats.projects.cpp_projects.doxygen', 'varats.projects.cpp_projects'
Expand Down
Loading