From 3c9c7beac23dd743552dcb9cb2afb46c98d0dddb Mon Sep 17 00:00:00 2001 From: Crashdummy Date: Sat, 8 Jun 2024 21:43:44 +0200 Subject: [PATCH 1/4] Reenable cuda by utilizing the negativo17 compatibility package --- docker/fedora-40.dockerfile | 59 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/docker/fedora-40.dockerfile b/docker/fedora-40.dockerfile index 94a8a9fa733..065d28f106a 100644 --- a/docker/fedora-40.dockerfile +++ b/docker/fedora-40.dockerfile @@ -28,11 +28,13 @@ RUN <<_DEPS #!/bin/bash set -e dnf -y update +dnf -y config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo dnf -y group install "Development Tools" dnf -y install \ boost-devel-1.83.0* \ cmake-3.28.* \ doxygen \ + cuda-gcc-c++ \ gcc-14.1.* \ gcc-c++-14.1.* \ git \ @@ -72,35 +74,35 @@ dnf clean all rm -rf /var/cache/yum _DEPS -# TODO: re-enable cuda once cuda supports gcc-14 ## install cuda -#WORKDIR /build/cuda +WORKDIR /build/cuda ## versions: https://developer.nvidia.com/cuda-toolkit-archive -#ENV CUDA_VERSION="12.4.0" -#ENV CUDA_BUILD="550.54.14" +ENV CUDA_VERSION="12.5.0" +ENV CUDA_BUILD="555.42.02" +ENV NVCC_PREPEND_FLAGS="-ccbin /usr/bin/cuda" ## hadolint ignore=SC3010 -#RUN <<_INSTALL_CUDA -##!/bin/bash -#set -e -#cuda_prefix="https://developer.download.nvidia.com/compute/cuda/" -#cuda_suffix="" -#if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then -# cuda_suffix="_sbsa" -# -# # patch headers https://bugs.launchpad.net/ubuntu/+source/mumax3/+bug/2032624 -# sed -i 's/__Float32x4_t/int/g' /usr/include/bits/math-vector.h -# sed -i 's/__Float64x2_t/int/g' /usr/include/bits/math-vector.h -# sed -i 's/__SVFloat32_t/float/g' /usr/include/bits/math-vector.h -# sed -i 's/__SVFloat64_t/float/g' /usr/include/bits/math-vector.h -# sed -i 's/__SVBool_t/int/g' /usr/include/bits/math-vector.h -#fi -#url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run" -#echo "cuda url: ${url}" -#wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run -#chmod a+x ./cuda.run -#./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm -#rm ./cuda.run -#_INSTALL_CUDA +RUN <<_INSTALL_CUDA +#!/bin/bash +set -e +cuda_prefix="https://developer.download.nvidia.com/compute/cuda/" +cuda_suffix="" +if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then + cuda_suffix="_sbsa" + + # patch headers https://bugs.launchpad.net/ubuntu/+source/mumax3/+bug/2032624 + sed -i 's/__Float32x4_t/int/g' /usr/include/bits/math-vector.h + sed -i 's/__Float64x2_t/int/g' /usr/include/bits/math-vector.h + sed -i 's/__SVFloat32_t/float/g' /usr/include/bits/math-vector.h + sed -i 's/__SVFloat64_t/float/g' /usr/include/bits/math-vector.h + sed -i 's/__SVBool_t/int/g' /usr/include/bits/math-vector.h +fi +url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run" +echo "cuda url: ${url}" +wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run +chmod a+x ./cuda.run +./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm +rm ./cuda.run +_INSTALL_CUDA # copy repository WORKDIR /build/sunshine/ @@ -109,13 +111,12 @@ COPY --link .. . # setup build directory WORKDIR /build/sunshine/build -# TODO: re-add as first cmake argument: -DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \ -# TODO: enable cuda flag # cmake and cpack RUN <<_MAKE #!/bin/bash set -e cmake \ + -DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \ -DBUILD_WERROR=ON \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ @@ -124,7 +125,7 @@ cmake \ -DSUNSHINE_ENABLE_WAYLAND=ON \ -DSUNSHINE_ENABLE_X11=ON \ -DSUNSHINE_ENABLE_DRM=ON \ - -DSUNSHINE_ENABLE_CUDA=OFF \ + -DSUNSHINE_ENABLE_CUDA=ON \ /build/sunshine make -j "$(nproc)" cpack -G RPM From 4df1ee2efc42f39f2610bf335ed33f08b61c9ac8 Mon Sep 17 00:00:00 2001 From: Crashdummy Date: Sat, 8 Jun 2024 22:03:08 +0200 Subject: [PATCH 2/4] Enfoce cuda-gcc-c++ 12.3+ --- docker/fedora-40.dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/fedora-40.dockerfile b/docker/fedora-40.dockerfile index 065d28f106a..b5ce67aee28 100644 --- a/docker/fedora-40.dockerfile +++ b/docker/fedora-40.dockerfile @@ -28,13 +28,14 @@ RUN <<_DEPS #!/bin/bash set -e dnf -y update +dnf -y install dnf-plugins-core dnf -y config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo dnf -y group install "Development Tools" dnf -y install \ boost-devel-1.83.0* \ cmake-3.28.* \ doxygen \ - cuda-gcc-c++ \ + cuda-gcc-c++-12.3* \ gcc-14.1.* \ gcc-c++-14.1.* \ git \ @@ -83,9 +84,11 @@ ENV NVCC_PREPEND_FLAGS="-ccbin /usr/bin/cuda" ## hadolint ignore=SC3010 RUN <<_INSTALL_CUDA #!/bin/bash + set -e cuda_prefix="https://developer.download.nvidia.com/compute/cuda/" cuda_suffix="" + if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then cuda_suffix="_sbsa" @@ -96,6 +99,7 @@ if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then sed -i 's/__SVFloat64_t/float/g' /usr/include/bits/math-vector.h sed -i 's/__SVBool_t/int/g' /usr/include/bits/math-vector.h fi + url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run" echo "cuda url: ${url}" wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run From 41907e8c191d775272a09627dc2e3184938b381b Mon Sep 17 00:00:00 2001 From: Crashdummy Date: Sat, 8 Jun 2024 22:13:51 +0200 Subject: [PATCH 3/4] Use curl to download cuda --- docker/fedora-40.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/fedora-40.dockerfile b/docker/fedora-40.dockerfile index b5ce67aee28..836295acca0 100644 --- a/docker/fedora-40.dockerfile +++ b/docker/fedora-40.dockerfile @@ -65,7 +65,7 @@ dnf -y install \ pulseaudio-libs-devel \ python3.11 \ rpm-build \ - wget \ + curl \ which \ xorg-x11-server-Xvfb if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then @@ -102,7 +102,7 @@ fi url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run" echo "cuda url: ${url}" -wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run +curl -Lo "./cuda.run" "$url" chmod a+x ./cuda.run ./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm rm ./cuda.run From 1c5119972d4cf280f0dd9cab8e39d107caa15416 Mon Sep 17 00:00:00 2001 From: Crashdummy Date: Sat, 8 Jun 2024 23:27:32 +0200 Subject: [PATCH 4/4] add override parameter --- docker/fedora-40.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/fedora-40.dockerfile b/docker/fedora-40.dockerfile index 836295acca0..527df6d5d45 100644 --- a/docker/fedora-40.dockerfile +++ b/docker/fedora-40.dockerfile @@ -104,7 +104,7 @@ url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_ echo "cuda url: ${url}" curl -Lo "./cuda.run" "$url" chmod a+x ./cuda.run -./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm +./cuda.run --silent --toolkit --override --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm rm ./cuda.run _INSTALL_CUDA