basalt/scripts/batch/run-one.sh
Nikolaus Demmel 24325f2a06 ICCV'21 square root marginalization paper code release
Major changes:

- New square-root implementation for optimization and
  marginalization, giving faster optimization and numerically
  more stable marginalization. The square root solver is the new
  default, but the Schur complement based implementation is still
  available. (Implements the ICCV'21 paper.)

- The odometry estimator is now fully templetized and you can run
  in float or double. Default is float, which works well with the
  new square-root implementation and gives best runtimes.

- Batch evaluation scripts and documentation to reproduce the
  ICCV'21 experiments.

Additional changes:

- New options in VIO to marginalize lost landmark right away and
  not only when the frame is marginalized (enabled by default).

- small bugfix for keypoint patch extraction bounds

- basalt_vio: more logging for batch evaluation

- basalt_vio: better handling of closing the GUI while estimator is still running

- basalt_vio: new command line argument to limit the number of frames processed

- basalt_vio: new command line argument to save ground truth trajectory

- added unit tests for square root marginalization

- update basalt-headers

- new submodules: gmt, nlohmann/json, magic_enum
2021-10-15 15:09:15 +02:00

84 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
##
## BSD 3-Clause License
##
## This file is part of the Basalt project.
## https://gitlab.com/VladyslavUsenko/basalt.git
##
## Copyright (c) 2019-2021, Vladyslav Usenko and Nikolaus Demmel.
## All rights reserved.
##
#
# This script runs on the slurm nodes to run rootba for one config.
set -e
set -o pipefail
set -x
error() {
local parent_lineno="$1"
local message="$2"
local code="${3:-1}"
if [[ -n "$message" ]] ; then
echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}"
else
echo "Error on or near line ${parent_lineno}; exiting with status ${code}"
fi
echo "Failed" >> status.log
exit "${code}"
}
trap 'error ${LINENO}' ERR
# number of logical cores on linux and macos
NUM_CORES=`(which nproc > /dev/null && nproc) || sysctl -n hw.logicalcpu || echo 1`
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BASALT_BIN_DIR="${BASALT_BIN_DIR:-$SCRIPT_DIR/../../build}"
FOLDER="${1}"
cd "$FOLDER"
if ! which time 2> /dev/null; then
echo "Did not find 'time' executable. Not installed?"
exit 1
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
TIMECMD="`which time` -lp"
else
TIMECMD="`which time` -v"
fi
echo "Started" >> status.log
# set environment variables according to config
while read l; do
if [ -n "$l" ]; then
eval "export $l"
fi
done <<< `"$SCRIPT_DIR"/query-config.py basalt_config.json batch_run.env --format-env`
# lookup executable to run
EXECUTABLE=`"$SCRIPT_DIR"/query-config.py basalt_config.json batch_run.executable basalt_vio`
# lookup args
ARGS=`"$SCRIPT_DIR"/query-config.py basalt_config.json batch_run.args --format-cli`
CMD="$BASALT_BIN_DIR/$EXECUTABLE"
echo "Running on '`hostname`', nproc: $NUM_CORES, bin: $CMD"
# run as many times as specified (for timing tests to make sure filecache is hot); default is once
rm -f output.log
NUM_RUNS=`"$SCRIPT_DIR"/query-config.py basalt_config.json batch_run.num_runs 1`
echo "Will run $NUM_RUNS times."
for i in $(seq $NUM_RUNS); do
echo ">>> Run $i" |& tee -a output.log
{ $TIMECMD "$CMD" $ARGS; } |& tee -a output.log
done
echo "Completed" >> status.log