Skip to content

Commit f83abed

Browse files
committed
torch: reduce parallel build process
1 parent 22638d6 commit f83abed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

torch-build-env.file

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ fi
1818
export USE_CUDNN=OFF
1919
%endif
2020

21-
export MAX_JOBS=%compiling_processes
21+
MEM_GB=$(/usr/bin/free -g | awk '/^Mem:/{print $2}')
22+
MAX_JOBS=$(( MEM_GB / 4 ))
23+
if [ $MAX_JOBS -gt %{compiling_processes} ] ; then MAX_JOBS=%{compiling_processes}; fi
24+
if [ $MAX_JOBS -lt 1 ]; then MAX_JOBS=1; fi
25+
export MAX_JOBS
2226
export GCC_ROOT=${GCC_ROOT}
2327
export LibLZMA_ROOT=${XZ_ROOT}
2428
export USE_SYSTEM_PSIMD=ON

0 commit comments

Comments
 (0)