Ejemplo n.º 1
0
    def actions_for_project(self, project):
        """Execute the actions for the test."""
        from benchbuild.settings import CFG

        project = PolyJIT.init_project(project)

        actions = []
        project.cflags = ["-mllvm", "-stats"]
        project.run_uuid = uuid.uuid4()
        jobs = int(CFG["jobs"].value())

        project.compiler_extension = partial(generate_sequences, project, self,
                                             CFG, jobs)

        actions.extend([
            MakeBuildDir(project),
            Prepare(project),
            Download(project),
            Configure(project),
            Build(project),
            Clean(project)
        ])
        return actions

        actions.extend([
            MakeBuildDir(project),
            Prepare(project),
            Download(project),
            Configure(project),
            Build(project),
            Clean(project)
        ])
        return actions
Ejemplo n.º 2
0
    def actions(self):
        actns = [Clean(self), MakeBuildDir(self)]

        for project in self.projects:
            p = self.projects[project](self)
            actns.append(RequireAll(self.actions_for_project(p)))

        actns.append(Clean(self, check_empty=True))
        actns.append(CleanExtra(self))
        return actns
Ejemplo n.º 3
0
    def actions(self):
        """
        Common setup required to run this experiment on all projects.
        """
        actions = []

        for project in self.projects:
            prj_cls = self.projects[project]

            prj_actions = []
            for version in self.sample(prj_cls, prj_cls.versions()):
                p = prj_cls(self, version=version)

                atomic_actions = [
                    Clean(p),
                    MakeBuildDir(p),
                    Echo(message="Selected {0} with version {1}".format(
                        p.name, p.version)),
                    Containerize(obj=p, actions=self.actions_for_project(p))
                ]
                prj_actions.append(RequireAll(actions=atomic_actions))
            actions.extend(prj_actions)

        actions.append(CleanExtra(self))
        return actions
Ejemplo n.º 4
0
    def actions_for_project(self, p):
        from benchbuild.settings import CFG

        p = PolyJIT.init_project(p)

        actns = []
        p.run_uuid = uuid.uuid4()
        jobs = int(CFG["jobs"].value())
        p.cflags += [
            "-Rpass-missed=polli*", "-mllvm", "-stats", "-mllvm",
            "-polly-num-threads={0}".format(jobs)
        ]
        p.runtime_extension = partial(time_polyjit_and_polly, p, self, CFG,
                                      jobs)

        actns.extend([
            MakeBuildDir(p),
            Prepare(p),
            Download(p),
            Configure(p),
            Build(p),
            Run(p),
            Clean(p)
        ])
        return actns
Ejemplo n.º 5
0
    def actions_for_project(self, p):
        from benchbuild.settings import CFG
        from benchbuild.utils.run import track_execution

        def _track_compilestats(project, experiment, config, clang, **kwargs):
            """Compile the project and track the compilestats."""
            from benchbuild.settings import CFG
            from benchbuild.utils.run import handle_stdin

            CFG.update(config)
            clang = handle_stdin(clang["-mllvm", "-polli-collect-modules"],
                                 kwargs)
            with track_execution(clang, project, experiment) as run:
                run()

        p = PolyJIT.init_project(p)
        p.cflags = ["-DLIKWID_PERFMON"] + p.cflags
        p.compiler_extension = partial(_track_compilestats, p, self, CFG)

        actns = [
            MakeBuildDir(p),
            Echo("{}: Configure...".format(self.name)),
            Prepare(p),
            Download(p),
            Configure(p),
            Echo("{}: Building...".format(self.name)),
            Build(p),
            Clean(p)
        ]
        return actns
