From 34a5db69389f6d2fe3b08f81426853ff5d231743 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Fri, 16 Aug 2024 09:28:24 +0200
Subject: [PATCH] feat: Use all available cores for building by default.

Change-Id: I668edd30825baf463beffb43d835d608cde55e58
---
 bin/yashchiki | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bin/yashchiki b/bin/yashchiki
index f679741f..4a904865 100755
--- a/bin/yashchiki
+++ b/bin/yashchiki
@@ -55,6 +55,8 @@ all_stages=set(["fetch", "build-base-image", "build-base", "build-spack", "image
 
 all_styles = list(os.listdir(os.path.dirname(os.path.realpath(__file__)) + "/../share/yashchiki/styles/"))
 
+count_available_cores = len(os.sched_getaffinity(0))
+
 # mandatory
 parser.add_argument(
     "style", type=str, choices=all_styles,
@@ -120,8 +122,9 @@ parser.add_argument(
          "postfix'ed with an ascending integer.")
 # optional options
 parser.add_argument(
-    "-j", "--jobs", type=int, default=1,
-    help="Number of parallel jobs to use when concurrent execution of tasks is available.")
+    "-j", "--jobs", type=int, default=count_available_cores,
+    help="Number of parallel jobs to use when concurrent execution of "
+    "tasks is available. Defaults to the number of available cores.")
 parser.add_argument(
     "--debug", action="store_true",
     help="Enable debug-level logging.")
-- 
GitLab