Пример #1
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
Пример #2
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
Пример #3
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
Пример #4
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
Пример #5
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
Пример #6
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
Пример #7
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
Пример #8
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
Пример #9
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
Пример #10
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
Пример #11
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
Пример #12
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)]