Hi Andy, On Thu, Nov 3, 2011 at 12:28 AM, Andy Fleming <aflem...@freescale.com> wrote: > The MAKEALL script cleverly runs make with the appropriate options > to use all of the cores on the system, but your average U-Boot build > can't make much use of more than a few cores. If you happen to have > a many-core server, your builds will leave most of the system idle. > > In order to make full use of such a system, we need to build multiple > targets in parallel, and this requires directing make output into > multiple directories. We add a BUILD_NBUILDS variable, which allows > users to specify how many builds to run in parallel. I've found that > 16 is too many on my system (fork starts to fail). When BUILD_NBUILDS > is set greater than 1, we redefine BUILD_DIR for each build to be > ${BUILD_DIR}/${target}. Also, we make "./build" the default BUILD_DIR > when BUILD_NBUILDS is greater than 1. > > Once each build finishes, we run make clean on its directory, to reduce > the footprint, and also remove all .depend files. > > As a result, we are left with a build directory with all of the built > targets still there for use, which means anyone who wanted to use > MAKEALL as part of a test harness can now do so. > > Signed-off-by: Andy Fleming <aflem...@freescale.com> > --- > Inspired by all the MAKEALL improvements, I decided to clean up my old > one for parallel builds. I think this version addresses the concerns > raised last time...
Thanks very much for posting this. The low CPU utilization is something that has bugged me - I get maybe 20% at best. I was thinking about writing a little script which fires off one job as soon as the first complete, and keeps maybe 20 jobs running at once. This patch does most of that, with the limitation that jobs that finish early can leave idle CPU time. With your patch I get at least 70% CPU averaged over the whole MAKEALL, and all the ARM boards build in 5 minutes (with Wolfgang and Daniel Schwierzeck's patches also). The only proviso is that you need to set BUILD_NCPUS to 1 I think - maybe your patch should do that also ? Otherwise I got a load average of 220... If you get back to this sometime the other little wish is that it could perhaps display the output of the build together, perhaps buffering it in a log file first. So instead of: Configuring for imx31_phycore_eet - Board: imx31_phycore, Options: IMX31_PHYCORE_EET Configuring for imx31_phycore_eet - Board: imx31_phycore, Options: IMX31_PHYCORE_EET Configuring for imx31_phycore board... board.c:389: error: 'MACH_TYPE_TIAM335EVM' undeclared (first use in this function) board.c:389: error: (Each undeclared identifier is reported only once board.c:389: error: for each function it appears in.) make[1]: *** [/c/cosarm/buildall/u-boot/build/am335x_evm/arch/arm/lib/board.o] Error 1 make: *** [/c/cosarm/buildall/u-boot/build/am335x_evm/arch/arm/lib/libarm.o] Error 2 arm-none-linux-gnueabi-size: './build/am335x_evm/u-boot': No such file cmd_version.c:29: error: expected ',' or ';' before 'U_BOOT_DATE' text data bss dec hex filename 176792 3144 223300 403236 62724 ./build/ca9x4_ct_vxp/u-boot text data bss dec hex filename 156236 2788 10776 169800 29748 ./build/highbank/u-boot it could do: Configuring for <board1> warnings/errors for board1 size info for board1 Configuring for <board2> warnings/errors for board2 size info for board2 ... Tested-by: Simon Glass <s...@chromium.org> Regards, Simon > > MAKEALL | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- > 1 files changed, 64 insertions(+), 10 deletions(-) > > diff --git a/MAKEALL b/MAKEALL > index 95b7cd3..4583ddb 100755 > --- a/MAKEALL > +++ b/MAKEALL > @@ -31,6 +31,7 @@ usage() > CROSS_COMPILE cross-compiler toolchain prefix (default: "") > MAKEALL_LOGDIR output all logs to here (default: ./LOG/) > BUILD_DIR output build directory (default: ./) > + BUILD_NBUILDS number of parallel targets (default: 1) > > Examples: > - build all Power Architecture boards: > @@ -160,10 +161,23 @@ else > LOG_DIR="LOG" > fi > > +if [ ! "${BUILD_NBUILDS}" ] ; then > + BUILD_NBUILDS="1" > +fi > + > +if [ "$BUILD_NBUILDS" -gt 1 ] ; then > + if [ ! "${BUILD_DIR}" ] ; then > + BUILD_DIR="./build" > + fi > + mkdir -p ${BUILD_DIR}/ERR > +fi > + > if [ ! "${BUILD_DIR}" ] ; then > BUILD_DIR="." > fi > > +OUTPUT_PREFIX="${BUILD_DIR}" > + > [ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1 > > LIST="" > @@ -483,32 +497,52 @@ LIST_sparc="$(boards_by_arch sparc)" > > LIST_nds32="$(boards_by_arch nds32)" > > +CURRENT_COUNT=0 > + > #----------------------------------------------------------------------- > > build_target() { > target=$1 > > + if [ "$BUILD_NBUILDS" -gt 1 ] ; then > + output_dir="${OUTPUT_PREFIX}/${target}" > + mkdir -p ${output_dir} > + else > + output_dir="${OUTPUT_PREFIX}" > + fi > + > + export BUILD_DIR="${output_dir}" > + > ${MAKE} distclean >/dev/null > ${MAKE} -s ${target}_config > > - ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \ > - | tee ${LOG_DIR}/$target.ERR > + ${MAKE} ${JOBS} all \ > + 2>&1 >${LOG_DIR}/$target.MAKELOG | tee ${LOG_DIR}/$target.ERR > > # Check for 'make' errors > if [ ${PIPESTATUS[0]} -ne 0 ] ; then > RC=1 > fi > > - if [ -s ${LOG_DIR}/$target.ERR ] ; then > - ERR_CNT=$((ERR_CNT + 1)) > - ERR_LIST="${ERR_LIST} $target" > + if [ "$BUILD_NBUILDS" -gt 1 ] ; then > + ${MAKE} clean > + find "${output_dir}" -type f -name '*.depend' | xargs rm > + > + if [ -s ${LOG_DIR}/${target}.ERR ] ; then > + touch ${OUTPUT_PREFIX}/ERR/${target} > + else > + rm ${LOG_DIR}/${target}.ERR > + fi > else > - rm ${LOG_DIR}/$target.ERR > + if [ -s ${LOG_DIR}/${target}.ERR ] ; then > + ERR_CNT=$((ERR_CNT + 1)) > + ERR_LIST="${ERR_LIST} $target" > + else > + rm ${LOG_DIR}/${target}.ERR > + fi > fi > > - TOTAL_CNT=$((TOTAL_CNT + 1)) > - > - ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \ > + ${CROSS_COMPILE}size ${output_dir}/u-boot \ > | tee -a ${LOG_DIR}/$target.MAKELOG > } > build_targets() { > @@ -523,7 +557,20 @@ build_targets() { > if [ -n "${list}" ] ; then > build_targets ${list} > else > - build_target ${t} > + if [ "$BUILD_NBUILDS" -gt 1 ] ; then > + build_target ${t} & > + else > + build_target ${t} > + fi > + > + TOTAL_CNT=$((TOTAL_CNT + 1)) > + CURRENT_COUNT=$((CURRENT_COUNT + 1)) > + fi > + > + # Limit number of parallel builds > + if [ ${CURRENT_COUNT} -gt ${BUILD_NBUILDS} ] ; then > + CURRENT_COUNT=0; > + wait; > fi > done > } > @@ -531,6 +578,12 @@ build_targets() { > #----------------------------------------------------------------------- > > print_stats() { > + if [ "$BUILD_NBUILDS" -gt 1 ] ; then > + for file in `ls ${OUTPUT_PREFIX}/ERR/`; do > + ERR_LIST="${ERR_LIST} $file" > + done > + ERR_CNT=`ls -l ${OUTPUT_PREFIX}/ERR/ | wc | awk '{print $1}'` > + fi > echo "" > echo "--------------------- SUMMARY ----------------------------" > echo "Boards compiled: ${TOTAL_CNT}" > @@ -549,3 +602,4 @@ set -- ${SELECTED} "$@" > # run PowerPC by default > [ $# = 0 ] && set -- powerpc > build_targets "$@" > +wait > -- > 1.7.3.4 > > > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot