more robust: imitate Isabelle/ML operation more closely (after 26a43785590b);
logical_cores is e.g. relevant for server-arm.sketis.net, where /proc/cpuinfo looks quite different;
--- a/src/Pure/Concurrent/multithreading.scala Sun Mar 03 16:32:59 2024 +0100
+++ b/src/Pure/Concurrent/multithreading.scala Sun Mar 03 17:47:50 2024 +0100
@@ -39,7 +39,17 @@
}
cores.valuesIterator.sum
}
- if (physical_cores > 1) physical_cores else 1
+
+ def logical_cores(): Int =
+ if (ssh.is_local) Runtime.getRuntime.availableProcessors()
+ else {
+ Library.trim_line(ssh.execute("nproc").check.out) match {
+ case Value.Nat(n) => n
+ case _ => 1
+ }
+ }
+
+ if (physical_cores > 0) physical_cores else logical_cores()
}