xref: /aosp_15_r20/external/pytorch/.ci/docker/common/install_magma.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/usr/bin/env bash
2# Script used only in CD pipeline
3
4set -eou pipefail
5
6MAGMA_VERSION="2.5.2"
7
8function do_install() {
9    cuda_version=$1
10    cuda_version_nodot=${1/./}
11
12    MAGMA_VERSION="2.6.1"
13    magma_archive="magma-cuda${cuda_version_nodot}-${MAGMA_VERSION}-1.tar.bz2"
14
15    cuda_dir="/usr/local/cuda-${cuda_version}"
16    (
17        set -x
18        tmp_dir=$(mktemp -d)
19        pushd ${tmp_dir}
20        curl -OLs https://anaconda.org/pytorch/magma-cuda${cuda_version_nodot}/${MAGMA_VERSION}/download/linux-64/${magma_archive}
21        tar -xvf "${magma_archive}"
22        mkdir -p "${cuda_dir}/magma"
23        mv include "${cuda_dir}/magma/include"
24        mv lib "${cuda_dir}/magma/lib"
25        popd
26    )
27}
28
29do_install $1
30