Beispiel #1
0
def execute_benchmark(benchmark, output_handler):
    if not _justReprocessResults:
        # build input for cloud
        (cloudInput, numberOfRuns) = getCloudInput(benchmark)
        cloudInputFile = os.path.join(benchmark.log_folder, 'cloudInput.txt')
        util.write_file(cloudInput, cloudInputFile)
        output_handler.all_created_files.append(cloudInputFile)

        # install cloud and dependencies
        ant = subprocess.Popen(["ant", "resolve-benchmark-dependencies"],
                               cwd=_ROOT_DIR,
                               shell=util.is_windows())
        ant.communicate()
        ant.wait()

        # start cloud and wait for exit
        logging.debug("Starting cloud.")
        if benchmark.config.debug:
            logLevel = "FINER"
        else:
            logLevel = "INFO"
        heapSize = benchmark.config.cloudClientHeap + numberOfRuns // 10  # 100 MB and 100 kB per run
        lib = os.path.join(_ROOT_DIR, "lib", "java-benchmark", "vcloud.jar")
        cmdLine = [
            "java", "-Xmx" + str(heapSize) + "m", "-jar", lib, "benchmark",
            "--loglevel", logLevel
        ]
        if benchmark.config.cloudMaster:
            cmdLine.extend(["--master", benchmark.config.cloudMaster])
        if benchmark.config.debug:
            cmdLine.extend(["--print-new-files", "true"])

        walltime_before = time.time()

        cloud = subprocess.Popen(cmdLine,
                                 stdin=subprocess.PIPE,
                                 shell=util.is_windows())
        try:
            (out, err) = cloud.communicate(cloudInput.encode('utf-8'))
        except KeyboardInterrupt:
            stop()
        returnCode = cloud.wait()

        walltime_after = time.time()
        usedWallTime = walltime_after - walltime_before

        if returnCode:
            if STOPPED_BY_INTERRUPT:
                output_handler.set_error('interrupted')
            else:
                errorMsg = "Cloud return code: {0}".format(returnCode)
                logging.warning(errorMsg)
                output_handler.set_error(errorMsg)
    else:
        returnCode = 0
        usedWallTime = None

    handleCloudResults(benchmark, output_handler, usedWallTime)

    return returnCode
Beispiel #2
0
def execute_benchmark(benchmark, output_handler):
    if not _justReprocessResults:
        # build input for cloud
        (cloudInput, numberOfRuns) = getCloudInput(benchmark)
        cloudInputFile = os.path.join(benchmark.log_folder, 'cloudInput.txt')
        util.write_file(cloudInput, cloudInputFile)
        output_handler.all_created_files.append(cloudInputFile)

        # install cloud and dependencies
        ant = subprocess.Popen(["ant", "resolve-benchmark-dependencies"],
                               cwd=_ROOT_DIR,
                               shell=util.is_windows())
        ant.communicate()
        ant.wait()

        # start cloud and wait for exit
        logging.debug("Starting cloud.")
        if benchmark.config.debug:
            logLevel =  "FINER"
        else:
            logLevel = "INFO"
        heapSize = benchmark.config.cloudClientHeap + numberOfRuns//10 # 100 MB and 100 kB per run
        lib = os.path.join(_ROOT_DIR, "lib", "java-benchmark", "vcloud.jar")
        cmdLine = ["java", "-Xmx"+str(heapSize)+"m", "-jar", lib, "benchmark", "--loglevel", logLevel]
        if benchmark.config.cloudMaster:
            cmdLine.extend(["--master", benchmark.config.cloudMaster])
        if benchmark.config.debug:
            cmdLine.extend(["--print-new-files", "true"])

        walltime_before = time.time()

        cloud = subprocess.Popen(cmdLine, stdin=subprocess.PIPE, shell=util.is_windows())
        try:
            (out, err) = cloud.communicate(cloudInput.encode('utf-8'))
        except KeyboardInterrupt:
            stop()
        returnCode = cloud.wait()

        walltime_after = time.time()
        usedWallTime = walltime_after - walltime_before

        if returnCode:
            if STOPPED_BY_INTERRUPT:
                output_handler.set_error('interrupted')
            else:
                errorMsg = "Cloud return code: {0}".format(returnCode)
                logging.warning(errorMsg)
                output_handler.set_error(errorMsg)
    else:
        returnCode = 0
        usedWallTime = None

    handleCloudResults(benchmark, output_handler, usedWallTime)

    return returnCode
