xref: /aosp_15_r20/external/pytorch/.ci/onnx/common.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/bin/bash
2
3set -ex
4
5source "$(dirname "${BASH_SOURCE[0]}")/../pytorch/common_utils.sh"
6
7LOCAL_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
8ROOT_DIR=$(cd "$LOCAL_DIR"/../.. && pwd)
9TEST_DIR="$ROOT_DIR/test"
10pytest_reports_dir="${TEST_DIR}/test-reports/python"
11
12# Figure out which Python to use
13PYTHON="$(which python)"
14if [[ "${BUILD_ENVIRONMENT}" =~ py((2|3)\.?[0-9]?\.?[0-9]?) ]]; then
15  PYTHON=$(which "python${BASH_REMATCH[1]}")
16fi
17
18if [[ "${BUILD_ENVIRONMENT}" == *rocm* ]]; then
19    # HIP_PLATFORM is auto-detected by hipcc; unset to avoid build errors
20    unset HIP_PLATFORM
21fi
22
23mkdir -p "$pytest_reports_dir" || true
24