Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM quay.io/pypa/manylinux_2_28_x86_64:2025.08.02-1 AS builder
ARG CUDA_VERSION
COPY install_cuda.sh /tmp/
RUN dnf --setopt=install_weak_deps=False install -y aria2
RUN bash /tmp/install_cuda.sh ${CUDA_VERSION}

FROM quay.io/pypa/manylinux_2_28_x86_64:2025.08.02-1
ARG CUDA_VERSION
COPY --from=builder /usr/local/cuda-${CUDA_VERSION} /usr/local/cuda-${CUDA_VERSION}
# The base image comes with gcc 14. However, NVIDIA officially supports:
# GCC<=15 for CUDA 13.0
# GCC<=14 for CUDA 12.9
# GCC<=14 for CUDA 12.8
# GCC<=13 for CUDA 12.6
# GCC<=13 for CUDA 12.4
# GCC<=12 for CUDA 12.1
# GCC<=11 for CUDA 11.8
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#host-compiler-support-policy
RUN dnf --setopt=install_weak_deps=False install -y gcc-toolset-11-toolchain
ENV PATH=/opt/rh/gcc-toolset-11/root/usr/bin:/usr/local/cuda-${CUDA_VERSION}/bin:${PATH}
ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-11/root/usr/lib64:/opt/rh/gcc-toolset-11/root/usr/lib:/usr/local/cuda-${CUDA_VERSION}/lib64:${LD_LIBRARY_PATH}
40 changes: 40 additions & 0 deletions .github/workflows/docker/install_cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -ex

CUDA_VERSION="${1:?Specify cuda version, e.g. 12.9}"

# See https://developer.nvidia.com/cuda-toolkit-archive
if [ "$CUDA_VERSION" == "13.0" ]; then
URL=https://developer.download.nvidia.com/compute/cuda/13.0.0/local_installers/cuda-repo-rhel8-13-0-local-13.0.0_580.65.06-1.x86_64.rpm
PACKAGE_NAME=cuda-toolkit-13-0
elif [ "$CUDA_VERSION" == "12.9" ]; then
URL=https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda-repo-rhel8-12-9-local-12.9.1_575.57.08-1.x86_64.rpm
PACKAGE_NAME=cuda-toolkit-12-9
elif [ "$CUDA_VERSION" == "12.8" ]; then
URL=https://developer.download.nvidia.com/compute/cuda/12.8.1/local_installers/cuda-repo-rhel8-12-8-local-12.8.1_570.124.06-1.x86_64.rpm
PACKAGE_NAME=cuda-toolkit-12-8
elif [ "$CUDA_VERSION" == "12.6" ]; then
URL=https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda-repo-rhel8-12-6-local-12.6.3_560.35.05-1.x86_64.rpm
PACKAGE_NAME=cuda-toolkit-12-6
elif [ "$CUDA_VERSION" == "12.4" ]; then
URL=https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda-repo-rhel8-12-4-local-12.4.1_550.54.15-1.x86_64.rpm
PACKAGE_NAME=cuda-toolkit-12-4
elif [ "$CUDA_VERSION" == "12.1" ]; then
URL=https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda-repo-rhel8-12-1-local-12.1.1_530.30.02-1.x86_64.rpm
PACKAGE_NAME=cuda
elif [ "$CUDA_VERSION" == "11.8" ]; then
URL=https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-rhel8-11-8-local-11.8.0_520.61.05-1.x86_64.rpm
PACKAGE_NAME=cuda
elif [ "$CUDA_VERSION" == "cpu" ]; then
echo "No need to install CUDA"
else
echo "Invalid CUDA version: $CUDA_VERSION"
exit 1
fi

echo "Installing CUDA version: $CUDA_VERSION"
# aria2c $URL -o /tmp/cuda.rpm
aria2c -x 16 -s 16 -k 1M --file-allocation=none "$URL" -o /tmp/cuda.rpm
rpm -i /tmp/cuda.rpm
dnf clean all
dnf --setopt=install_weak_deps=False -y install $PACKAGE_NAME
Loading