Skip to content

Commit

Permalink
chore(ci): fix OOM when linking c_api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeul-zama committed Nov 13, 2024
1 parent 6719810 commit e314841
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion scripts/c_api_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,29 @@ REPO_ROOT="${CURR_DIR}/.."
TFHE_BUILD_DIR="${REPO_ROOT}/tfhe/build/"
CPU_COUNT="$("${CURR_DIR}"/cpu_count.sh)"



LINKING_CPU_COUNT=4

# On linux
if [[ $(uname) != "Darwin" ]]; then
mem_in_gb="$(free -g | awk '/Mem:/ {print $2}')"

# If there is more than 100GB on the system,
# use all available cores for linking
# Otherwise, only use 4, to avoid OOM when linking
if [ 100 -lt "$mem_in_gb" ]; then
LINKING_CPU_COUNT="$(CPU_COUNT)"
fi
fi

mkdir -p "${TFHE_BUILD_DIR}"

cd "${TFHE_BUILD_DIR}"

cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DCARGO_PROFILE="${CARGO_PROFILE}" -DWITH_FEATURE_GPU="${WITH_FEATURE_GPU}"

make -j "${CPU_COUNT}"
make -j "${LINKING_CPU_COUNT}"

if [[ "${BUILD_ONLY}" == "1" ]]; then
exit 0
Expand Down

0 comments on commit e314841

Please sign in to comment.