Commit 44562450 authored by gsell's avatar gsell

Merge branch '75-modbuild-set-number-of-parallel-make-jobs-to-number-of-cores' into 'master'

Resolve "modbuild: set number of parallel make jobs  to number of cores"

Closes #75

See merge request !39
parents 298829c6 46bfc351
......@@ -41,7 +41,32 @@ trap "error_handler" ERR
declare configure_with='undef'
#..............................................................................
# global variables
#
# The following variables are available in build-blocks and set read-only
# :FIXME: do we have to export them?
# install prefix of module.
declare -x PREFIX=''
declare -r OS=$(uname -s)
pbuild::get_num_cores() {
case "${OS}" in
Linux )
echo $(grep -c ^processor /proc/cpuinfo)
;;
Darwin )
echo $(sysctl -n hw.ncpu)
;;
* )
std::die 1 "OS ${OS} is not supported\n"
;;
esac
}
#..............................................................................
# global variables which can be set/overwritten by command line args
declare force_rebuild=''
pbuild.force_rebuild() {
force_rebuild="$1"
......@@ -73,9 +98,13 @@ pbuild.update_modulefiles() {
}
# number of parallel make jobs
declare -i JOBS=3
declare -i JOBS=$(pbuild::get_num_cores)
pbuild.jobs() {
JOBS="$1"
if (( $1 == 0 )); then
JOBS=$(pbuild::get_num_cores)
else
JOBS="$1"
fi
}
declare system=''
......@@ -114,18 +143,6 @@ declare -x module_release=''
# abs. path is "${PREFIX}/${_docdir}/${module_name}"
declare -r _DOCDIR='share/doc'
#..............................................................................
#
# The following variables are available in build-blocks and set read-only
# :FIXME: do we have to export them?
#
# install prefix of module.
declare -x PREFIX=''
declare -r OS=$(uname -s)
##############################################################################
#
# Set flag to build module in source tree.
......
......@@ -140,7 +140,7 @@ declare opt_dry_run='no'
declare opt_enable_cleanup_build='yes'
declare opt_enable_cleanup_src='yes'
declare opt_force_rebuild='no'
declare -i opt_jobs=3
declare -i opt_jobs=0
declare opt_update_modulefiles='no'
declare opt_system=''
declare opt_temp_dir="${PMODULES_TMPDIR:-/var/tmp/${USER}}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment