Skip to content

Commit d8d6228

Browse files
authored
Merge pull request #10174 from cms-sw/torch-max-jobs
torch: reduce parallel build process
2 parents 22638d6 + f8037ac commit d8d6228

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

torch-build-env.file

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ 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
2529
export PSIMD_SOURCE_DIR=${PSIMD_ROOT}
2630
export BUILD_CUSTOM_PROTOBUF=OFF
2731
export USE_SYSTEM_EIGEN_INSTALL=ON
28-
export USE_SYSTEM_PSIMD=ON
2932
export USE_SYSTEM_FXDIV=ON
3033
export USE_SYSTEM_PYBIND11=ON
3134
export PYBIND11_SYSPATH=${PY3_PYBIND11_ROOT}
@@ -50,9 +53,7 @@ export USE_NUMA=ON
5053
export NUMA_ROOT_DIR=${NUMACTL_ROOT}
5154
export USE_NUMPY=OFF
5255
export USE_OPENMP=ON
53-
export USE_QNNPACK=OFF
5456
export USE_VALGRIND=OFF
55-
export USE_XNNPACK=OFF
5657
export USE_MKLDNN=OFF
5758
export USE_DISTRIBUTED=OFF
5859
export USE_MPI=ON

0 commit comments

Comments
 (0)