Commit d2e21dea17c72bbb8e787a038056ec1a9d46ed18
1 parent
4356a017e6
Exists in
master
Update preys-predators runtime to use let the control of device types to
MCMAS internal logic
Showing 2 changed files with 6 additions and 8 deletions Side-by-side Diff
src/preypredator/PPRuntimeGPU.java
View file @
d2e21de
1 | 1 | package preypredator; |
2 | 2 | |
3 | -import mcmas.api.ContextType; | |
4 | 3 | import mcmas.api.MCMASContext; |
5 | 4 | import mcmas.core.MCMCommandQueueProperty; |
6 | 5 | import mcmas.plugins.axb.AXBPlugin; |
... | ... | @@ -13,8 +12,8 @@ |
13 | 12 | private final AXBPlugin axbPlugin; |
14 | 13 | private final GridSearchPlugin searchPlugin; |
15 | 14 | |
16 | - public PPRuntimeGPU(ContextType type) { | |
17 | - this.context = new MCMASContext(type, MCMCommandQueueProperty.ENABLE_PROFILING); | |
15 | + public PPRuntimeGPU() { | |
16 | + this.context = new MCMASContext(MCMCommandQueueProperty.ENABLE_PROFILING); | |
18 | 17 | this.axbPlugin = new AXBPlugin(context); |
19 | 18 | this.searchPlugin = new GridSearchPlugin(context); |
20 | 19 | } |
src/preypredator/PreyPredator2.java
View file @
d2e21de
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | |
13 | 13 | import joptsimple.OptionParser; |
14 | 14 | import joptsimple.OptionSet; |
15 | -import mcmas.api.ContextType; | |
16 | 15 | |
17 | 16 | public class PreyPredator2 { |
18 | 17 | |
... | ... | @@ -241,7 +240,7 @@ |
241 | 240 | public static void main(String[] args) { |
242 | 241 | OptionParser parser = new OptionParser(); |
243 | 242 | |
244 | - parser.acceptsAll(Arrays.asList("g", "gpu"), "Enable GPU context") | |
243 | + parser.acceptsAll(Arrays.asList("g", "gpu", "opencl"), "Enable OpenCL support") | |
245 | 244 | .withOptionalArg().ofType(Boolean.class).defaultsTo(true); |
246 | 245 | |
247 | 246 | parser.acceptsAll(Arrays.asList("h", "help"), "Print this help"); |
248 | 247 | |
... | ... | @@ -273,10 +272,10 @@ |
273 | 272 | PPRuntime runtime; |
274 | 273 | |
275 | 274 | if ((Boolean) (options.valueOf("gpu"))) { |
276 | - logger.info("Use GPU Runtime"); | |
277 | - runtime = new PPRuntimeGPU(ContextType.ALL); | |
275 | + logger.info("Use OpenCL runtime on first available GPU"); | |
276 | + runtime = new PPRuntimeGPU(); | |
278 | 277 | } else { |
279 | - logger.info("Use CPU Runtime"); | |
278 | + logger.info("Use Java Runtime"); | |
280 | 279 | runtime = new PPRuntimeCPU(); |
281 | 280 | } |
282 | 281 |