abstreet/precompute.sh

47 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
set -e
mkdir -p data/system/maps/
2019-12-03 22:42:02 +03:00
# Need this first
if [ ! -f data/input/popdat.bin ]; then
2019-12-03 22:42:02 +03:00
# We probably don't have this map yet.
if [ ! -f data/system/maps/huge_seattle.bin ]; then
2019-12-03 22:42:02 +03:00
cd precompute;
2019-12-03 23:06:49 +03:00
RUST_BACKTRACE=1 cargo run --release ../data/input/raw_maps/huge_seattle.bin --disable_psrc_scenarios;
2019-12-03 22:42:02 +03:00
cd ..;
fi
cd popdat;
cargo run --release;
cd ..;
fi
release_mode=""
psrc_scenarios=""
no_fixes=""
for arg in "$@"; do
if [ "$arg" == "--release" ]; then
release_mode="--release";
elif [ "$arg" == "--disable_psrc_scenarios" ]; then
psrc_scenarios="--disable_psrc_scenarios";
elif [ "$arg" == "--nofixes" ]; then
no_fixes="--nofixes";
else
# Just recompute a single map.
cd precompute;
2019-12-03 23:06:49 +03:00
RUST_BACKTRACE=1 cargo run $release_mode ../data/input/raw_maps/$arg.bin $psrc_scenarios $no_fixes;
cd ..;
exit;
fi
done
2019-12-03 23:06:49 +03:00
for map_path in `ls data/input/raw_maps/`; do
map=`basename $map_path .bin`;
echo "Precomputing $map";
cd precompute;
2019-12-03 23:06:49 +03:00
RUST_BACKTRACE=1 cargo run $release_mode ../data/input/raw_maps/$map.bin $psrc_scenarios $no_fixes;
cd ..;
done