Skip to content

Instantly share code, notes, and snippets.

@jsquyres
Created September 27, 2017 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsquyres/7a355af36b3afbe756af82a9543105b2 to your computer and use it in GitHub Desktop.
Save jsquyres/7a355af36b3afbe756af82a9543105b2 to your computer and use it in GitHub Desktop.
Jeff's git bisect helper
#!/bin/zsh
#
# Git bisect helper.
#
# 1. Edit the script below to build OMPI how you need it and run the test
# that you need.
#
# 2. Once you have found a starting point for the git bisect, run it
# like this:
#
# git bisect run /path/to/this/script
#
# 3. Sit back and watch git work for you!
#
set -x
# Globals
# Install OMPI to this directory
prefix=$bogus
ompi_src_dir=$HOME/git/ompi-crossover
#################################################################
# Helper subroutines
# Run a command, save the output, and check its exit status
doit() {
file=$1
cmd=$*
shift
echo $* \| tee $file
$* 2>&1 | tee $file
st=$status
if test $st != 0; then
echo RESULT: command fail (status $st)
$DOTFILES/pushover COMMAND FAILED -- skip: $cmd
exit 125
fi
}
# Exit with a 0 status, which tells git bisect that this commit was
# good.
exit_good() {
$DOTFILES/pushover RESULT: good
exit 0
}
# Exit with a 1 status, which tells git bisect that this commit was
# bad.
exit_bad() {
$DOTFILES/pushover RESULT: bad ($1)
exit 1
}
#################################################################
echo "############### `date`"
echo "############### Bisect helper running"
cd $ompi_src_dir
git show --no-patch
# Clean the tree and run autogen
rm -rf build
git clean -dfx > /dev/null
doit auto.out ./autogen.pl
# Do a vpath build
rm -rf build
mkdir build
cd build
# =============================================================================
# JMS EDIT HERE EDIT HERE EDIT HERE EDIT HERE EDIT HERE EDIT HERE EDIT HERE
# Edit to build Open MPI the way you want.
doit config.out ../configure --prefix=$prefix --disable-oshmem --disable-mpi-fortran
# =============================================================================
# Build it
doit make.out make -j 32
# Install it
rm -rf $prefix
make install > /dev/null
# Check that mpirun works at all. If not, skip this hash.
doit mpirun-hostname.out mpirun hostname
# =============================================================================
# JMS EDIT HERE EDIT HERE EDIT HERE EDIT HERE EDIT HERE EDIT HERE EDIT HERE
# Edit to test Open MPI the way you want.
# Do the test that you want to run
# For this test, I know we're inside a SLURM job
cd $ompi_src_dir/examples
make clean all |& tee make.out
# Have another agent running that will kill this test (and make mpirun
# exit with nonzero status) if it consumes too much memory.
date
mpirun --mca btl tcp,vader,self --mca oob tcp --mca pmix_base_async_modex 1 ./ring_c
st=$status
date
# =============================================================================
# If the mpirun failed, this test failed
if test $st -eq 0; then
exit_good
else
exit_bad "mpirun exit status: $st"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment