mirror of https://github.com/armbian/build.git
Add option for number of threads used by build system (#8346)
* Add option for number of threads used by build system Attempt to fix https://github.com/armbian/build/issues/6907 * Add CPUTHREADS to replace USEALLTHREADS Defaults to 150% as was always the case, otherwise allow user to override number of threads.
This commit is contained in:
parent
3a9babee14
commit
370bedb42d
|
@ -24,10 +24,15 @@ function prepare_compilation_vars() {
|
|||
# moved from config: this does not belong in configuration. it's a compilation thing.
|
||||
# optimize build time with 100% CPU usage
|
||||
CPUS=$(grep -c 'processor' /proc/cpuinfo)
|
||||
if [[ $USEALLCORES != no ]]; then
|
||||
CTHREADS="-j$((CPUS + CPUS / 2))"
|
||||
else
|
||||
CTHREADS="-j1"
|
||||
|
||||
# Default to 150% of CPUs to maximize compilation speed
|
||||
CTHREADS="-j$((CPUS + CPUS / 2))"
|
||||
|
||||
# If CPUTHREADS is defined and a valid positive integer allow user to override CTHREADS
|
||||
# This is useful for limiting Armbian build to a specific number of threads, e.g. for build servers
|
||||
if [[ "$CPUTHREADS" =~ ^[1-9][0-9]*$ ]]; then
|
||||
CTHREADS="-j$CPUTHREADS"
|
||||
echo "Using user-defined thread count: $CTHREADS"
|
||||
fi
|
||||
|
||||
call_extension_method "post_determine_cthreads" "config_post_determine_cthreads" <<- 'POST_DETERMINE_CTHREADS'
|
||||
|
|
|
@ -95,8 +95,6 @@ function do_main_configuration() {
|
|||
TZDATA="Etc/UTC" # If not /etc/timezone at host, default to UTC.
|
||||
fi
|
||||
|
||||
USEALLCORES=yes # Use all CPU cores for compiling
|
||||
|
||||
[[ -z $EXIT_PATCHING_ERROR ]] && EXIT_PATCHING_ERROR="" # exit patching if failed
|
||||
[[ -z $HOST ]] && HOST="$BOARD"
|
||||
cd "${SRC}" || exit
|
||||
|
|
Loading…
Reference in New Issue