From dc2d42675958c7e9541770f125ef8e93c370b0b0 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 28 Apr 2023 10:55:19 -0400 Subject: [PATCH] Add feature to run in different directory --- benchmarks/bench.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/benchmarks/bench.sh b/benchmarks/bench.sh index 7158e0eba8f43..8291ad462ef41 100755 --- a/benchmarks/bench.sh +++ b/benchmarks/bench.sh @@ -30,8 +30,9 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Set Defaults COMMAND=data BENCHMARK=all +DATAFUSION_DIR=${DATAFUSION_DIR:-$SCRIPT_DIR/..} DATA_DIR=${DATA_DIR:-$SCRIPT_DIR/data} -BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) +BRANCH_NAME=$(cd ${DATAFUSION_DIR} && git rev-parse --abbrev-ref HEAD) BRANCH_NAME=${BRANCH_NAME//\//_} # mind blowing syntax to replace / with _ RESULTS_DIR=${RESULTS_DIR:-"$SCRIPT_DIR/results/$BRANCH_NAME"} #CARGO_COMMAND=$CARGO_COMMAND:"cargo run --release"} @@ -49,7 +50,11 @@ Usage: $0 [benchmark] Examples: ********** -./bench.sh gen # Create the datasets for all benchmarks in $DATA_DIR +# Create the datasets for all benchmarks in $DATA_DIR +./bench.sh data + +# Run the 'tpch' benchmark on the datafusion checkout in /source/arrow-datafusion +DATAFASION_DIR=/source/arrow-datafusion ./bench.sh run tpch ********** * Commands @@ -118,6 +123,7 @@ main() { echo "DataFusion Benchmark Script" echo "COMMAND: ${COMMAND}" echo "BENCHMARK: ${BENCHMARK}" + echo "DATAFUSION_DIR: ${DATAFUSION_DIR}" echo "BRACH_NAME: ${BRANCH_NAME}" echo "DATA_DIR: ${DATA_DIR}" echo "RESULTS_DIR: ${RESULTS_DIR}" @@ -145,6 +151,8 @@ main() { esac ;; run) + # navigate to the appropriate checkout + pushd "${DATAFUSION_DIR}/benchmarks" mkdir -p "${RESULTS_DIR}" case "$BENCHMARK" in all) @@ -161,6 +169,7 @@ main() { usage ;; esac + popd "${DATAFUSION_DIR}/benchmarks" ;; *) echo "Error: unknown command: $COMMAND"