Ejemplo n.º 6
0
    def actions_for_project(self, p):
        from benchbuild.settings import CFG

        p = PolyJIT.init_project(p)
        p.cflags = ["-DLIKWID_PERFMON"] + p.cflags

        actns = []
        for i in range(1, int(str(CFG["jobs"])) + 1):
            cp = copy.deepcopy(p)
            cp.run_uuid = uuid.uuid4()
            cp.runtime_extension = partial(run_with_likwid, cp, self, CFG, i)

            actns.append(
                RequireAll([
                    MakeBuildDir(cp),
                    Echo("likwid: {0} core configuration. Configure & Compile".
                         format(i)),
                    Prepare(cp),
                    Download(cp),
                    Configure(cp),
                    Build(cp),
                    Echo("likwid: {0} core configuration. Run".format(i)),
                    Run(cp),
                    Clean(cp)
                ]))
        return actns
Ejemplo n.º 7
0
    def actions_for_project(self, p):
        """Build & Run each project with Polly & OpenMP support."""
        from benchbuild.experiments.raw import run_with_time
        from functools import partial

        actns = []

        p.ldflags = ["-lgomp"]
        p.cflags = ["-O3", "-Xclang", "-load", "-Xclang", "LLVMPolly.so",
                    "-mllvm", "-polly", "-mllvm", "-polly-parallel"]

        for i in range(2, int(str(CFG["jobs"])) + 1):
            cp = copy.deepcopy(p)
            cp.run_uuid = uuid.uuid4()
            cp.runtime_extension = partial(run_with_time, cp, self, CFG, i)
            actns.extend([
                Echo("========= START: Polly (OpenMP) - Cores: {0}".format(i)),
                MakeBuildDir(cp),
                Prepare(cp),
                Download(cp),
                Configure(cp),
                Build(cp),
                Run(cp),
                Clean(cp),
                Echo("========= END: Polly (OpenMP) - Cores: {0}".format(i)),
            ])

        return actns
Ejemplo n.º 8
0
    def actions_for_project(self, p):
        from benchbuild.settings import CFG

        p = PolyJIT.init_project(p)

        actns = []
        for i in range(1, int(str(CFG["jobs"])) + 1):
            cp = copy.deepcopy(p)
            cp.run_uuid = uuid.uuid4()
            cp.runtime_extension = partial(run_with_perf, cp, self, CFG, i)

            actns.extend([
                MakeBuildDir(cp),
                Echo(
                    "perf: {0} core configuration. Configure & Compile".format(
                        i)),
                Prepare(cp),
                Download(cp),
                Configure(cp),
                Build(cp),
                Echo("perf: {0} core configuration. Run".format(i)),
                Run(cp),
                Clean(cp)
            ])
        return actns
Ejemplo n.º 9
0
    def actions_for_project(self, p):
        from benchbuild.settings import CFG

        p = PolyJIT.init_project(p)
        p.cflags = ["-mllvm", "-instrument"] + p.cflags
        p.ldflags = p.ldflags + ["-lbenchbuild"]

        actns = []
        for i in range(1, int(str(CFG["jobs"])) + 1):
            cp = copy.deepcopy(p)
            cp.compiler_extension = partial(collect_compilestats, cp, self,
                                            CFG)
            cp.runtime_extension = partial(run_with_papi, p, self, CFG, i)
            actns.extend([
                MakeBuildDir(cp),
                Echo("{}: Configure...".format(self.name)),
                Prepare(cp),
                Download(cp),
                Configure(cp),
                Echo("{}: Building...".format(self.name)),
                Build(cp),
                Clean(cp)
            ])

        return actns
Ejemplo n.º 10
0
    def actions_for_project(self, p):
        """
        Create & Run a papi-instrumented version of the project.

        This experiment uses the -jitable flag of libPolyJIT to generate
        dynamic SCoP coverage.
        """
        p.ldflags = p.ldflags + ["-lpjit", "-lpprof", "-lpapi"]
        p.cflags = [
            "-O3", "-Xclang", "-load", "-Xclang", "LLVMPolyJIT.so", "-mllvm",
            "-polli", "-mllvm", "-jitable", "-mllvm", "-instrument", "-mllvm",
            "-no-recompilation", "-mllvm", "-polly-detect-keep-going"
        ]
        p.compiler_extension = partial(collect_compilestats, p, self)
        p.runtime_extension = partial(run_with_time, p, self, CFG, 1)

        def evaluate_calibration(e):
            from benchbuild.utils.cmd import pprof_calibrate
            papi_calibration = e.get_papi_calibration(p, pprof_calibrate)
            e.persist_calibration(p, pprof_calibrate, papi_calibration)

        actns = [
            MakeBuildDir(p),
            Echo("{0}: Compiling... {1}".format(self.name, p.name)),
            Prepare(p),
            Download(p),
            Configure(p),
            Build(p),
            Echo("{0}: Running... {1}".format(self.name, p.name)),
            Run(p),
            Clean(p),
            Echo("{0}: Calibrating... {1}".format(self.name, p.name)),
            Step(p, action_fn=partial(evaluate_calibration, self))
        ]
        return actns
