From 26e5f2f610cf6c33ed1acf0b67c2fb8d1f383a18 Mon Sep 17 00:00:00 2001 From: Ehren Bendler Date: Tue, 19 Aug 2025 10:05:25 -0400 Subject: [PATCH] build(Linux): Cleanup CUDA compiler options for modern versions (#4162) --- README.md | 6 ++- cmake/compile_definitions/linux.cmake | 53 ++++++++++----------------- docs/getting_started.md | 2 +- src/platform/linux/cuda.cpp | 4 +- src/platform/linux/cuda.h | 4 +- 5 files changed, 30 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 63cc9a2d3..a22d482fc 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,11 @@ LizardByte has the full documentation hosted on [Read the Docs](https://docs.liz - Nvidia: GeForce GTX 1080 or higher + + Nvidia:
+   Linux: GeForce RTX 2000 series or higher
+   Windows: Geforce GTX 1080 or higher + CPU diff --git a/cmake/compile_definitions/linux.cmake b/cmake/compile_definitions/linux.cmake index 27f52e63f..e4ed683f9 100644 --- a/cmake/compile_definitions/linux.cmake +++ b/cmake/compile_definitions/linux.cmake @@ -21,45 +21,32 @@ if(${SUNSHINE_ENABLE_CUDA}) message(STATUS "CUDA Compiler Version: ${CMAKE_CUDA_COMPILER_VERSION}") set(CMAKE_CUDA_ARCHITECTURES "") - # https://tech.amikelive.com/node-930/cuda-compatibility-of-nvidia-display-gpu-drivers/ - if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 6.5) - list(APPEND CMAKE_CUDA_ARCHITECTURES 10) - elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 6.5) - list(APPEND CMAKE_CUDA_ARCHITECTURES 50 52) + # https://docs.nvidia.com/cuda/archive/12.0.0/cuda-compiler-driver-nvcc/index.html + if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0) + list(APPEND CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90) + else() + message(FATAL_ERROR + "Sunshine requires a minimum CUDA Compiler version of 12.0. + Found version: ${CMAKE_CUDA_COMPILER_VERSION}" + ) endif() - if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 7.0) - list(APPEND CMAKE_CUDA_ARCHITECTURES 11) - elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER 7.6) - list(APPEND CMAKE_CUDA_ARCHITECTURES 60 61 62) + # https://docs.nvidia.com/cuda/archive/12.8.0/cuda-compiler-driver-nvcc/index.html + if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) + list(APPEND CMAKE_CUDA_ARCHITECTURES 100 101 120) endif() - # https://docs.nvidia.com/cuda/archive/9.2/cuda-compiler-driver-nvcc/index.html - if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0) - list(APPEND CMAKE_CUDA_ARCHITECTURES 20) - elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0) - list(APPEND CMAKE_CUDA_ARCHITECTURES 70) + # https://docs.nvidia.com/cuda/archive/12.9.0/cuda-compiler-driver-nvcc/index.html + if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.9) + list(APPEND CMAKE_CUDA_ARCHITECTURES 103 121) endif() - # https://docs.nvidia.com/cuda/archive/10.0/cuda-compiler-driver-nvcc/index.html - if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0) - list(APPEND CMAKE_CUDA_ARCHITECTURES 72 75) - endif() - - # https://docs.nvidia.com/cuda/archive/11.0/cuda-compiler-driver-nvcc/index.html - if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0) - list(APPEND CMAKE_CUDA_ARCHITECTURES 30) - elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0) - list(APPEND CMAKE_CUDA_ARCHITECTURES 80) - endif() - - # https://docs.nvidia.com/cuda/archive/11.8.0/cuda-compiler-driver-nvcc/index.html - if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.8) - list(APPEND CMAKE_CUDA_ARCHITECTURES 86 87 89 90) - endif() - - if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 12.0) - list(APPEND CMAKE_CUDA_ARCHITECTURES 35) + # https://docs.nvidia.com/cuda/archive/13.0.0/cuda-compiler-driver-nvcc/index.html + if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) + list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES 101) + list(APPEND CMAKE_CUDA_ARCHITECTURES 110) + else() + list(APPEND CMAKE_CUDA_ARCHITECTURES 50 52 53 60 61 62 70 72) endif() # sort the architectures diff --git a/docs/getting_started.md b/docs/getting_started.md index 2761fb564..2c44f0780 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -45,7 +45,7 @@ need to install CUDA.} 12.9.1 575.57.08 - 50;52;60;61;62;70;72;75;80;86;87;89;90 + 50;52;60;61;62;70;72;75;80;86;87;89;90;100;101;103;120;121 sunshine.AppImage diff --git a/src/platform/linux/cuda.cpp b/src/platform/linux/cuda.cpp index 3a17b9cf1..5b3bb695b 100644 --- a/src/platform/linux/cuda.cpp +++ b/src/platform/linux/cuda.cpp @@ -202,7 +202,7 @@ namespace cuda { return sws.load_ram(img, tex.array) || sws.convert(frame->data[0], frame->data[1], frame->linesize[0], frame->linesize[1], tex_obj(tex), stream.get()); } - int set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) { + int set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) override { if (cuda_t::set_frame(frame, hw_frames_ctx)) { return -1; } @@ -929,7 +929,7 @@ namespace cuda { return platf::capture_e::ok; } - std::unique_ptr make_avcodec_encode_device(platf::pix_fmt_e pix_fmt) { + std::unique_ptr make_avcodec_encode_device(platf::pix_fmt_e pix_fmt) override { return ::cuda::make_avcodec_encode_device(width, height, true); } diff --git a/src/platform/linux/cuda.h b/src/platform/linux/cuda.h index c7f5daac4..409575817 100644 --- a/src/platform/linux/cuda.h +++ b/src/platform/linux/cuda.h @@ -16,8 +16,8 @@ #include "src/video_colorspace.h" namespace platf { - class avcodec_encode_device_t; - class img_t; + struct avcodec_encode_device_t; + struct img_t; } // namespace platf namespace cuda {