File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,29 @@ REPO_ROOT="${CURR_DIR}/.."
49
49
TFHE_BUILD_DIR=" ${REPO_ROOT} /tfhe/build/"
50
50
CPU_COUNT=" $( " ${CURR_DIR} " /cpu_count.sh) "
51
51
52
+
53
+
54
+ LINKING_CPU_COUNT=4
55
+
56
+ # On linux
57
+ if [[ $( uname) != " Darwin" ]]; then
58
+ mem_in_gb=" $( free -g | awk ' /Mem:/ {print $2}' ) "
59
+
60
+ # If there is more than 100GB on the system,
61
+ # use all available cores for linking
62
+ # Otherwise, only use 4, to avoid OOM when linking
63
+ if [ 100 -lt " $mem_in_gb " ]; then
64
+ LINKING_CPU_COUNT=" $( CPU_COUNT) "
65
+ fi
66
+ fi
67
+
52
68
mkdir -p " ${TFHE_BUILD_DIR} "
53
69
54
70
cd " ${TFHE_BUILD_DIR} "
55
71
56
72
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DCARGO_PROFILE=" ${CARGO_PROFILE} " -DWITH_FEATURE_GPU=" ${WITH_FEATURE_GPU} "
57
73
58
- make -j " ${CPU_COUNT } "
74
+ make -j " ${LINKING_CPU_COUNT } "
59
75
60
76
if [[ " ${BUILD_ONLY} " == " 1" ]]; then
61
77
exit 0
You can’t perform that action at this time.
0 commit comments