Ejemplo n.º 11
0
 def actions_for_project(self, project):
     """ Do nothing. """
     return [
         MakeBuildDir(project),
         Download(project),
         Configure(project),
         Clean(project)
     ]
Ejemplo n.º 12
0
 def default_compiletime_actions(project):
     """Return a series of actions for a compile time experiment."""
     return [
         MakeBuildDir(project),
         Prepare(project),
         Download(project),
         Configure(project),
         Build(project),
         Clean(project)
     ]
Ejemplo n.º 13
0
    def actions(self):
        actions = []

        for project in self.projects:
            p = self.projects[project](self)
            actions.append(Clean(p))
            actions.append(
                RequireAll(obj=p, actions=self.actions_for_project(p)))

        actions.append(CleanExtra(self))
        return actions
Ejemplo n.º 14
0
    def actions(self):
        actions = []

        for project in self.projects:
            p = self.projects[project](self)
            actions.append(Clean(p))
            actions.append(MakeBuildDir(p))
            project_actions = self.actions_for_project(p)
            actions.append(Containerize(obj=p, actions=project_actions))

        actions.append(CleanExtra(self))
        return actions
Ejemplo n.º 15
0
 def actions_for_project(self, project):
     from benchbuild.utils.actions import (
         Prepare, Download, Configure, Build, Run, Clean)
     inside = None
     actns = []
     project.builddir = "/tmp/throwaway"
     actns = [Prepare(project),
              Download(project),
              Configure(project),
              Build(project),
              Run(project),
              Clean(project)]
     return actns
Ejemplo n.º 16
0
    def actions_for_project(self, p):
        from benchbuild.settings import CFG

        p.compiler_extension = partial(collect_compilestats, p, self, CFG)

        actns = [
            MakeBuildDir(p),
            Echo("{}: Configure...".format(self.name)),
            Prepare(p),
            Download(p),
            Configure(p),
            Echo("{}: Building...".format(self.name)),
            Build(p),
            Clean(p)
        ]
        return actns
Ejemplo n.º 17
0
 def actions_for_project(self, project):
     """Compile & Run the experiment with -O3 enabled."""
     project.cflags = ["-O3", "-fno-omit-frame-pointer"]
     project.runtime_extension = \
         partial(run_with_time, project, self, CFG, CFG["jobs"].value())
     actns = [
         MakeBuildDir(project),
         Echo("Compiling... {}".format(project.name)),
         Prepare(project),
         Download(project),
         Configure(project),
         Build(project),
         Echo("Running... {}".format(project.name)),
         Run(project),
         Clean(project),
     ]
     return actns
Ejemplo n.º 18
0
    def actions_for_project(self, project):
        configs = CFG["perf"]["config"].value()
        if configs is None:
            warnings.warn("({0}) should not be null.".format(
                repr(CFG["perf"]["config"])),
                          category=ShouldNotBeNone,
                          stacklevel=2)
            return

        config_list = re.split(r'\s*', configs)

        config_with_llvm = []
        for config in config_list:
            config_with_llvm.append("-mllvm")
            config_with_llvm.append(config)

        project.cflags = [
            "-O3", "-fno-omit-frame-pointer", "-Xclang", "-load", "-Xclang",
            "LLVMPolyJIT.so", "-mllvm", "-polly"
        ] + config_with_llvm

        actns = []
        jobs = CFG["jobs"].value()
        for i in range(1, int(jobs)):
            cp = copy.deepcopy(project)
            cp.run_uuid = uuid.uuid4()

            cp.cflags += ["-mllvm", "-polly-num-threads={0}".format(i)]
            cp.runtime_extension = functools.partial(run_with_time, cp, self,
                                                     CFG, i)

            actns.extend([
                MakeBuildDir(cp),
                Echo("{0} core configuration. Configure & Compile".format(i)),
                Prepare(cp),
                Download(cp),
                Configure(cp),
                Build(cp),
                Echo("{0} core configuration. Run".format(i)),
                Run(cp),
                Clean(cp)
            ])
        return actns
