limit parallelism based on available memory too

This commit is contained in:
Jacob Lifshay 2024-10-15 20:46:37 -07:00
parent aaa2cb193e
commit b54e40561f
Signed by: programmerjake
SSH key fingerprint: SHA256:B1iRVvUJkvd7upMIiMqn6OyxvD2SgJkAH3ZnUOj6z+c
2 changed files with 74 additions and 6 deletions

View file

@ -59,7 +59,7 @@ jobs:
make -C sby install
- run: |
git clone --depth=1 --recursive --branch=0.45 https://github.com/YosysHQ/yosys.git
make -C yosys -j2
make -C yosys -j"$(nproc)"
make -C yosys install
- run: |
wget -O firrtl.tar.gz https://github.com/llvm/circt/releases/download/firtool-1.86.0/firrtl-bin-linux-x64.tar.gz
@ -70,4 +70,12 @@ jobs:
- uses: https://github.com/Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo test
- run: |
avail_mem="$(free -b | awk '/^Mem:/{print($2)}')"
# estimate that each test needs 16GiB
((par_from_mem = avail_mem / (16 << 30)))
par="$(nproc)"
if ((par_from_mem > 0 && par > par_from_mem)); then
par="$par_from_mem"
fi
cargo test -- --test-threads="$par"