Skip to content

duneswbuildentirestack

tomjunk edited this page Jan 13, 2022 · 6 revisions

Example script to build dunesw

Warning -- this script deletes everything in $DIRECTORY. Only use it to make a fresh start.

#!/bin/sh
COMPILER=e20
DIRECTORY=splitter11
USERNAME=`whoami`
HDIR=/dune/app/users
#HDIR=/build

source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
cd ${HDIR}/${USERNAME}
touch ${DIRECTORY}
rm -rf ${DIRECTORY}
mkdir ${DIRECTORY}
cd ${DIRECTORY}
mrb newDev -q ${COMPILER}:prof
source ${HDIR}/${USERNAME}/${DIRECTORY}/localProducts*/setup
mkdir work
cd srcs

# checks out the develop versions of the split repositories
# use the -t <tag> option to check out a specific tag
# you can use mrb g dune_suite to get all the code below plus duneutil

mrb g dunecore
mrb g duneopdet
mrb g dunesim
mrb g dunecalib
mrb g duneprototypes
mrb g dunedataprep
mrb g dunereco
mrb g duneana
mrb g duneexamples
mrb g protoduneana
mrb g dunesw
mrb uc

cd $MRB_BUILDDIR
mrbsetenv

# build the software stack.  Use -j<n> where n is the number of cores on the machine.
# using <n> too large (such as 16 on a dunegpvm machine), will run the computer out of memory
# the dune build nodes have 16 cores and enough memory to run the build with -j16

mrb i -j16

Example script from Chris Green that builds dunsim, dunesw, protoduneana and duneprototypes

It has better error handling. Note that when a subset of products is checked out and built, all intermediate products in the dependency tree must also be checked out and built.

#!/bin/bash

if (return 0 2>/dev/null); then
  _THIS_SCRIPT_IS_SOURCED=1
else
  unset _THIS_SCRIPT_IS_SOURCED
fi

fail() {
  local status=$?
  echo "FAILED $*" 1>&2
  (( _THIS_SCRIPT_IS_SOURCED )) || exit $status
  return $status
}

CQUAL=e20
MRBTOP=mrb-dune-2022-01-11
WORKDIR=~greenc/work/cet-is/build
BTYPE=prof
QUALS="$CQUAL:$BTYPE"
QUALDIR="${QUALS//:/-}"
PKGS=(dunesim dunesw protoduneana duneprototypes)

source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh || \
  fail "sourcing ${DUNE_SETUP##*/}" || return

cd "$WORKDIR" && \
  rm -rf "$MRBTOP" && \
  mkdir "$MRBTOP" && \
  cd "$MRBTOP" && \
  mrb newDev -q "$QUALS" -T "$QUALDIR" || \
    fail "initializing MRB development area $WORKDIR/$MRBTOP"
source "$WORKDIR/$MRBTOP/$QUALDIR/"localProducts*/setup || \
  fail "sourcing local setup script for $MRBTOP" || return

for pkg in ${PKGS[*]:+"${PKGS[@]}"}; do
  mrb g "$pkg" || fail "checkout for $pkg" || return
done

mrb uc && mrbsetenv || fail "final per-build config for $MRBTOP" || return
 
cd "$MRB_BUILDDIR" || \
  fail "entering MRB build directory $MRB_BUILDDIR" || return

mrb i -j16