Beispiel #3
0
 def _buildCPAchecker(self, executableDir):
     logging.debug("Building CPAchecker in directory {0}.".format(executableDir))
     ant = subprocess.Popen(
         ["ant", "-lib", "lib/java/build", "-q", "jar"], cwd=executableDir, shell=util.is_windows()
     )
     ant.communicate()
     if ant.returncode:
         sys.exit("Failed to build CPAchecker, please fix the build first.")
Beispiel #4
0
 def _buildCPAchecker(self, executableDir):
     logging.debug(
         'Building CPAchecker in directory {0}.'.format(executableDir))
     ant = subprocess.Popen(['ant', '-lib', 'lib/java/build', '-q', 'jar'],
                            cwd=executableDir,
                            shell=util.is_windows())
     ant.communicate()
     if ant.returncode:
         sys.exit('Failed to build CPAchecker, please fix the build first.')
Beispiel #5
0
def execute_benchmark(benchmark, output_handler):
    if not _justReprocessResults:
        # build input for cloud
        (cloudInput, numberOfRuns) = getCloudInput(benchmark)
        if benchmark.config.debug:
            cloudInputFile = os.path.join(benchmark.log_folder,
                                          "cloudInput.txt")
            benchexec.util.write_file(cloudInput, cloudInputFile)
            output_handler.all_created_files.add(cloudInputFile)
        meta_information = json.dumps({
            "tool": {
                "name": benchmark.tool_name,
                "revision": benchmark.tool_version,
                "benchexec-module": benchmark.tool_module,
            },
            "benchmark": benchmark.name,
            "timestamp": benchmark.instance,
            "generator": "benchmark.vcloud.py",
        })

        # install cloud and dependencies
        ant = subprocess.Popen(
            ["ant", "resolve-benchmark-dependencies"],
            cwd=_ROOT_DIR,
            shell=util.is_windows(),
        )
        ant.communicate()
        ant.wait()

        # start cloud and wait for exit
        logging.debug("Starting cloud.")
        if benchmark.config.debug:
            logLevel = "FINER"
        else:
            logLevel = "INFO"
        # heuristic for heap size: 100 MB and 100 kB per run
        heapSize = benchmark.config.cloudClientHeap + numberOfRuns // 10
        lib = os.path.join(_ROOT_DIR, "lib", "java-benchmark", "vcloud.jar")
        cmdLine = [
            "java",
            "-Xmx" + str(heapSize) + "m",
            "-jar",
            lib,
            "benchmark",
            "--loglevel",
            logLevel,
            "--run-collection-meta-information",
            meta_information,
            "--environment",
            formatEnvironment(benchmark.environment()),
            "--max-log-file-size",
            str(benchmark.config.maxLogfileSize),
            "--debug",
            str(benchmark.config.debug),
        ]
        if benchmark.config.cloudMaster:
            cmdLine.extend(["--master", benchmark.config.cloudMaster])
        if benchmark.config.zipResultFiles:
            cmdLine.extend(
                ["--zip-result-files",
                 str(benchmark.config.zipResultFiles)])
        if benchmark.config.cgroupAccess:
            cmdLine.extend(
                ["--cgroupAccess",
                 str(benchmark.config.cgroupAccess)])
        if benchmark.config.debug:
            cmdLine.extend(["--print-new-files", "true"])

        start_time = benchexec.util.read_local_time()

        cloud = subprocess.Popen(cmdLine,
                                 stdin=subprocess.PIPE,
                                 shell=util.is_windows())
        try:
            cloud.communicate(cloudInput.encode("utf-8"))
        except KeyboardInterrupt:
            stop()
        returnCode = cloud.wait()

        end_time = benchexec.util.read_local_time()

        if returnCode:
            if STOPPED_BY_INTERRUPT:
                output_handler.set_error("interrupted")
            else:
                errorMsg = "Cloud return code: {0}".format(returnCode)
                logging.warning(errorMsg)
                output_handler.set_error(errorMsg)
    else:
        returnCode = 0
        start_time = None
        end_time = None

    handleCloudResults(benchmark, output_handler, start_time, end_time)

    return returnCode