Ejemplo n.º 19
0
 def actions_for_project(self, project):
     """Compile & Run the experiment with -O3 enabled."""
     project.cflags = [
         "-O3", "-fno-omit-frame-pointer", "-Xclang", "-load", "-Xclang",
         "LLVMPolyJIT.so", "-mllvm", "-polly", "-mllvm",
         "-polly-vectorizer=stripmine"
     ]
     project.runtime_extension = functools.partial(run_with_time, project,
                                                   self, CFG,
                                                   CFG["jobs"].value())
     actns = [
         MakeBuildDir(project),
         Echo("Compiling... {}".format(project.name)),
         Prepare(project),
         Download(project),
         Configure(project),
         Build(project),
         Echo("Running... {}".format(project.name)),
         Run(project),
         Clean(project),
     ]
     return actns
Ejemplo n.º 20
0
 def actions_for_project(self, project):
     """ Do nothing. """
     return [MakeBuildDir(project), Compile(project), Clean(project)]
Ejemplo n.º 21
0
 def default_compiletime_actions(project):
     """Return a series of actions for a compile time experiment."""
     return [Compile(project), Clean(project)]
Ejemplo n.º 22
0
    def actions_for_project(self, p):
        from benchbuild.settings import CFG

        p.cflags = ["-O3", "-fno-omit-frame-pointer"]

        actns = []
        rawp = copy.deepcopy(p)
        rawp.run_uuid = uuid.uuid4()
        rawp.runtime_extension = partial(run_with_time, rawp, self, CFG, 1)

        actns.append(
            RequireAll([
                Echo("========= START: RAW Baseline"),
                MakeBuildDir(rawp),
                Prepare(rawp),
                Download(rawp),
                Configure(rawp),
                Build(rawp),
                Run(rawp),
                Clean(rawp),
                Echo("========= END: RAW Baseline")
            ]))

        jitp = copy.deepcopy(p)
        jitp = PolyJIT.init_project(jitp)
        norecomp = copy.deepcopy(jitp)
        norecomp.cflags += ["-mllvm", "-no-recompilation"]

        for i in range(2, int(str(CFG["jobs"])) + 1):
            cp = copy.deepcopy(norecomp)
            cp.run_uuid = uuid.uuid4()
            cp.runtime_extension = partial(run_without_recompile, cp, self,
                                           CFG, i)

            actns.append(
                RequireAll([
                    Echo("========= START: JIT No Recomp - Cores: {0}".format(
                        i)),
                    MakeBuildDir(cp),
                    Prepare(cp),
                    Download(cp),
                    Configure(cp),
                    Build(cp),
                    Run(cp),
                    Clean(cp),
                    Echo("========= END: JIT No Recomp - Cores: {0}".format(i))
                ]))

        for i in range(2, int(str(CFG["jobs"])) + 1):
            cp = copy.deepcopy(jitp)
            cp.run_uuid = uuid.uuid4()
            cp.runtime_extension = partial(run_with_time, cp, self, CFG, i)

            actns.append(
                RequireAll([
                    Echo("========= START: JIT - Cores: {0}".format(i)),
                    MakeBuildDir(cp),
                    Prepare(cp),
                    Download(cp),
                    Configure(cp),
                    Build(cp),
                    Run(cp),
                    Clean(cp),
                    Echo("========= END: JIT - Cores: {0}".format(i))
                ]))
        return [Any(actns)]