Skip to content

Commit

Permalink
Final tweaks (-beagle_threads 0 is equivalent of -beagle_threading_off)
Browse files Browse the repository at this point in the history
  • Loading branch information
rambaut committed Aug 16, 2023
1 parent 73bc470 commit d869696
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/dr/app/beast/BeastMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d869696

Please sign in to comment.