From d2e21dea17c72bbb8e787a038056ec1a9d46ed18 Mon Sep 17 00:00:00 2001 From: glaville Date: Thu, 10 Jul 2014 14:38:24 +0200 Subject: [PATCH] Update preys-predators runtime to use let the control of device types to MCMAS internal logic --- src/preypredator/PPRuntimeGPU.java | 5 ++--- src/preypredator/PreyPredator2.java | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/preypredator/PPRuntimeGPU.java b/src/preypredator/PPRuntimeGPU.java index 6f2d656..bdf6b3b 100644 --- a/src/preypredator/PPRuntimeGPU.java +++ b/src/preypredator/PPRuntimeGPU.java @@ -1,6 +1,5 @@ package preypredator; -import mcmas.api.ContextType; import mcmas.api.MCMASContext; import mcmas.core.MCMCommandQueueProperty; import mcmas.plugins.axb.AXBPlugin; @@ -13,8 +12,8 @@ public class PPRuntimeGPU implements PPRuntime { private final AXBPlugin axbPlugin; private final GridSearchPlugin searchPlugin; - public PPRuntimeGPU(ContextType type) { - this.context = new MCMASContext(type, MCMCommandQueueProperty.ENABLE_PROFILING); + public PPRuntimeGPU() { + this.context = new MCMASContext(MCMCommandQueueProperty.ENABLE_PROFILING); this.axbPlugin = new AXBPlugin(context); this.searchPlugin = new GridSearchPlugin(context); } diff --git a/src/preypredator/PreyPredator2.java b/src/preypredator/PreyPredator2.java index 7a067e3..dd3c4f7 100644 --- a/src/preypredator/PreyPredator2.java +++ b/src/preypredator/PreyPredator2.java @@ -12,7 +12,6 @@ import org.slf4j.LoggerFactory; import joptsimple.OptionParser; import joptsimple.OptionSet; -import mcmas.api.ContextType; public class PreyPredator2 { @@ -241,7 +240,7 @@ public class PreyPredator2 { public static void main(String[] args) { OptionParser parser = new OptionParser(); - parser.acceptsAll(Arrays.asList("g", "gpu"), "Enable GPU context") + parser.acceptsAll(Arrays.asList("g", "gpu", "opencl"), "Enable OpenCL support") .withOptionalArg().ofType(Boolean.class).defaultsTo(true); parser.acceptsAll(Arrays.asList("h", "help"), "Print this help"); @@ -273,10 +272,10 @@ public class PreyPredator2 { PPRuntime runtime; if ((Boolean) (options.valueOf("gpu"))) { - logger.info("Use GPU Runtime"); - runtime = new PPRuntimeGPU(ContextType.ALL); + logger.info("Use OpenCL runtime on first available GPU"); + runtime = new PPRuntimeGPU(); } else { - logger.info("Use CPU Runtime"); + logger.info("Use Java Runtime"); runtime = new PPRuntimeCPU(); } -- 1.7.10.4