[rtems-testing commit] bit_rtems - Determine make parallel jobs dynamically

Joel Sherrill joel at rtems.org
Tue May 15 21:05:16 UTC 2012


Module:    rtems-testing
Branch:    master
Commit:    8e204906d4d896b994ef9c2064c068a048d07179
Changeset: http://git.rtems.org/rtems-testing/commit/?id=8e204906d4d896b994ef9c2064c068a048d07179

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Tue May 15 15:51:44 2012 -0500

bit_rtems - Determine make parallel jobs dynamically

Use 1.5 * number of CPU cores + 1. If the getconf fails,
assume the machine has 2 cores for a minimum of -j3.
On a 4 core machine, this yields a -j7.

The -j factor is not intended to be nice but to maximize
the use of the machine.

---

 rtems/bit_rtems |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/rtems/bit_rtems b/rtems/bit_rtems
index a3c03dd..d1f9b99 100755
--- a/rtems/bit_rtems
+++ b/rtems/bit_rtems
@@ -383,16 +383,24 @@ if [ ${BUILD_RTEMS_DEBUG} = "yes" ] ; then
  MAKE_DEBUG_ARG="VARIANT=DEBUG"
 fi
 
+# Calculate number of jobs as 1.5*ncpus + 1
+ncpus=`/usr/bin/getconf _NPROCESSORS_ONLN 2>/dev/null`
+if [ $? -ne 0 ] ; then
+  ncpus=2
+fi
+njobs=`expr ${ncpus} / 2 + 1 + ${ncpus}`
+echo "Using make ${njobs} parallel jobs"
+
 case ${BSP_TO_TEST} in
   multilib)
      echo "Executing ${MAKE} ${MAKE_DEBUG_ARG} ..."
-     ${MAKE} -j8 RTEMS_BSP= ${MAKE_DEBUG_ARG}
+     ${MAKE} -j${njobs} RTEMS_BSP= ${MAKE_DEBUG_ARG}
      check_fatal $? "failed ${MAKE} ${MAKE_DEBUG_ARG}."
      BSP_TO_TEST=
      ;;
   *)
      echo "Executing ${MAKE} ${MAKE_DEBUG_ARG} ..."
-     ${MAKE} -j8 RTEMS_BSP=${BSP_TO_TEST} ${MAKE_DEBUG_ARG}
+     ${MAKE} -j${njobs} RTEMS_BSP=${BSP_TO_TEST} ${MAKE_DEBUG_ARG}
      check_fatal $? "failed ${MAKE} ${MAKE_DEBUG_ARG}."
      ;;
 esac
@@ -439,7 +447,7 @@ case ${BSP_ARG} in
      check_fatal $? "Unable to configure BSP step successfully"
 
      echo "Executing multilib BSP: ${MAKE} ${MAKE_DEBUG_ARG} ..."
-     ${MAKE} -k -j8 ${MAKE_DEBUG_ARG}
+     ${MAKE} -k -j${njobs} ${MAKE_DEBUG_ARG}
      status=$?
 
      # clean up install point




More information about the vc mailing list