prefer physical processors (see also 4b014e6c1dfe and 26a43785590b);
authorwenzelm
Wed, 14 Feb 2024 16:30:27 +0100
changeset 79608 f1df99019b50
parent 79607 118504de9d0d
child 79609 71731d28b86d
prefer physical processors (see also 4b014e6c1dfe and 26a43785590b);
src/Pure/System/host.scala
--- a/src/Pure/System/host.scala	Wed Feb 14 15:29:52 2024 +0100
+++ b/src/Pure/System/host.scala	Wed Feb 14 16:30:27 2024 +0100
@@ -122,24 +122,12 @@
     }
     catch { case ERROR(_) => None }
 
-  def num_cpus(ssh: SSH.System = SSH.Local): Int =
-    if (ssh.is_local) Runtime.getRuntime.availableProcessors
-    else {
-      val command =
-        if (ssh.isabelle_platform.is_macos) "sysctl -n hw.ncpu" else "nproc"
-      val result = ssh.execute(command).check
-      Library.trim_line(result.out) match {
-        case Value.Int(n) => n
-        case _ => 1
-      }
-    }
-
   object Info {
     def init(
       hostname: String = SSH.LOCAL,
       ssh: SSH.System = SSH.Local,
       score: Option[Double] = None
-    ): Info = Info(hostname, numa_nodes(ssh = ssh), num_cpus(ssh = ssh), score)
+    ): Info = Info(hostname, numa_nodes(ssh = ssh), Multithreading.num_processors(ssh = ssh), score)
   }
 
   sealed case class Info(