-
-
Notifications
You must be signed in to change notification settings - Fork 35
allow to specify thread counts (sync,build) #201
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ buildDevice() { | |
cd "$DOS_BUILD_BASE"; | ||
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1"; | ||
pkill java && sleep 10; #XXX: ugly hack | ||
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2; | ||
breakfast "lineage_$1-user" && mka -j${DOS_MAX_THREADS_BUILD} target-files-package otatools && processRelease $1 true $2; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mka already defaults to all cores +2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes and this change allows it to decrease it. It's not needed when you want to use all cores but this not always wanted - at least for me |
||
pkill java && sleep 10; #XXX: ugly hack | ||
} | ||
export -f buildDevice; | ||
|
@@ -43,7 +43,7 @@ buildDeviceUserDebug() { | |
cd "$DOS_BUILD_BASE"; | ||
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then | ||
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1"; | ||
breakfast "lineage_$1-userdebug" && mka target-files-package otatools && processRelease $1 true $2; | ||
breakfast "lineage_$1-userdebug" && mka -j${DOS_MAX_THREADS_BUILD} target-files-package otatools && processRelease $1 true $2; | ||
else | ||
echo -e "\e[0;31mNo signing keys available for $1\e[0m"; | ||
fi; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
#START OF USER CONFIGURABLE OPTIONS | ||
# | ||
#General | ||
#export DOS_MAX_THREADS_REPO=8; #Max amount of threads used for sync, e.g. used by repo (shouldn't exceed your CPU cores count, due to rate limit restrictions this cannot be set higher then 8) | ||
#export DOS_MAX_THREADS_BUILD="nolimit"; #Max amount of threads used for build, e.g. used by make (shouldn't exceed your CPU cores count) | ||
export DOS_WORKSPACE_ROOT="/mnt/dos/"; #XXX: THIS MUST BE CORRECT TO BUILD! | ||
#export DOS_BUILDS=$DOS_WORKSPACE_ROOT"Builds/"; | ||
export DOS_BUILDS="/mnt/Drive-4/DOS/Builds/"; #XXX: THIS MUST BE CORRECT TO BUILD! | ||
|
@@ -109,6 +111,45 @@ export DOS_THEME_700="E64A19"; #Deep Orange 700 | |
|
||
umask 0022; | ||
|
||
# by default we will calculate the max CPU count automatically (used by e.g. repo commands) | ||
# if the required tool "nproc" is not found a default is used. | ||
export FALLBACK_MAX_THREADS_REPO=4; | ||
export MAX_THREADS_REPO_RATE=8; #to avoid being rate limited we never go above this for syncing | ||
export FALLBACK_MAX_THREADS_BUILD="nolimit"; #if nothing specified we will use all CPU power available | ||
|
||
calcThreads(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is needless complexity There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any needless conplexity here but more flexibility. You might not need it which is ok but i do (and maybe I'm not the only one) ;) That being said I'm fine if you wanna close this pr |
||
unset _MAX_THREADS | ||
DEFAULT_COUNT=$1 | ||
nproc --version > /dev/null 2>&1 | ||
if [ $? -eq 10 ];then | ||
_MAX_THREADS_ALL=$(nproc --all) | ||
_MAX_THREADS=$(( _MAX_THREADS_ALL - 1)) | ||
fi | ||
if [ -z "$_MAX_THREADS" ];then | ||
echo $DEFAULT_COUNT | ||
return 9 | ||
else | ||
echo $_MAX_THREADS | ||
fi | ||
} | ||
export -f calcThreads; | ||
|
||
if [ -z "$DOS_MAX_THREADS_REPO" ];then | ||
export DOS_MAX_THREADS_REPO=$(calcThreads $FALLBACK_MAX_THREADS_REPO) \ | ||
|| echo -e "\e[0;33mWARNING: could not calculate thread count and no user defined amount specified. This could slow down the SYNC processes.\e[0m" | ||
fi | ||
if [ "$DOS_MAX_THREADS_REPO" -gt "$MAX_THREADS_REPO_RATE" ];then | ||
echo -e "\e[0;33mWARNING: Your specified DOS_MAX_THREADS_REPO value ($DOS_MAX_THREADS_REPO) could raise rate limits so has been decreased to >$MAX_THREADS_REPO_RATE<.\e[0m" | ||
export DOS_MAX_THREADS_REPO=$MAX_THREADS_REPO_RATE | ||
fi | ||
if [ -z "$DOS_MAX_THREADS_BUILD" ];then | ||
export DOS_MAX_THREADS_BUILD=$(calcThreads $FALLBACK_MAX_THREADS_BUILD)\ | ||
|| echo -e "\e[0;33mWARNING: could not calculate thread count and no user defined amount specified. This could slow down the BUILD processes.\e[0m" | ||
fi | ||
echo "Activated CPU count (sync): $DOS_MAX_THREADS_REPO" | ||
echo "Activated CPU count (build): $DOS_MAX_THREADS_BUILD" | ||
[ "$DOS_MAX_THREADS_BUILD" == "nolimit" ] && export DOS_MAX_THREADS_BUILD="" #actually means "all" when empty | ||
|
||
gpgVerifyGitHead() { | ||
if [ -r "$DOS_TMP_GNUPG/pubring.kbx" ]; then | ||
if git -C "$1" verify-commit HEAD &>/dev/null; then | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using too many threads on sync will get you rate limited by google and temporarily blocked
using many threads on reset may cause thrashing, and already completes quickly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why there's a max allowed value which avoids being rate limited. It uses your current used value.
Again this is more to limit (e.g using 1 helps for debug but using other values can help speeding up the process - yes even for reset)