Skip to content
Open
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
58 changes: 32 additions & 26 deletions sle15/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,69 +1,73 @@
ARG SLES_VERSION
FROM nvcr.io/nvidia/cuda:13.1.1-base-ubi8 as license
ARG GOLANG_VERSION=1.25
FROM registry.suse.com/bci/golang:${GOLANG_VERSION} as build

FROM registry.suse.com/bci/golang:1.25 as build
ARG TARGETARCH

RUN zypper --non-interactive install -y git wget tar gzip
# Arg to indicate if driver type is either of passthrough(baremetal) or vgpu
ARG DRIVER_TYPE=passthrough
ENV DRIVER_TYPE=$DRIVER_TYPE

SHELL ["/bin/bash", "-c"]
RUN zypper --gpg-auto-import-keys --non-interactive install -y git-core wget tar gzip

WORKDIR /work

RUN git clone https://github.com/NVIDIA/gpu-driver-container driver && \
RUN if [ "$DRIVER_TYPE" = "vgpu" ]; then \
git clone https://github.com/NVIDIA/gpu-driver-container driver && \
cd driver/vgpu/src && \
go build -o vgpu-util && \
mv vgpu-util /work
mv vgpu-util /work; fi

FROM registry.suse.com/suse/sle15:$SLES_VERSION

#ARG BASE_URL=http://us.download.nvidia.com/XFree86/Linux-x86_64
ARG BASE_URL=https://us.download.nvidia.com/tesla
ARG TARGETARCH
ENV TARGETARCH=$TARGETARCH
ARG DRIVER_VERSION
ENV DRIVER_VERSION=$DRIVER_VERSION
ARG DRIVER_ARCH=x86_64
ENV DRIVER_ARCH=$DRIVER_ARCH
ARG DRIVER_BRANCH
ENV DRIVER_BRANCH=$DRIVER_BRANCH

# Arg to indicate if driver type is either of passthrough/baremetal or vgpu
ARG DRIVER_TYPE=passthrough
ENV DRIVER_TYPE=$DRIVER_TYPE
ARG VGPU_LICENSE_SERVER_TYPE=FNE
ARG VGPU_LICENSE_SERVER_TYPE=NLS
ENV VGPU_LICENSE_SERVER_TYPE=$VGPU_LICENSE_SERVER_TYPE
# Enable vGPU version compability check by default
ARG DISABLE_VGPU_VERSION_CHECK=false
ARG DISABLE_VGPU_VERSION_CHECK=true
ENV DISABLE_VGPU_VERSION_CHECK=$DISABLE_VGPU_VERSION_CHECK
# Avoid dependency of container-toolkit for driver container
ENV NVIDIA_VISIBLE_DEVICES=void

RUN echo "TARGETARCH=$TARGETARCH"

ADD install.sh /tmp/

RUN zypper --non-interactive install -y curl awk tar util-linux-systemd
RUN zypper --gpg-auto-import-keys --non-interactive install -y curl awk tar util-linux-systemd

RUN sh /tmp/install.sh depinstall && \
sh /tmp/install.sh setup_cuda_repo && \
curl -fsSL -o /usr/local/bin/donkey https://github.com/3XX0/donkey/releases/download/v1.1.0/donkey && \
curl -fsSL -o /usr/local/bin/extract-vmlinux https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-vmlinux && \
chmod +x /usr/local/bin/donkey /usr/local/bin/extract-vmlinux && \
ln -s /sbin/ldconfig /sbin/ldconfig.real

ADD drivers drivers/

