コード例 #1
0
ファイル: benchmark.py プロジェクト: zhangfengthu/CoRunBench
    def debug(self, benchmark, dataset, do_output=True, extra_opts=[], platform=None):
        """Debug this benchmark implementation."""

        if platform == None:
            self.platform = 'default'
        else:
            self.platform = platform

        # Ensure that the benchmark has been built
        if not self.isBuilt(benchmark, platform):
            rc = self.build(benchmark, platform)

            # Stop if 'make' failed
            if rc != ErrorType.Success: return rc

        def perform():
            if self.platform == None:
                platform = 'default'
            else:
                platform = self.platform

            # Run the program
            args = extra_opts + dataset.getCommandLineArguments(benchmark, do_output)
            args = reduce(lambda x, y: x + ' ' + y, args)

            ###
            rc = self.makefile(benchmark, action='debug', platform=platform, opt={"ARGS":args})

            # Program exited with error?
            if rc != 0: return ErrorType.RunFailed
            return ErrorType.Success

        return process.with_path(benchmark.path, perform)
コード例 #2
0
    def run(self, benchmark, dataset, do_output=True, extra_opts=[]):
        """Run this benchmark implementation.

        Return True if the benchmark terminated normally or False
        if there was an error."""

        # Ensure that the benchmark has been built
        if not self.isBuilt(benchmark):
            rc = self.build(benchmark)

            # Stop if 'make' failed
            if not rc:
                return False

        def perform():
            # Run the program
            exename = path.join("build", self.name, benchmark.name)
            args = [exename] + extra_opts + dataset.getCommandLineArguments(do_output)
            rc = process.spawnwaitv(exename, args)

            # Program exited with error?
            if rc != 0:
                return False
            return True

        return process.with_path(benchmark.path, perform)
コード例 #3
0
ファイル: benchmark.py プロジェクト: zhangfengthu/CoRunBench
    def check(self, benchmark, dataset):
        """Check the output from the last run of this benchmark
        implementation.

        Return True if the output checks successfully or False
        otherwise."""

        def perform():
            output_file = dataset.getTemporaryOutputFile(benchmark).getPath()
            reference_file = dataset.getReferenceOutputPath()
            #zhangfeng zf
            print benchmark.path
            print output_file
            print reference_file

            compare = os.path.join('tools', 'compare-output')
            print compare 

            rc = process.spawnwaitl(compare,
                                    compare, reference_file, output_file)

            # Program exited with error, or mismatch in output?
            if rc != 0: return False
            return True


        return process.with_path(benchmark.path, perform)
コード例 #4
0
ファイル: benchmark.py プロジェクト: zhangfengthu/CoRunBench
    def makefile(self, benchmark, target=None, action=None, platform=None, opt={}):
        """Run this implementation's makefile."""
        
        self.platform = platform
        Benchmark.instance_check(benchmark)

        def perform():
            srcdir = path.join('src', self.name)
            builddir = path.join('build', self.name)

            if self.platform == None: platform = 'default'
            else: platform = self.platform

            env={'SRCDIR':srcdir,
                 'BUILDDIR':builddir + '_' + platform,
                 'BIN':path.join(builddir+'_'+platform,benchmark.name),
                 'PARBOIL_ROOT':globals.root,
                 'PLATFORM':platform,
                 'BUILD':self.name}
            env.update(opt)

            mkfile = globals.root + os.sep + 'common' + os.sep + 'mk'

            # Run the makefile to build the benchmark
            ret = process.makefile(target=target,
				    action=action,
                                    filepath=path.join(mkfile, "Makefile"),
                                    env=env)
            if ret == True:
              return ErrorType.Success
            else:
              return ErrorType.CompileError

        # Go to the benchmark directory before building
        return process.with_path(benchmark.path, perform)
コード例 #5
0
    def debug(self, benchmark, dataset, do_output=True, extra_opts=[], platform=None):
        """Debug this benchmark implementation."""

        if platform == None:
            self.platform = 'default'
        else:
            self.platform = platform

        # Ensure that the benchmark has been built
        if not self.isBuilt(benchmark, platform):
            rc = self.build(benchmark, platform)

            # Stop if 'make' failed
            if rc != ErrorType.Success: return rc

        def perform():
            if self.platform == None:
                platform = 'default'
            else:
                platform = self.platform

            # Run the program
            args = extra_opts + dataset.getCommandLineArguments(benchmark, do_output)
            args = reduce(lambda x, y: x + ' ' + y, args)

            ###
            rc = self.makefile(benchmark, action='debug', platform=platform, opt={"ARGS":args})

            # Program exited with error?
            if rc != 0: return ErrorType.RunFailed
            return ErrorType.Success

        return process.with_path(benchmark.path, perform)
