chore: import upstream snapshot with attribution
Lint / lint (push) Has been cancelled
CI / MacOS (push) Has been cancelled
CI / Windows (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:36:25 +08:00
commit 26446540fa
3151 changed files with 974126 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Install the AArch64 Architecture Envelope Model (AEM)
set -e
set -u
set -o pipefail
tmpdir=$(mktemp -d)
cleanup()
{
rm -rf "$tmpdir"
}
trap cleanup 0
pushd "$tmpdir"
# Install GCC toolchain
gcc_install_dir="/opt/arm/gcc-aarch64-none-elf"
gcc_url="https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-elf.tar.xz?rev=28d5199f6db34e5980aae1062e5a6703&hash=D87D4B558F0A2247B255BA15C32A94A9F354E6A8"
gcc_sha="7fe7b8548258f079d6ce9be9144d2a10bd2bf93b551dafbf20fe7f2e44e014b8"
gcc_tar="arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz"
mkdir -p $gcc_install_dir
download-and-verify "$gcc_url" "$gcc_tar" sha256 "$gcc_sha" 64
tar -xf $gcc_tar -C $gcc_install_dir --strip-components=1
# Download FVP
fvp_dir="/opt/arm/fvp"
fvp_url="https://developer.arm.com/-/media/Files/downloads/ecosystem-models/FVP_Base_RevC-2xAEMvA_11.24_11_Linux64.tgz"
fvp_sha="0f132334834cbc66889a62dd72057c976d7c7dfcfeec21799e9c78fb2ce24720"
download-and-verify "$fvp_url" "fvp.tgz" sha256 "$fvp_sha" 64
mkdir -p "$fvp_dir"
tar -xzf fvp.tgz -C "$fvp_dir"
rm -rf doc # Remove some documentation bundled with the package
popd
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
CMAKE_VERSION="3.31.11"
CMAKE_SHA256_X86_64="d815c10cf54e8e122088b3bb25ea6b4010fb96b7ad6e1ad3fdef75be3d996b0b"
CMAKE_SHA256_AARCH64="faef5420c3853d0e10a3862a0d3c71b40ffc2de36fc0ef0bcc5c896cf18f240f"
case "$(uname -m)" in
x86_64)
CMAKE_ARCH="x86_64"
CMAKE_SHA256="$CMAKE_SHA256_X86_64"
;;
aarch64|arm64)
CMAKE_ARCH="aarch64"
CMAKE_SHA256="$CMAKE_SHA256_AARCH64"
;;
*)
echo "Unsupported architecture: $(uname -m)"
exit 1
;;
esac
v=$(echo "$CMAKE_VERSION" | sed 's/\(.*\)\..*/\1/g')
CMAKE_PKG="cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH}.tar.gz"
CMAKE_URL="https://cmake.org/files/v${v}/${CMAKE_PKG}"
TMP_DIR=$(mktemp -d)
cleanup() {
rm -rf "$TMP_DIR"
}
trap cleanup 0
echo "Installing cmake ${CMAKE_VERSION} (${CMAKE_ARCH})"
pushd "$TMP_DIR"
download-and-verify "$CMAKE_URL" "$CMAKE_PKG" sha256 "$CMAKE_SHA256"
mkdir -p /opt/cmake
tar -xzf "$CMAKE_PKG" -C /opt/cmake
CMAKE_DIR="/opt/cmake/cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH}"
ln -sf "${CMAKE_DIR}/bin/cmake" /usr/local/bin/cmake
ln -sf "${CMAKE_DIR}/bin/ctest" /usr/local/bin/ctest
ln -sf "${CMAKE_DIR}/bin/cpack" /usr/local/bin/cpack
popd
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
# Used for debugging RVM build
set -x
set -o pipefail
# install libraries for building c++ core on ubuntu
apt-get update && apt-install-and-clear -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
g++ \
gdb \
git \
gnupg \
graphviz \
libcurl4-openssl-dev \
libopenblas-dev \
libssl-dev \
libncurses-dev \
libz-dev \
lsb-release \
make \
ninja-build \
parallel \
pkg-config \
sudo \
unzip \
wget \
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
uv pip install coremltools==8.3.0
@@ -0,0 +1,23 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
uv pip install cuda-python==12.9.4
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
uv pip install dgl==v1.0.0 -f https://data.dgl.ai/wheels/repo.html
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
tmpdir=$(mktemp -d)
cleanup()
{
rm -rf "${tmpdir}"
}
trap cleanup 0
rls_tag="v2.6"
dnnl_ver=`echo ${rls_tag} | sed 's/v//g'`
echo "Using oneDNN release version ${dnnl_ver} with tag '${rls_tag}'"
archive_name="${rls_tag}.tar.gz"
archive_url="https://github.com/oneapi-src/oneDNN/archive/refs/tags/${archive_name}"
archive_folder="${tmpdir}/oneDNN-${dnnl_ver}"
archive_hash="4cb7b80bfe16920bc096e18e7d8caa56b9ab7a4dab2a091a230bcf562c09533392f4a4ccd4db22754a10293670efdea20382db0994dc47949005a4c77f14b64c"
cd "${tmpdir}"
download-and-verify "${archive_url}" "${archive_name}" sha512 "${archive_hash}"
tar xf "${archive_name}"
cd "${archive_folder}"
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib
cmake --build . --parallel "$(( $(nproc) - 1 ))"
cmake --install .
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
cd /
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 4.0.23
./emsdk activate 4.0.23
+59
View File
@@ -0,0 +1,59 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
if [ $# -eq 0 ]; then
tmpdir=$(mktemp -d)
cleanup()
{
rm -rf "$tmpdir"
}
trap cleanup 0
else
tmpdir=$1
mkdir -p "$tmpdir"
fi
# GoogleTest uses a Live-at-Head philosophy:
# https://github.com/google/googletest#live-at-head
# therefore we need to grab a specific hash and update it
# periodically to match the head of the repo
repo_url="https://github.com/google/googletest"
repo_revision="830fb567285c63ab5b5873e2e8b02f2249864916"
archive_name="${repo_revision}.tar.gz"
archive_url="${repo_url}/archive/${archive_name}"
archive_hash="10f10ed771efc64a1d8234a7e4801838a468f8990e5d6d8fcf63e89f8d1455c4f9c5adc0bb829669f381609a9abf84e4c91a7fdd7404630f375f38fb485ef0eb"
cd "$tmpdir"
download-and-verify "${archive_url}" "${archive_name}" sha512 "${archive_hash}"
tar xf "${archive_name}" --strip-components=1
mkdir build
cd build
# CMake doesn't search /usr/local/lib/<arch> properly for GoogleTest
# so we use /usr/lib where it does search
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib ..
cmake --build . --target install
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -o errexit -o nounset
set -o pipefail
apt-get update
apt-install-and-clear -y openjdk-17-jdk maven
arch=$(uname -m)
jre_arch="unknown"
case $arch in
'x86_64')
jre_arch="amd64"
;;
'aarch64')
jre_arch="arm64"
;;
default)
echo "Unknown architecture $arch" >&2
exit 1
;;
esac
if [ ! -d "/usr/lib/jvm/java-17-openjdk-$jre_arch" ]; then
echo "error: missing openjdk for $jre_arch" >&2
exit 1
fi
echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$jre_arch" >> /etc/profile
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
# Install jax and jaxlib
if [ "$1" == "cuda" ]; then
uv pip install --upgrade \
jaxlib~=0.4.9 \
"jax[cuda11_pip]~=0.4.9" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
else
uv pip install --upgrade \
jaxlib~=0.4.9 \
"jax[cpu]~=0.4.9"
fi
# Install flax
uv pip install flax~=0.6.9
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
LIBTORCH_VERSION="2.0.0"
LIBTORCH_ARCHIVE="libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip"
LIBTORCH_URL="https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}%2Bcpu.zip"
LIBTORCH_SHA256="2d67cff381186f2a01140348d2da7ab35d2e526c5703f4a8312c9428bef6df88"
TMP_DIR="$(mktemp -d)"
cleanup() {
rm -rf "${TMP_DIR}"
}
trap cleanup 0
download-and-verify "${LIBTORCH_URL}" "${TMP_DIR}/${LIBTORCH_ARCHIVE}" sha256 "${LIBTORCH_SHA256}"
unzip -d /usr/local "${TMP_DIR}/${LIBTORCH_ARCHIVE}"
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
apt-get update && apt-install-and-clear -y \
llvm-15 llvm-16 llvm-17\
clang-15 libclang-15-dev libpolly-15-dev \
clang-16 libclang-16-dev libpolly-16-dev \
clang-17 libclang-17-dev libpolly-17-dev libzstd-dev
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
uv pip install \
nnef==1.0.8
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
mkdir -p /usr/share/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /usr/share/keyrings/nodesource.gpg
echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main' \
> /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-install-and-clear -y nodejs
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
# Get the Python version
PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
# Set default value for first argument
DEVICE=${1:-cpu}
# Install the onnx package
uv pip install \
onnx==1.20.1 \
onnxruntime==1.23.2 \
onnxoptimizer==0.4.2
if [ "$DEVICE" == "cuda" ]; then
uv pip install \
torch==2.10.0 \
torchvision==0.25.0
else
uv pip install \
torch==2.10.0 \
torchvision==0.25.0 \
--extra-index-url https://download.pytorch.org/whl/cpu
fi
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
# Install OpenCL runtime in nvidia docker.
apt-get update && apt-install-and-clear -y --no-install-recommends \
ocl-icd-opencl-dev \
clinfo
mkdir -p /etc/OpenCL/vendors && \
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
+76
View File
@@ -0,0 +1,76 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
set -x
if [ -z "${TVM_VENV+x}" ]; then
echo "ERROR: expect TVM_VENV env var to be set"
exit 2
fi
if [ "$#" -lt 1 ]; then
echo "Usage: docker/install/ubuntu_install_python.sh <PYTHON_VERSION>"
exit -1
fi
PYTHON_VERSION=$1
# Install base dependencies required by this script.
apt-get update
apt-install-and-clear -y acl
# Install managed Python to a shared location so both root and the CI runtime user can use it.
UV_PYTHON_INSTALL_DIR=${UV_PYTHON_INSTALL_DIR:-/opt/uv/python}
export UV_PYTHON_INSTALL_DIR
export UV_MANAGED_PYTHON=${UV_MANAGED_PYTHON:-1}
mkdir -p "${UV_PYTHON_INSTALL_DIR}"
chmod 755 "${UV_PYTHON_INSTALL_DIR}"
uv python install "${PYTHON_VERSION}"
# Allow disabling user site-packages, even with sudo; this makes it harder to repro CI failures
# locally because it's hard to tell what might be in this directory.
echo "Defaults env_keep += \"PYTHONNOUSERSITE\"" >/etc/sudoers.d/91-preserve-python-nousersite
export PYTHONNOUSERSITE=1
venv_dir="$(dirname "${TVM_VENV}")"
mkdir -p "${venv_dir}"
uv venv --python "${PYTHON_VERSION}" "${TVM_VENV}"
# NOTE: Only in python3.9 does venv guarantee it creates the python3.X binary.
# This is needed so that CMake's find_package(PythonInterp) works inside the venv.
# See https://bugs.python.org/issue39656
if [ ! -e "${TVM_VENV}/bin/python${PYTHON_VERSION}" ]; then
ln -s "${TVM_VENV}/bin/python" "${TVM_VENV}/bin/python${PYTHON_VERSION}"
fi
addgroup tvm-venv || true
chgrp -R tvm-venv "${TVM_VENV}"
setfacl -R -d -m group:tvm-venv:rwx "${TVM_VENV}"
setfacl -R -m group:tvm-venv:rwx "${TVM_VENV}"
# Prevent further use of pip3 via the system.
# There may be multiple (i.e. from python3-pip apt package and pip3 install -U).
while command -v pip3 >/dev/null 2>&1; do
rm -f "$(command -v pip3)"
done
while command -v pip >/dev/null 2>&1; do
rm -f "$(command -v pip)"
done
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
# install libraries for python package on ubuntu
uv pip install --upgrade \
"Pygments~=2.19" \
"cloudpickle~=3.1" \
"cython~=3.0" \
"mypy~=1.15" \
numpy==1.26.* \
"orderedset~=2.0" \
"packaging~=25.0" \
Pillow==12.1.1 \
"psutil~=7.0" \
"pytest~=8.3" \
"pytest-xdist~=3.6" \
pytest-rerunfailures==16.1 \
"requests~=2.32" \
"scipy~=1.13" \
"Jinja2~=3.1" \
"six~=1.17" \
"tornado~=6.4" \
"ml_dtypes~=0.5" \
z3-static==4.16.0.post1
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
# Install ROCm cross compilation toolchain.
wget -qO - https://repo.radeon.com/rocm/rocm.gpg.key \
| gpg --dearmor -o /usr/share/keyrings/rocm.gpg
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.4.4 noble main' \
> /etc/apt/sources.list.d/rocm.list
apt-get update && apt-install-and-clear -y \
rocm-dev6.4.4 \
lld-15
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
workdir="$(mktemp -d)"
cleanup()
{
rm -rf "$workdir"
}
trap cleanup 0
SCCACHE_VERSION="v0.14.0"
SCCACHE_BASE_URL="https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}"
arch="$(uname -m)"
case "${arch}" in
x86_64)
target="x86_64-unknown-linux-musl"
expected_sha256="8424b38cda4ecce616a1557d81328f3d7c96503a171eab79942fad618b42af44"
;;
aarch64|arm64)
target="aarch64-unknown-linux-musl"
expected_sha256="62a6c942c47c93333bc0174704800cef7edfa0416d08e1356c1d3e39f0b462f2"
;;
*)
echo "Unsupported architecture '${arch}' for prebuilt sccache ${SCCACHE_VERSION}" >&2
exit 1
;;
esac
archive="sccache-${SCCACHE_VERSION}-${target}.tar.gz"
download-and-verify "${SCCACHE_BASE_URL}/${archive}" "${workdir}/${archive}" sha256 "${expected_sha256}"
tar -xzf "${workdir}/${archive}" -C "${workdir}"
mkdir -p /opt/sccache
install -m 0755 "${workdir}/sccache-${SCCACHE_VERSION}-${target}/sccache" /opt/sccache/sccache
# The docs specifically recommend hard links: https://github.com/mozilla/sccache#known-caveats
ln -f /opt/sccache/sccache /opt/sccache/cc
ln -f /opt/sccache/sccache /opt/sccache/c++
# Only add clang if it's on the PATH
if command -v clang >/dev/null 2>&1
then
ln -f /opt/sccache/sccache /opt/sccache/clang
ln -f /opt/sccache/sccache /opt/sccache/clang++
fi
# make sccache usable by all users after install during container build
chmod -R a+rw /opt/sccache
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
uv pip install \
autodocsumm==0.2.14 \
commonmark==0.9.1 \
docutils==0.21.2 \
image==1.5.33 \
matplotlib==3.10.8 \
sphinx==8.1.3 \
sphinx_autodoc_annotation~=1.0 \
sphinx-gallery==0.20.0 \
sphinx-book-theme==1.1.4 \
pydata-sphinx-theme==0.15.4
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
uv pip install tensorflow==2.19.0
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -euxo pipefail
# Build dependencies
apt-install-and-clear -y --no-install-recommends libhdf5-dev
# TensorFlow package versions are aligned with ubuntu_install_tensorflow.sh.
uv pip install \
numpy==1.26.* \
tensorflow==2.19.0
+94
View File
@@ -0,0 +1,94 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -x
set -o pipefail
# The tflite version should have matched versions to the tensorflow
# version installed from pip in ubuntu_install_tensorflow.sh
TENSORFLOW_VERSION=$(python3 -c "import tensorflow; print(tensorflow.__version__)" 2> /dev/null)
# Download, build and install flatbuffers
git clone --branch=v24.3.25 --depth=1 --recursive https://github.com/google/flatbuffers.git
cd flatbuffers
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wno-class-memaccess"
cmake --build . --parallel "$(( $(nproc) - 1 ))"
cmake --install .
cd ..
# Install flatbuffers python packages.
uv pip install flatbuffers==24.3.25
# Build the TFLite static library, necessary for building with TFLite ON.
# The library is built at:
# tensorflow/tensorflow/lite/tools/make/gen/*/lib/libtensorflow-lite.a.
git clone https://github.com/tensorflow/tensorflow --branch=v${TENSORFLOW_VERSION} --depth 1
mkdir -p /opt/tflite
cd /opt/tflite
cmake \
-DTFLITE_ENABLE_XNNPACK=OFF \
/tensorflow/tensorflow/lite
cmake --build . --parallel "$(( $(nproc) - 1 ))"
cd -
# Setup tflite from schema
mkdir tflite
if [ -f tensorflow/tensorflow/compiler/mlir/lite/schema/schema.fbs ] ; then
cp tensorflow/tensorflow/compiler/mlir/lite/schema/schema.fbs tflite
else
cp tensorflow/tensorflow/lite/schema/schema.fbs tflite
fi
cd tflite
flatc --python schema.fbs
cat <<EOM >setup.py
import setuptools
setuptools.setup(
name="tflite",
version="${TENSORFLOW_VERSION}",
author="google",
author_email="google@google.com",
description="TFLite",
long_description="TFLite",
long_description_content_type="text/markdown",
url="https://www.tensorflow.org/lite",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 2",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)
EOM
cat <<EOM >__init__.py
name = "tflite"
EOM
# Install tflite over python3
python3 setup.py install
cd ..
rm -rf tflite
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
git clone https://github.com/stillwater-sc/universal.git /opt/universal
# Use specific versioning tag.
(cd /opt/universal && git checkout e32899d551b53d758865fabd5fdd69eed35bfb0f)
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -u
set -o pipefail
VULKAN_VERSION=1.4.309
UBUNTU_VERSION=noble
wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc \
| gpg --dearmor -o /usr/share/keyrings/lunarg-vulkan.gpg
wget -qO /tmp/lunarg-vulkan.list \
http://packages.lunarg.com/vulkan/${VULKAN_VERSION}/lunarg-vulkan-${VULKAN_VERSION}-${UBUNTU_VERSION}.list
sed -E 's|^deb(-src)? |deb\1 [signed-by=/usr/share/keyrings/lunarg-vulkan.gpg] |' /tmp/lunarg-vulkan.list \
> /etc/apt/sources.list.d/lunarg-vulkan-${VULKAN_VERSION}-${UBUNTU_VERSION}.list
rm -f /tmp/lunarg-vulkan.list
apt-get update
apt-install-and-clear -y vulkan-sdk
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
uv pip install xgboost==3.2.0
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -u
set -o pipefail
export TZ=Etc/UTC
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo $TZ > /etc/timezone