Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: build contracts and protocol circuits sequentially if not enough ram #5499

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions noir-projects/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,33 @@ g="\033[32m" # Green
b="\033[34m" # Blue
r="\033[0m" # Reset

((cd "./noir-contracts" && ./bootstrap.sh) > >(awk -v g="$g" -v r="$r" '{print g "contracts: " r $0}')) &
((cd "./noir-protocol-circuits" && ./bootstrap.sh) > >(awk -v b="$b" -v r="$r" '{print b "protocol-circuits: " r $0}')) &
AVAILABLE_MEMORY=0

case "$(uname)" in
Linux*)
# Check available memory on Linux
AVAILABLE_MEMORY=$(awk '/MemFree/ { printf $2 }' /proc/meminfo)
;;
*)
echo "Parallel builds not supported on this operating system"
;;
esac
# This value may be too low.
# If builds fail with an amount of free memory greater than this value then it should be increased.
MIN_PARALLEL_BUILD_MEMORY=32000000

if [[ AVAILABLE_MEMORY -lt MIN_PARALLEL_BUILD_MEMORY ]]; then
echo "System does not have enough memory for parallel builds, falling back to sequential"
./noir-contracts/bootstrap.sh
./noir-protocol-circuits/bootstrap.sh
else
((./noir-contracts/bootstrap.sh) > >(awk -v g="$g" -v r="$r" '{print g "contracts: " r $0}')) &
((./noir-protocol-circuits/bootstrap.sh) > >(awk -v b="$b" -v r="$r" '{print b "protocol-circuits: " r $0}')) &

for job in $(jobs -p); do
wait $job || exit 1
done
fi



for job in $(jobs -p); do
wait $job || exit 1
done
Loading