From d86969636929ac6c99cd2ea861a3ddf03ed3be54 Mon Sep 17 00:00:00 2001 From: rambaut Date: Wed, 16 Aug 2023 14:26:08 +0100 Subject: [PATCH] Final tweaks (-beagle_threads 0 is equivalent of -beagle_threading_off) --- src/dr/app/beast/BeastMain.java | 2 +- .../treedatalikelihood/BeagleDataLikelihoodDelegate.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dr/app/beast/BeastMain.java b/src/dr/app/beast/BeastMain.java index 6dc18a10cc..0b7d90961b 100644 --- a/src/dr/app/beast/BeastMain.java +++ b/src/dr/app/beast/BeastMain.java @@ -372,7 +372,7 @@ public static void main(String[] args) throws java.io.IOException { new Arguments.Option("beagle_SSE", "BEAGLE: use SSE extensions if available"), new Arguments.Option("beagle_SSE_off", "BEAGLE: turn off use of SSE extensions"), new Arguments.Option("beagle_threading_off", "BEAGLE: turn off multi-threading for a CPU instance"), - new Arguments.IntegerOption("beagle_threads", 1, Integer.MAX_VALUE, "BEAGLE: manually set number of threads per CPU instance (default auto)"), + new Arguments.IntegerOption("beagle_threads", 0, Integer.MAX_VALUE, "BEAGLE: manually set number of threads per CPU instance (default auto)"), new Arguments.Option("beagle_cuda", "BEAGLE: use CUDA parallization if available"), new Arguments.Option("beagle_opencl", "BEAGLE: use OpenCL parallization if available"), new Arguments.Option("beagle_single", "BEAGLE: use single precision if available"), diff --git a/src/dr/evomodel/treedatalikelihood/BeagleDataLikelihoodDelegate.java b/src/dr/evomodel/treedatalikelihood/BeagleDataLikelihoodDelegate.java index fc77dbc1a5..c79f08d840 100644 --- a/src/dr/evomodel/treedatalikelihood/BeagleDataLikelihoodDelegate.java +++ b/src/dr/evomodel/treedatalikelihood/BeagleDataLikelihoodDelegate.java @@ -305,7 +305,7 @@ public BeagleDataLikelihoodDelegate(Tree tree, threadCount = Integer.parseInt(tc); } - if (threadCount == 0 || threadCount == 1) { + if (threadCount < 1) { preferenceFlags &= ~BeagleFlag.THREADING_CPP.getMask(); preferenceFlags |= BeagleFlag.THREADING_NONE.getMask(); } else { @@ -439,10 +439,10 @@ public BeagleDataLikelihoodDelegate(Tree tree, instanceFlags = instanceDetails.getFlags(); if ((instanceFlags & BeagleFlag.THREADING_CPP.getMask()) != 0) { - if (IS_THREAD_COUNT_COMPATIBLE() || threadCount != 0) { + if (IS_THREAD_COUNT_COMPATIBLE() && threadCount != 0) { if (threadCount > 0) { beagle.setCPUThreadCount(threadCount); - logger.info(" Using " + threadCount + " threads for CPU."); + logger.info(" Using " + threadCount + " thread" + (threadCount > 1 ? "s" : "") + " for CPU."); } else { // if no thread_count is specified then this will be -1 so put no upper bound on threads // currently the parser provides a default based on the number of cores as BEAGLE's