コード例 #6
0
    def makefile(self, benchmark, target=None, action=None, platform=None, opt={}):
        """Run this implementation's makefile."""
        
        self.platform = platform
        Benchmark.instance_check(benchmark)

        def perform():
            srcdir = path.join('src', self.name)
            builddir = path.join('build', self.name)

            if self.platform == None: platform = 'default'
            else: platform = self.platform

            env={'SRCDIR':srcdir,
                 'BUILDDIR':builddir + '_' + platform,
                 'BIN':path.join(builddir+'_'+platform,benchmark.name),
                 'PARBOIL_ROOT':globals.root,
                 'PLATFORM':platform,
                 'BUILD':self.name}
            env.update(opt)

            mkfile = globals.root + os.sep + 'common' + os.sep + 'mk'

            # Run the makefile to build the benchmark
            ret = process.makefile(target=target,
				    action=action,
                                    filepath=path.join(mkfile, "Makefile"),
                                    env=env)
            if ret == True:
              return ErrorType.Success
            else:
              return ErrorType.CompileError

        # Go to the benchmark directory before building
        return process.with_path(benchmark.path, perform)
コード例 #7
0
    def check(self, benchmark, dataset):
        """Check the output from the last run of this benchmark
        implementation.

        Return True if the output checks successfully or False
        otherwise."""
        def perform():
            output_file = dataset.getTemporaryOutputFile(benchmark).getPath()
            reference_file = dataset.getReferenceOutputPath()
            #zhangfeng zf
            print benchmark.path
            print output_file
            print reference_file

            compare = os.path.join('tools', 'compare-output')
            print compare

            rc = process.spawnwaitl(compare, compare, reference_file,
                                    output_file)

            # Program exited with error, or mismatch in output?
            if rc != 0: return False
            return True

        return process.with_path(benchmark.path, perform)
コード例 #8
0
    def run(self, benchmark, dataset, do_output=True, extra_opts=[]):
        """Run this benchmark implementation.

        Return True if the benchmark terminated normally or False
        if there was an error."""

        # Ensure that the benchmark has been built
        if not self.isBuilt(benchmark):
            rc = self.build(benchmark)

            # Stop if 'make' failed
            if not rc: return False

        def perform():
            # Run the program
            exename = path.join('build', self.name, benchmark.name)
            args = [exename
                    ] + extra_opts + dataset.getCommandLineArguments(do_output)
            rc = process.spawnwaitv(exename, args)

            # Program exited with error?
            if rc != 0: return False
            return True

        return process.with_path(benchmark.path, perform)
コード例 #9
0
    def run(self,
            benchmark,
            dataset,
            do_output=True,
            extra_opts=[],
            platform=None):
        """Run this benchmark implementation.

        Return True if the benchmark terminated normally or False
        if there was an error."""

        if platform == None:
            self.platform = 'default'
        else:
            self.platform = platform

        # Ensure that the benchmark has been built
        if not self.isBuilt(benchmark, platform):
            rc = self.build(benchmark, platform)

            # Stop if 'make' failed
            if rc != ErrorType.Success: return rc

        def perform():
            if self.platform == None:
                platform = 'default'
            else:
                platform = self.platform

            # Run the program
            #exename = path.join('build', self.name+'_'+platform, benchmark.name)
            #args = [exename] + extra_opts + dataset.getCommandLineArguments(benchmark, do_output)
            #rc = process.spawnwaitv(exename, args)

            args = extra_opts + dataset.getCommandLineArguments(
                benchmark, do_output)
            #zhangfeng zf
            print args
            args = reduce(lambda x, y: x + ' ' + y, args)
            #zhangfeng zf
            print args

            ###
            try:
                rc = self.makefile(benchmark,
                                   action='run',
                                   platform=platform,
                                   opt={"ARGS": args})
            except KeyboardInterrupt:
                rc = ErrorType.Killed

            # Program exited with error?
            # if rc != 0: return ErrorType.RunFailed
            # return ErrorType.Success
            return rc

        return process.with_path(benchmark.path, perform)
