#!/bin/bash

set -euo pipefail

unset PYTHONPATH

workspace="$(bazel info workspace)"
source "$workspace/scripts/shell/zooxrc.sh"

# We should use a same bazel configuration as subsequent bazel commands. Otherwise,
# bazel would drop its in-memory analysis cache and slow down.
bazel_args=("--config=cuda")
case $1 in
    pipedream)
        bazel_args+=("-c" "opt" "--config=kraken")
    ;;
    metrics)
        bazel_args+=("-c" "opt")
    ;;
esac

bazel run ${bazel_args[@]+"${bazel_args[@]}"} //sim:launch -- "$@" --launch_start_time_ns=$(date '+%s%N')