# Fetch the installer automatically for passthrough/baremetal types
# Fetch the installer, fabricmanager and libnvidia-nscq automatically for passthrough/baremetal types
RUN if [ "$DRIVER_TYPE" != "vgpu" ]; then \
versionArray=(${DRIVER_VERSION//./ }); \
DRIVER_BRANCH=${versionArray[0]}; \
if [ ${versionArray[0]} -ge 470 ] || ([ ${versionArray[0]} == 460 ] && [ ${versionArray[1]} -ge 91 ]); then \
fmPackage=nvidia-fabric-manager-${DRIVER_VERSION}-1; \
else \
fmPackage=nvidia-fabricmanager-${DRIVER_BRANCH}-${DRIVER_VERSION}-1; \
fi; \
nscqPackage=libnvidia-nscq-${DRIVER_BRANCH}-${DRIVER_VERSION}-1; \
cd drivers && \
curl -fSsl -O $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run && \
chmod +x NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run && \
zypper --non-interactive addrepo https://developer.download.nvidia.com/compute/cuda/repos/sles15/$DRIVER_ARCH cuda-sles15 && \
zypper --gpg-auto-import-keys --non-interactive install -y ${fmPackage} ${nscqPackage} && \
zypper removerepo cuda-sles15; fi
sh /tmp/install.sh download_installer ; fi

# Fetch the installer, fabricmanager, libnvidia-nscq, libnvsdm, imex packages
RUN sh /tmp/install.sh extrapkgsinstall

COPY nvidia-driver /usr/local/bin

COPY --from=build /work/vgpu-util /usr/local/bin
#COPY --from=build /work/vgpu-util* /usr/local/bin


WORKDIR /drivers

Expand All @@ -82,6 +86,8 @@ LABEL summary="Provision the NVIDIA driver through containers"
LABEL description="See summary"

# Add NGC DL license from the CUDA image
COPY --from=license /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
RUN mkdir /licenses && curl -fsSL -o /licenses/NGC-DL-CONTAINER-LICENSE https://gitlab.com/nvidia/container-images/cuda/-/raw/master/NGC-DL-CONTAINER-LICENSE

RUN zypper removerepo cuda-sles15

ENTRYPOINT ["nvidia-driver", "init"]
87 changes: 84 additions & 3 deletions sle15/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/bin/bash
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.

set -eu

DRIVER_ARCH=${TARGETARCH/amd64/x86_64} && DRIVER_ARCH=${DRIVER_ARCH/arm64/aarch64}
echo "DRIVER_ARCH is $DRIVER_ARCH"

download_installer () {
curl -fSsl -O $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run && \
chmod +x NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run;
}

dep_installer () {
if [ "$DRIVER_ARCH" = "x86_64" ]; then
if [ "$TARGETARCH" = "amd64" ]; then
zypper --non-interactive install -y \
libglvnd \
ca-certificates \
Expand All @@ -11,7 +22,7 @@ dep_installer () {
cpio \
kmod \
jq
elif [ "$DRIVER_ARCH" = "ppc64le" ]; then
elif [ "$TARGETARCH" = "ppc64le" ]; then
zypper --non-interactive install -y \
libglvnd-glx \
ca-certificates \
Expand All @@ -26,6 +37,65 @@ dep_installer () {
rm -rf /var/cache/zypp/*
}



fabricmanager_install() {
if [ "$DRIVER_BRANCH" -ge "580" ]; then
zypper --non-interactive install -y --no-recommends nvidia-fabricmanager-${DRIVER_VERSION}-1
else
zypper --non-interactive install -y --no-recommends nvidia-fabricmanager-${DRIVER_BRANCH}-${DRIVER_VERSION}-1
fi
}

nscq_install() {
if [ "$DRIVER_BRANCH" -ge "580" ]; then
zypper --non-interactive install -y --no-recommends libnvidia-nscq=${DRIVER_VERSION}-1
else
zypper --non-interactive install -y --no-recommends libnvidia-nscq-${DRIVER_BRANCH}=${DRIVER_VERSION}-1
fi
}

# libnvsdm packages are not available for arm64
nvsdm_install() {
if [ "$TARGETARCH" = "aarch64" ]; then
if [ "$DRIVER_BRANCH" -ge "580" ]; then
zypper --non-interactive install -y --no-recommends libnvsdm=${DRIVER_VERSION}-1
elif [ "$DRIVER_BRANCH" -ge "570" ]; then
zypper --non-interactive install -y --no-recommends libnvsdm-${DRIVER_BRANCH}=${DRIVER_VERSION}-1
fi
fi
}

nvlink5_pkgs_install() {
if [ "$DRIVER_BRANCH" -ge "550" ]; then
zypper --non-interactive install -y --no-recommends nvlsm infiniband-diags
fi
}

imex_install() {
if [ "$DRIVER_BRANCH" -ge "580" ]; then
zypper --non-interactive install -y --no-recommends nvidia-imex=${DRIVER_VERSION}-1
elif [ "$DRIVER_BRANCH" -ge "550" ]; then
zypper --non-interactive install -y --no-recommends nvidia-imex-${DRIVER_BRANCH}=${DRIVER_VERSION}-1;
fi
}

extra_pkgs_install() {
if [ "$DRIVER_TYPE" != "vgpu" ]; then
fabricmanager_install
nscq_install

echo "extra_pkgs_install $TARGETARCH"
if [ "$TARGETARCH" = "aarch64" ]; then
echo "arm shouldn't be entering"
nvsdm_install
fi

#nvlink5_pkgs_install
imex_install
fi
}

nvidia_installer () {
if [ "$DRIVER_ARCH" = "x86_64" ]; then
./nvidia-installer --silent \
Expand Down Expand Up @@ -61,11 +131,22 @@ nvidia_installer () {
fi
}

setup_cuda_repo() {
zypper --non-interactive addrepo https://developer.download.nvidia.com/compute/cuda/repos/sles15/${TARGETARCH/amd64/x86_64} cuda-sles15 && \
zypper --gpg-auto-import-keys --non-interactive ref
}

if [ "$1" = "nvinstall" ]; then
nvidia_installer
elif [ "$1" = "depinstall" ]; then
dep_installer
elif [ "$1" = "download_installer" ]; then
download_installer
elif [ "$1" = "extrapkgsinstall" ]; then
extra_pkgs_install
elif [ "$1" = "setup_cuda_repo" ]; then
setup_cuda_repo
else
echo "Unknown function: $1"
exit 1
fi

Loading