コード例 #10
0
ファイル: benchmark.py プロジェクト: zhangfengthu/CoRunBench
    def run(self, benchmark, dataset, do_output=True, extra_opts=[], platform=None):
        """Run this benchmark implementation.

        Return True if the benchmark terminated normally or False
        if there was an error."""

        if platform == None:
            self.platform = 'default'
        else:
            self.platform = platform

        # Ensure that the benchmark has been built
        if not self.isBuilt(benchmark, platform):
            rc = self.build(benchmark, platform)

            # Stop if 'make' failed
            if rc != ErrorType.Success: return rc

        def perform():
            if self.platform == None:
                platform = 'default'
            else:
                platform = self.platform

            # Run the program
            #exename = path.join('build', self.name+'_'+platform, benchmark.name)
            #args = [exename] + extra_opts + dataset.getCommandLineArguments(benchmark, do_output)
            #rc = process.spawnwaitv(exename, args)

            args = extra_opts + dataset.getCommandLineArguments(benchmark, do_output)
            #zhangfeng zf
            print args
            args = reduce(lambda x, y: x + ' ' + y, args)
            #zhangfeng zf
            print args

            ###
            try:
              rc = self.makefile(benchmark, action='run', platform=platform, opt={"ARGS":args})
            except KeyboardInterrupt:
              rc = ErrorType.Killed

            # Program exited with error?
            # if rc != 0: return ErrorType.RunFailed
            # return ErrorType.Success
            return rc

        return process.with_path(benchmark.path, perform)
コード例 #11
0
    def makefile(self, benchmark, target=None, action=None):
        """Run this implementation's makefile."""

        Benchmark.instance_check(benchmark)

        def perform():
            srcdir = path.join("src", self.name)
            builddir = path.join("build", self.name)

            env = {
                "SRCDIR": srcdir,
                "BUILDDIR": builddir,
                "BIN": path.join(builddir, benchmark.name),
                "PARBOIL_ROOT": globals.root,
            }

            # Run the makefile to build the benchmark
            return process.makefile(target=target, action=action, filepath=path.join(srcdir, "Makefile"), env=env)

        # Go to the benchmark directory before building
        return process.with_path(benchmark.path, perform)
コード例 #12
0
    def makefile(self, benchmark, target=None, action=None, platform=None, opt={}):
        """Run this implementation's makefile."""

        self.platform = platform
        Benchmark.instance_check(benchmark)

        def perform():
            srcdir = path.join("src", self.name)
            builddir = path.join("build", self.name)

            if self.platform == None:
                platform = "default"
            else:
                platform = self.platform

            env = {
                "SRCDIR": srcdir,
                "BUILDDIR": builddir + "_" + platform,
                "BIN": path.join(builddir + "_" + platform, benchmark.name),
                "PARBOIL_ROOT": globals.root,
                "PLATFORM": platform,
                "BUILD": self.name,
            }
            env.update(opt)

            mkfile = globals.root + os.sep + "common" + os.sep + "mk"

            # Run the makefile to build the benchmark
            ret = process.makefile(target=target, action=action, filepath=path.join(mkfile, "Makefile"), env=env)
            if ret == True:
                return ErrorType.Success
            else:
                return ErrorType.CompileError

        # Go to the benchmark directory before building
        return process.with_path(benchmark.path, perform)
コード例 #13
0
    def makefile(self, benchmark, target=None, action=None):
        """Run this implementation's makefile."""

        Benchmark.instance_check(benchmark)

        def perform():
            srcdir = path.join('src', self.name)
            builddir = path.join('build', self.name)

            env = {
                'SRCDIR': srcdir,
                'BUILDDIR': builddir,
                'BIN': path.join(builddir, benchmark.name),
                'PARBOIL_ROOT': globals.root
            }

            # Run the makefile to build the benchmark
            return process.makefile(target=target,
                                    action=action,
                                    filepath=path.join(srcdir, "Makefile"),
                                    env=env)

        # Go to the benchmark directory before building
        return process.with_path(benchmark.path, perform)