@@ -22,7 +22,7 @@ _equivalenceDeps() {
2222 cd yosys
2323 # use of no-register flag is required for some compilers,
2424 # e.g., gcc and clang from RHEL8
25- make -j $( nproc ) PREFIX=" ${yosysPrefix} " ABC_ARCHFLAGS=-Wno-register
25+ make -j ${numThreads} PREFIX=" ${yosysPrefix} " ABC_ARCHFLAGS=-Wno-register
2626 make install
2727 ) fi
2828
@@ -33,7 +33,7 @@ _equivalenceDeps() {
3333 git clone --depth=1 -b " ${yosysVersion} " https://github.com/YosysHQ/eqy
3434 cd eqy
3535 export PATH=" ${yosysPrefix} /bin:${PATH} "
36- make -j $( nproc ) PREFIX=" ${eqyPrefix} "
36+ make -j ${numThreads} PREFIX=" ${eqyPrefix} "
3737 make install PREFIX=" ${eqyPrefix} "
3838 )
3939 fi
@@ -45,7 +45,7 @@ _equivalenceDeps() {
4545 git clone --depth=1 -b " ${yosysVersion} " --recursive https://github.com/YosysHQ/sby
4646 cd sby
4747 export PATH=" ${eqyPrefix} /bin:${PATH} "
48- make -j $( nproc ) PREFIX=" ${sbyPrefix} " install
48+ make -j ${numThreads} PREFIX=" ${sbyPrefix} " install
4949 )
5050 fi
5151}
@@ -112,7 +112,7 @@ _installCommonDev() {
112112 tar xf bison-${bisonVersion} .tar.gz
113113 cd bison-${bisonVersion}
114114 ./configure --prefix=${bisonPrefix}
115- make -j install
115+ make -j ${numThreads} install
116116 echo " bison ${bisonVersion} installed (from ${bisonInstalledVersion} )."
117117 else
118118 echo " bison ${bisonVersion} already installed."
@@ -128,8 +128,8 @@ _installCommonDev() {
128128 tar xf flex-${flexVersion} .tar.gz
129129 cd flex-${flexVersion}
130130 ./configure --prefix=${flexPrefix}
131- make -j $( nproc )
132- make -j $( nproc ) install
131+ make -j ${numThreads}
132+ make -j ${numThreads} install
133133 else
134134 echo " Flex already installed."
135135 fi
@@ -154,8 +154,8 @@ _installCommonDev() {
154154 fi
155155 ./autogen.sh
156156 ./configure --prefix=${swigPrefix}
157- make -j $( nproc )
158- make -j $( nproc ) install
157+ make -j ${numThreads}
158+ make -j ${numThreads} install
159159 else
160160 echo " Swig already installed."
161161 fi
@@ -171,7 +171,7 @@ _installCommonDev() {
171171 tar -xf boost_${boostVersionUnderscore} .tar.gz
172172 cd boost_${boostVersionUnderscore}
173173 ./bootstrap.sh --prefix=" ${boostPrefix} "
174- ./b2 install --with-iostreams --with-test --with-serialization --with-system --with-thread -j $( nproc )
174+ ./b2 install --with-iostreams --with-test --with-serialization --with-system --with-thread -j ${numThreads}
175175 else
176176 echo " Boost already installed."
177177 fi
@@ -184,7 +184,7 @@ _installCommonDev() {
184184 git clone --depth=1 -b ${eigenVersion} https://gitlab.com/libeigen/eigen.git
185185 cd eigen
186186 ${cmakePrefix} /bin/cmake -DCMAKE_INSTALL_PREFIX=" ${eigenPrefix} " -B build .
187- ${cmakePrefix} /bin/cmake --build build -j $( nproc ) --target install
187+ ${cmakePrefix} /bin/cmake --build build -j ${numThreads} --target install
188188 else
189189 echo " Eigen already installed."
190190 fi
@@ -198,7 +198,7 @@ _installCommonDev() {
198198 cd cudd
199199 autoreconf
200200 ./configure --prefix=${cuddPrefix}
201- make -j $( nproc ) install
201+ make -j ${numThreads} install
202202 else
203203 echo " Cudd already installed."
204204 fi
@@ -223,7 +223,7 @@ _installCommonDev() {
223223 git clone --depth=1 -b ${lemonVersion} https://github.com/The-OpenROAD-Project/lemon-graph.git
224224 cd lemon-graph
225225 ${cmakePrefix} /bin/cmake -DCMAKE_INSTALL_PREFIX=" ${lemonPrefix} " -B build .
226- ${cmakePrefix} /bin/cmake --build build -j $( nproc ) --target install
226+ ${cmakePrefix} /bin/cmake --build build -j ${numThreads} --target install
227227 else
228228 echo " Lemon already installed."
229229 fi
@@ -240,7 +240,7 @@ _installCommonDev() {
240240 git clone --depth=1 -b " v${spdlogVersion} " https://github.com/gabime/spdlog.git
241241 cd spdlog
242242 ${cmakePrefix} /bin/cmake -DCMAKE_INSTALL_PREFIX=" ${spdlogPrefix} " -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DSPDLOG_BUILD_EXAMPLE=OFF -B build .
243- ${cmakePrefix} /bin/cmake --build build -j $( nproc ) --target install
243+ ${cmakePrefix} /bin/cmake --build build -j ${numThreads} --target install
244244 echo " spdlog ${spdlogVersion} installed (from ${spdlogInstalledVersion} )."
245245 else
246246 echo " spdlog ${spdlogVersion} already installed."
@@ -329,7 +329,7 @@ _installOrTools() {
329329 git clone --depth=1 -b " v${orToolsVersionBig} " https://github.com/google/or-tools.git
330330 cd or-tools
331331 ${cmakePrefix} /bin/cmake -S. -Bbuild -DBUILD_DEPS:BOOL=ON -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_SAMPLES:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX=${orToolsPath} -DCMAKE_CXX_FLAGS=" -w" -DCMAKE_C_FLAGS=" -w"
332- ${cmakePrefix} /bin/cmake --build build --config Release --target install -v -j $( nproc )
332+ ${cmakePrefix} /bin/cmake --build build --config Release --target install -v -j ${numThreads}
333333 else
334334 if [[ $osVersion == rodete ]]; then
335335 osVersion=11
@@ -774,6 +774,9 @@ Usage: $0 -all
774774 $0 -constant-build-dir
775775 # Use constant build directory, instead of
776776 # random one.
777+ $0 -threads=<N> #
778+ # Limit number of compiling threads. Default is
779+ # all available numThreads.
777780
778781EOF
779782 exit " ${1:- 1} "
@@ -786,6 +789,7 @@ isLocal="false"
786789equivalenceDeps=" no"
787790CI=" no"
788791saveDepsPrefixes=" "
792+ numThreads=$( nproc)
789793# temp dir to download and compile
790794baseDir=$( mktemp -d /tmp/DependencyInstaller-XXXXXX)
791795
@@ -862,6 +866,9 @@ while [ "$#" -gt 0 ]; do
862866 -save-deps-prefixes=* )
863867 saveDepsPrefixes=$( realpath ${1# -save-deps-prefixes=} )
864868 ;;
869+ -threads=* )
870+ numThreads=${1}
871+ ;;
865872 * )
866873 echo " unknown option: ${1} " >&2
867874 _help
0 commit comments