xref: /aosp_15_r20/external/pytorch/.ci/docker/common/install_aotriton.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/bin/bash
2
3set -ex
4
5source "$(dirname "${BASH_SOURCE[0]}")/common_utils.sh"
6
7TARBALL='aotriton.tar.gz'
8# This read command alwasy returns with exit code 1
9read -d "\n" VER MANYLINUX ROCMBASE PINNED_COMMIT SHA256 < aotriton_version.txt || true
10ARCH=$(uname -m)
11AOTRITON_INSTALL_PREFIX="$1"
12AOTRITON_URL="https://github.com/ROCm/aotriton/releases/download/${VER}/aotriton-${VER}-${MANYLINUX}_${ARCH}-${ROCMBASE}-shared.tar.gz"
13
14cd "${AOTRITON_INSTALL_PREFIX}"
15# Must use -L to follow redirects
16curl -L --retry 3 -o "${TARBALL}" "${AOTRITON_URL}"
17ACTUAL_SHA256=$(sha256sum "${TARBALL}" | cut -d " " -f 1)
18if [ "${SHA256}" != "${ACTUAL_SHA256}" ]; then
19  echo -n "Error: The SHA256 of downloaded tarball is ${ACTUAL_SHA256},"
20  echo " which does not match the expected value ${SHA256}."
21  exit
22fi
23tar xf "${TARBALL}" && rm -rf "${TARBALL}"
24