Skip to content
Merged
Changes from 1 commit
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
17 changes: 16 additions & 1 deletion noir-projects/noir-contracts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,23 @@ function on_exit() {
trap on_exit EXIT
mkdir -p $tmp_dir

function get_hardware_memory {
local os=$(uname -s)
local total_mem_gb=64 # Default to 64GB

if [[ "$os" == "Darwin" ]]; then
total_mem_bytes=$(sysctl -n hw.memsize)
total_mem_gb=$((total_mem_bytes / 1024 / 1024 / 1024))
elif [[ "$os" == "Linux" ]]; then
total_mem_gb=$(free -g | awk '/^Mem:/ {print $2}')
fi

echo $(( total_mem_gb < 64 ? total_mem_gb : 64 ))

@Maddiaa0 Maddiaa0 Mar 3, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min(total_mem_gb, 64)

}

hardware_memory=$(get_hardware_memory)
# Set common flags for parallel.
export PARALLEL_FLAGS="-j${PARALLELISM:-16} --halt now,fail=1 --memsuspend ${MEMSUSPEND:-64G}"
export PARALLEL_FLAGS="-j${PARALLELISM:-16} --halt now,fail=1 --memsuspend ${MEMSUSPEND:-${hardware_memory}G}"

# This computes a vk and adds it to the input function json if it's private, else returns same input.
# stdin has the function json.
Expand Down