Beispiel #6
0
 def _buildCPAchecker(self, executableDir):
     logging.debug('Building CPAchecker in directory {0}.'.format(executableDir))
     ant = subprocess.Popen(['ant', '-lib', 'lib/java/build', '-q', 'jar'], cwd=executableDir, shell=util.is_windows())
     ant.communicate()
     if ant.returncode:
         sys.exit('Failed to build CPAchecker, please fix the build first.')
Beispiel #7
0
def execute_benchmark(benchmark, output_handler):
    if not _justReprocessResults:
        # build input for cloud
        (cloudInput, numberOfRuns) = getCloudInput(benchmark)
        if benchmark.config.debug:
            cloudInputFile = os.path.join(benchmark.log_folder, 'cloudInput.txt')
            util.write_file(cloudInput, cloudInputFile)
            output_handler.all_created_files.add(cloudInputFile)
        meta_information = json.dumps({"tool": {"name": benchmark.tool_name,\
                                                "revision": benchmark.tool_version, \
                                                "benchexec-module" : benchmark.tool_module}, \
                                       "benchmark" : benchmark.name,
                                       "timestamp" : benchmark.instance,
                                       "generator": "benchmark.vcloud.py"})

        # install cloud and dependencies
        ant = subprocess.Popen(["ant", "resolve-benchmark-dependencies"],
                               cwd=_ROOT_DIR,
                               shell=util.is_windows())
        ant.communicate()
        ant.wait()

        # start cloud and wait for exit
        logging.debug("Starting cloud.")
        if benchmark.config.debug:
            logLevel =  "FINER"
        else:
            logLevel = "INFO"
        heapSize = benchmark.config.cloudClientHeap + numberOfRuns//10 # 100 MB and 100 kB per run
        lib = os.path.join(_ROOT_DIR, "lib", "java-benchmark", "vcloud.jar")
        cmdLine = ["java", "-Xmx"+str(heapSize)+"m", "-jar", lib, "benchmark", "--loglevel", logLevel, \
                   "--run-collection-meta-information", meta_information, \
                   "--environment", formatEnvironment(benchmark.environment()), \
                   "--max-log-file-size", str(benchmark.config.maxLogfileSize), \
                   "--debug", str(benchmark.config.debug)]
        if benchmark.config.cloudMaster:
            cmdLine.extend(["--master", benchmark.config.cloudMaster])
        if benchmark.config.debug:
            cmdLine.extend(["--print-new-files", "true"])

        walltime_before = time.time()

        cloud = subprocess.Popen(cmdLine, stdin=subprocess.PIPE, shell=util.is_windows())
        try:
            cloud.communicate(cloudInput.encode('utf-8'))
        except KeyboardInterrupt:
            stop()
        returnCode = cloud.wait()

        walltime_after = time.time()
        usedWallTime = walltime_after - walltime_before

        if returnCode:
            if STOPPED_BY_INTERRUPT:
                output_handler.set_error('interrupted')
            else:
                errorMsg = "Cloud return code: {0}".format(returnCode)
                logging.warning(errorMsg)
                output_handler.set_error(errorMsg)
    else:
        returnCode = 0
        usedWallTime = None

    handleCloudResults(benchmark, output_handler, usedWallTime)

    return returnCode