From 3b6df859b7521b50b997e492b0367020d3747e9d Mon Sep 17 00:00:00 2001 From: Bibek Date: Wed, 13 Aug 2014 08:55:33 +0200 Subject: [PATCH] Added optimizers to evaluations. --- .../evaluation/BerlinSparqlEvaluation.scala | 4 ++-- .../TripleRushEvaluationISWCSlurm.scala | 2 +- .../TripleRushEvaluationSlurm.scala | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/main/scala/com/signalcollect/triplerush/evaluation/BerlinSparqlEvaluation.scala b/src/main/scala/com/signalcollect/triplerush/evaluation/BerlinSparqlEvaluation.scala index 6801a8e..8e18cec 100644 --- a/src/main/scala/com/signalcollect/triplerush/evaluation/BerlinSparqlEvaluation.scala +++ b/src/main/scala/com/signalcollect/triplerush/evaluation/BerlinSparqlEvaluation.scala @@ -39,7 +39,7 @@ class BerlinSparqlEvaluation extends TorqueDeployableAlgorithm { val warmupRuns = parameters("jitRepetitions").toInt val graphBuilder = new GraphBuilder[Long, Any].withPreallocatedNodes(nodeActors) - val tr = new TripleRush(graphBuilder) + val tr = new TripleRush(graphBuilder, optimizerCreator = optimizerCreator) println("TripleRush has been started.") var commonResults = parameters @@ -67,7 +67,7 @@ class BerlinSparqlEvaluation extends TorqueDeployableAlgorithm { JvmWarmup.sleepUntilGcInactiveForXSeconds(60, 180) commonResults += ((s"optimizerInitialisationTime", optimizerInitialisationTime.toString)) - commonResults += ((s"optimizerName", "ExplorationOptimizer")) + commonResults += ((s"optimizerName", optimizerCreator.toString())) commonResults += (("loadingTime", loadingTime.toString)) commonResults += s"loadNumber" -> datasetSize.toString commonResults += s"dataSet" -> s"berlinsparql $datasetSize" diff --git a/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationISWCSlurm.scala b/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationISWCSlurm.scala index d1018c3..0a77a96 100644 --- a/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationISWCSlurm.scala +++ b/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationISWCSlurm.scala @@ -50,7 +50,7 @@ class TripleRushEvaluationISWCSlurm extends TorqueDeployableAlgorithm { val dataSource = parameters(dataSourceKey) val rdfTypePartitioning = parameters(rdfTypePartitioningKey).toBoolean val graphBuilder = new GraphBuilder[Long, Any]().withPreallocatedNodes(nodeActors) - val tr = new TripleRush(graphBuilder) + val tr = new TripleRush(graphBuilder, optimizerCreator) println("TripleRush has been started.") var commonResults = parameters commonResults += "numberOfNodes" -> tr.graph.numberOfNodes.toString diff --git a/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationSlurm.scala b/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationSlurm.scala index 3f789c0..25ee2d3 100644 --- a/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationSlurm.scala +++ b/src/main/scala/com/signalcollect/triplerush/evaluation/TripleRushEvaluationSlurm.scala @@ -18,6 +18,7 @@ import com.signalcollect.triplerush.optimizers.Optimizer import akka.actor.ActorRef import com.signalcollect.triplerush.TriplePattern import com.signalcollect.triplerush.evaluation.lubm.FileOperations._ +import com.signalcollect.triplerush.optimizers.HeuristicOptimizerCreator class TripleRushEvaluationSlurm extends TorqueDeployableAlgorithm { import SlurmEvalHelpers._ @@ -25,12 +26,12 @@ class TripleRushEvaluationSlurm extends TorqueDeployableAlgorithm { /** * For TR evaluation without counting result length */ - + val evaluationDescriptionKey = "evaluationDescription" val warmupRunsKey = "jitRepetitions" val datasetKey = "dataset" val universitiesKey = "universities" - //val optimizerCreatorKey = "optimizerCreator" + val optimizerCreatorKey = "optimizerCreator" val spreadsheetUsernameKey = "spreadsheetUsername" val spreadsheetPasswordKey = "spreadsheetPassword" val spreadsheetNameKey = "spreadsheetName" @@ -43,15 +44,15 @@ class TripleRushEvaluationSlurm extends TorqueDeployableAlgorithm { val warmupRuns = parameters(warmupRunsKey).toInt val dataset = parameters(datasetKey) val universities: Option[String] = parameters.get(universitiesKey) - //val optimizerCreatorName = parameters(optimizerCreatorKey) - //val optimizerCreator = getObject[Function1[TripleRush, Option[Optimizer]]](optimizerCreatorName) + val optimizerCreatorName = parameters(optimizerCreatorKey) + val optimizerCreator = getObject[Function1[TripleRush, Option[Optimizer]]](optimizerCreatorName) val spreadsheetUsername = parameters(spreadsheetUsernameKey) val spreadsheetPassword = parameters(spreadsheetPasswordKey) val spreadsheetName = parameters(spreadsheetNameKey) val worksheetName = parameters(worksheetNameKey) val rdfTypePartitioning = parameters(rdfTypePartitioningKey).toBoolean val graphBuilder = new GraphBuilder[Long, Any]().withPreallocatedNodes(nodeActors) - val tr = new TripleRush(graphBuilder) + val tr = new TripleRush(graphBuilder, optimizerCreator = optimizerCreator) println("TripleRush has been started.") var commonResults = parameters commonResults += "numberOfNodes" -> tr.graph.numberOfNodes.toString @@ -78,9 +79,9 @@ class TripleRushEvaluationSlurm extends TorqueDeployableAlgorithm { } else { LubmQueries.fullQueries } - + commonResults += ((s"optimizerInitialisationTime", optimizerInitialisationTime.toString)) - commonResults += ((s"optimizerName", "ExplorationOptimizer")) + commonResults += ((s"optimizerName", optimizerCreator.toString())) commonResults += (("loadingTime", loadingTime.toString)) commonResults += s"loadNumber" -> universities.toString commonResults += s"dataSet" -> s"lubm$universities" @@ -98,7 +99,7 @@ class TripleRushEvaluationSlurm extends TorqueDeployableAlgorithm { println(s"Finished warm-up.") JvmWarmup.sleepUntilGcInactiveForXSeconds(60) } - + val warmupTime = measureTime(warmup) commonResults += s"warmupTime" -> warmupTime.toString @@ -120,7 +121,7 @@ class TripleRushEvaluationSlurm extends TorqueDeployableAlgorithm { tr.shutdown } - def executeEvaluationRun(query: Seq[TriplePattern], queryDescription: String, queryRun: Int, tr: TripleRush, commonResults: Map[String, String]): Map[String, String] = { + def executeEvaluationRun(query: Seq[TriplePattern], queryDescription: String, queryRun: Int, tr: TripleRush, commonResults: Map[String, String]): Map[String, String] = { val gcs = ManagementFactory.getGarbageCollectorMXBeans.toList val compilations = ManagementFactory.getCompilationMXBean val javaVersion = ManagementFactory.getRuntimeMXBean.getVmVersion