本文整理汇总了Java中science.atlarge.graphalytics.execution.BenchmarkRunSetup类的典型用法代码示例。如果您正苦于以下问题:Java BenchmarkRunSetup类的具体用法?Java BenchmarkRunSetup怎么用?Java BenchmarkRunSetup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BenchmarkRunSetup类属于science.atlarge.graphalytics.execution包,在下文中一共展示了BenchmarkRunSetup类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import science.atlarge.graphalytics.execution.BenchmarkRunSetup; //导入依赖的package包/类
@Override
public void prepare(RunSpecification runSpecification) {
BenchmarkRunSetup benchmarkRunSetup = runSpecification.getBenchmarkRunSetup();
BenchmarkRun benchmarkRun = runSpecification.getBenchmarkRun();
if(enabled) {
LOG.debug("Start prepare in Granula");
if(platformLogEnabled) {
preserveExecutionLog(platform, benchmarkRun, benchmarkRunSetup.getLogDir());
// platform.prepare(benchmark, getLogDirectory(benchmarkRun));
}
}
}
示例2: run
import science.atlarge.graphalytics.execution.BenchmarkRunSetup; //导入依赖的package包/类
@Override
public void run(RunSpecification runSpecification) throws PlatformExecutionException {
BenchmarkRun benchmarkRun = runSpecification.getBenchmarkRun();
BenchmarkRunSetup benchmarkRunSetup = runSpecification.getBenchmarkRunSetup();
RuntimeSetup runtimeSetup = runSpecification.getRuntimeSetup();
PowergraphJob job;
Object params = benchmarkRun.getAlgorithmParameters();
String logPath = benchmarkRunSetup.getLogDir().resolve("platform").toString();
boolean graphDirected = benchmarkRun.getFormattedGraph().isDirected();
String vertexFilePath = runtimeSetup.getLoadedGraph().getVertexPath();
String edgeFilePath = runtimeSetup.getLoadedGraph().getEdgePath();
switch(benchmarkRun.getAlgorithm()) {
case BFS:
job = new BreadthFirstSearchJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (BreadthFirstSearchParameters) params, benchmarkRun.getId(), logPath);
break;
case WCC:
job = new ConnectedComponentsJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, benchmarkRun.getId(), logPath);
break;
case LCC:
job = new LocalClusteringCoefficientJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, benchmarkRun.getId(), logPath);
break;
case CDLP:
job = new CommunityDetectionJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (CommunityDetectionLPParameters) params, benchmarkRun.getId(), logPath);
break;
case PR:
job = new PageRankJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (PageRankParameters) params, benchmarkRun.getId(), logPath);
break;
case SSSP:
job = new SingleSourceShortestPathsJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (SingleSourceShortestPathsParameters) params, benchmarkRun.getId(), logPath);
break;
default:
throw new PlatformExecutionException("Unsupported algorithm");
}
if (benchmarkRunSetup.isOutputRequired()) {
Path outputFile = benchmarkRunSetup.getOutputDir().resolve(benchmarkRun.getName());
job.setOutputFile(outputFile.toFile());
}
try {
job.run();
} catch (IOException|InterruptedException e) {
throw new PlatformExecutionException("failed to execute command", e);
}
}
示例3: startup
import science.atlarge.graphalytics.execution.BenchmarkRunSetup; //导入依赖的package包/类
@Override
public void startup(RunSpecification runSpecification) {
BenchmarkRunSetup benchmarkRunSetup = runSpecification.getBenchmarkRunSetup();
startPlatformLogging(benchmarkRunSetup.getLogDir().resolve("platform").resolve("driver.logs"));
}
示例4: finalize
import science.atlarge.graphalytics.execution.BenchmarkRunSetup; //导入依赖的package包/类
@Override
public BenchmarkMetrics finalize(RunSpecification runSpecification) {
stopPlatformLogging();
BenchmarkRunSetup benchmarkRunSetup = runSpecification.getBenchmarkRunSetup();
BenchmarkRun benchmarkRun = runSpecification.getBenchmarkRun();
Path platformLogPath = benchmarkRunSetup.getLogDir().resolve("platform");
final List<Double> superstepTimes = new ArrayList<>();
try {
Files.walkFileTree(platformLogPath, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
String logs = FileUtil.readFile(file);
for (String line : logs.split("\n")) {
if (line.contains("- run algorithm:")) {
Pattern regex = Pattern.compile(
".* - run algorithm: ([+-]?([0-9]*[.])?[0-9]+) sec.*");
Matcher matcher = regex.matcher(line);
matcher.find();
superstepTimes.add(Double.parseDouble(matcher.group(1)));
}
}
return FileVisitResult.CONTINUE;
}
});
} catch (IOException e) {
e.printStackTrace();
}
if (superstepTimes.size() != 0) {
Double procTime = 0.0;
for (Double superstepTime : superstepTimes) {
procTime += superstepTime;
}
BenchmarkMetrics metrics = new BenchmarkMetrics();
BigDecimal procTimeS = (new BigDecimal(procTime)).setScale(3, RoundingMode.CEILING);
metrics.setProcessingTime(new BenchmarkMetric(procTimeS, "s"));
return metrics;
} else {
LOG.error("Failed to find any metrics regarding superstep runtime.");
return new BenchmarkMetrics();
}
}