mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 21:40:12 +00:00
ctranslate2: explicitly set nvcc -gencode flags
This fixes a build failure when using cudaPackages_13: > Unsupported gpu architecture 'compute_53' Verified builds both with and without `cudaPackages = cudaPackages_13` override, on x86_64-linux and aarch64-linux
This commit is contained in:
11
pkgs/by-name/ct/ctranslate2/cuda-arch-gencode-flags.patch
Normal file
11
pkgs/by-name/ct/ctranslate2/cuda-arch-gencode-flags.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -538,8 +538,6 @@
|
||||
list(REMOVE_DUPLICATES CUDA_ARCH_LIST)
|
||||
endif()
|
||||
|
||||
- cuda_select_nvcc_arch_flags(ARCH_FLAGS ${CUDA_ARCH_LIST})
|
||||
- list(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
|
||||
set(CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
|
||||
# flags for flash attention
|
||||
@@ -65,6 +65,15 @@ stdenv'.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-OuN7GTfzqsALu8Qgx7GNERlyCq3cTxhpZo8UA/yDekw=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# ctranslate2 uses a deprecated cmake FindCUDA cuda_select_nvcc_arch_flags()
|
||||
# function. This function uses a regex that can not match two-digit
|
||||
# capabilities such as 10.0 and 12.1, and it's default "Auto" fallback still
|
||||
# targets compute_53, which CUDA 13 no longer supports, so the patch removes
|
||||
# its arch selection, and we set CUDA_NVCC_FLAGS ourselves below.
|
||||
./cuda-arch-gencode-flags.patch
|
||||
];
|
||||
|
||||
# Fix CMake 4 compatibility
|
||||
postPatch = ''
|
||||
substituteInPlace third_party/cpu_features/CMakeLists.txt \
|
||||
@@ -103,6 +112,9 @@ stdenv'.mkDerivation (finalAttrs: {
|
||||
(lib.cmakeBool "WITH_MKL" withMkl)
|
||||
(lib.cmakeBool "WITH_HIP" rocmSupport)
|
||||
]
|
||||
++ lib.optionals withCUDA [
|
||||
(lib.cmakeFeature "CUDA_NVCC_FLAGS" (lib.concatStringsSep ";" cudaPackages.flags.gencode))
|
||||
]
|
||||
++ lib.optionals rocmSupport [
|
||||
(lib.cmakeBool "CMAKE_SKIP_RPATH" true)
|
||||
(lib.cmakeFeature "CMAKE_C_COMPILER" "amdclang")
|
||||
|
||||
Reference in New Issue
Block a user