Skip to content

Commit

Permalink
build(copr): use cuda-gcc-c++
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Oct 6, 2024
1 parent d8111ef commit 9ccd38d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 279 deletions.
18 changes: 4 additions & 14 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,21 @@ CUDA is used for NVFBC capture.
</tr>
<tr>
<td rowspan="1">12.0.0</td>
<td rowspan="3">525.60.13</td>
<td rowspan="2">525.60.13</td>
<td rowspan="4">50;52;60;61;62;70;72;75;80;86;87;89;90</td>
<td>sunshine-debian-bookworm-{arch}.deb</td>
</tr>
<tr>
<td rowspan="1">12.4.0</td>
<td>Sunshine (copr fedora-39)</td>
</tr>
<tr>
<td rowspan="1">12.5.1</td>
<td>sunshine.pkg.tar.zst</td>
</tr>
<tr>
<td rowspan="1">12.6.2</td>
<td rowspan="1">560.35.03</td>
<td rowspan="2">12.6.2</td>
<td rowspan="2">560.35.03</td>
<td>sunshine_{arch}.flatpak</td>
</tr>
<tr>
<td rowspan="2">n/a</td>
<td rowspan="2">n/a</td>
<td rowspan="2">n/a</td>
<td>Sunshine (copr fedora-40)</td>
</tr>
<tr>
<td>Sunshine (copr fedora-41)</td>
<td>Sunshine (copr)</td>
</tr>
</table>

Expand Down
252 changes: 0 additions & 252 deletions packaging/linux/fedora/sunshine-og.spec.bak

This file was deleted.

48 changes: 35 additions & 13 deletions packaging/linux/fedora/sunshine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ BuildRequires: which
# for unit tests
BuildRequires: xorg-x11-server-Xvfb

# Conditional BuildRequires for cuda-gcc based on Fedora version
%if 0%{?fedora} >= 40
# this package conflicts with gcc on f39
BuildRequires: cuda-gcc-c++
%endif

Requires: libcap >= 2.22
Requires: libcurl >= 7.0
Requires: libdrm > 2.4.97
Expand Down Expand Up @@ -91,12 +97,13 @@ fedora_version=%{fedora}
cuda_supported_architectures=("x86_64" "aarch64")

# set cuda_version based on Fedora version
# these are the same right now, but leave this structure to make it easier to set different versions
if [ "$fedora_version" == 39 ]; then
cuda_version="12.4.0"
cuda_build="550.54.14"
cuda_version="12.6.2"
cuda_build="560.35.03"
else
cuda_version=
cuda_build=
cuda_version="12.6.2"
cuda_build="560.35.03"
fi

# prepare CMAKE args
Expand Down Expand Up @@ -125,6 +132,10 @@ function install_cuda() {
return
fi

if [ "$fedora_version" -ge 40 ]; then
export NVCC_PREPEND_FLAGS='-ccbin /usr/bin/cuda -allow-unsupported-compiler'
fi

local cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
local cuda_suffix=""
if [ "$architecture" == "aarch64" ]; then
Expand All @@ -138,21 +149,32 @@ function install_cuda() {
# back up /usr/include/bits/math-vector.h
math_vector_file="/usr/include/bits/math-vector.h"

# patch headers https://bugs.launchpad.net/ubuntu/+source/mumax3/+bug/2032624
cp "$math_vector_file" "$math_vector_file.bak"
sed -i 's/__Float32x4_t/int/g' "$math_vector_file"
sed -i 's/__Float64x2_t/int/g' "$math_vector_file"
sed -i 's/__SVFloat32_t/float/g' "$math_vector_file"
sed -i 's/__SVFloat64_t/float/g' "$math_vector_file"
sed -i 's/__SVBool_t/int/g' "$math_vector_file"
# # patch headers https://bugs.launchpad.net/ubuntu/+source/mumax3/+bug/2032624
# cp "$math_vector_file" "$math_vector_file.bak"
# sed -i 's/__Float32x4_t/int/g' "$math_vector_file"
# sed -i 's/__Float64x2_t/int/g' "$math_vector_file"
# sed -i 's/__SVFloat32_t/float/g' "$math_vector_file"
# sed -i 's/__SVFloat64_t/float/g' "$math_vector_file"
# sed -i 's/__SVBool_t/int/g' "$math_vector_file"
fi

local 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 "%{_builddir}/cuda.run"
wget "$url" --progress=bar:force:noscroll -q -O "%{_builddir}/cuda.run"
chmod a+x "%{_builddir}/cuda.run"
"%{_builddir}/cuda.run" --silent --toolkit --toolkitpath="%{_builddir}/cuda" --no-opengl-libs --no-man-page --no-drm
"%{_builddir}/cuda.run" \
--no-drm \
--no-man-page \
--no-opengl-libs \
--override \
--silent \
--toolkit \
--toolkitpath="%{_builddir}/cuda"
rm "%{_builddir}/cuda.run"

# update environment variables for CUDA, necessary when using cuda-gcc-c++
export PATH=/usr/bin/cuda:"%{_builddir}/cuda/bin:${PATH}"
export LD_LIBRARY_PATH="%{_builddir}/cuda/lib64:${LD_LIBRARY_PATH}"
}

# we need to clear these flags to avoid linkage errors with cuda-gcc-c++
Expand Down

0 comments on commit 9ccd38d

Please sign in to comment.