From 9cf72b1ffc1dc8f6b3968e86d99f29be90d818ad Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 9 Jan 2013 18:55:50 -0600 Subject: parallelize_build: GNU Parallel script to build all tools This script uses GNU Parallel to build and test all RTEMS target toolsets in parallel. This can keep a server completely saturated for the entire build period. This appears to reduce the build time by at least 75% RTEMS Build Farm servers. --- gcc/parallelize_build | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100755 gcc/parallelize_build diff --git a/gcc/parallelize_build b/gcc/parallelize_build new file mode 100755 index 0000000..5f3b3ed --- /dev/null +++ b/gcc/parallelize_build @@ -0,0 +1,201 @@ +#! /bin/sh +# +# PARALLEL - Test build all the tool configurations +# +# Requires GNU parallel to be installed +# +# TODO: +# + command line for dry-run enable/di +# + specify list of targets to build +# + add ssh support for spreading builds across multiple computers +# + +# Checks the status returned by executables and exits if it is non-zero. +check_fatal() +{ + if [ $1 -eq 0 ] ; then + return + fi + shift + echo "ERROR: $*" >&2 + exit $? +} + +vfile=`dirname $0`/../VERSIONS +if [ ! -r ${vfile} ] ; then + echo VERSIONS file not found + exit 1 +fi + +source ${vfile} + +if [ ! -d ${BASEDIR} ] ; then + echo Have you set the BASEDIR in VERSIONS correctly? + exit 1 +fi + +for d in ${AUTOCONF} ${AUTOMAKE} ${BINUTILSDIR} \ + ${GDBDIR} ${NEWLIBDIR} ${GCCDIR} +do + if [ ! -d ${d} ] ; then + check_fatal 1 "Cannot locate ${d} -- aborting" + fi +done + +toggle() +{ + case $1 in + no) echo "yes" ;; + yes) echo "no" ;; + *) fatal "Unknown value to toggle ($1)" ;; + esac +} + +parallel --version 2>&1 | grep "GNU Parallel" >/dev/null +check_fatal $? "GNU parallel is not installed" + +usage() +{ +cat <${LOGDIR}/bootstrap.log 2>&1 +${SCRIPTDIR}/gcc/do_one -n +cd ${AUTOCONF} && \ + (./configure --prefix=${INSTALL} && make && make install) \ + >${LOGDIR}/autoconf.log 2>&1 +cd ${AUTOMAKE} && \ + (./configure --prefix=${INSTALL} && make && make install) \ + >${LOGDIR}/automake.log 2>&1 +EOF + + status=$? + check_fatal ${status} "*** ${status} steps failed during preparation phase" +fi + +start=`date` + +#### Tool Building +if [ ${do_tools} = "yes" ] ; then + test ${verbose} = "yes" && echo "*** Building Tools" + + args="" + if [ ${do_tests} = "yes" ] ; then + args="${args} -T" + fi + echo " Clean On OK Build: " ${do_cleanOnExit} + if [ ${do_cleanOnExit} = "yes" ] ; then + args="${args} -d" + fi + + parallel --verbose ${JOBS} ${dryrun} <