Merge pull request #330038 from KiruyaMomochi/koboldcpp-cuda-fix

koboldcpp: Fix Package Build Failure with CUDA Enabled
This commit is contained in:
Someone 2024-07-30 10:21:08 +03:00 committed by GitHub
commit 7929bf8f6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,7 +22,7 @@
cublasSupport ? config.cudaSupport,
# You can find a full list here: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
# For example if you're on an GTX 1080 that means you're using "Pascal" and you need to pass "sm_60"
cudaArches ? cudaPackages.cudaFlags.arches or [ ],
cudaArches ? cudaPackages.cudaFlags.realArches or [ ],
clblastSupport ? stdenv.isLinux,
clblast,
@ -40,7 +40,7 @@ let
makeBool = option: bool: (if bool then "${option}=1" else "");
libraryPathWrapperArgs = lib.optionalString config.cudaSupport ''
--prefix LD_LIBRARY_PATH: "${lib.makeLibraryPath [ addDriverRunpath.driverLink ]}"
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ addDriverRunpath.driverLink ]}"
'';
darwinFrameworks =
@ -129,7 +129,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
(makeBool "LLAMA_CLBLAST" clblastSupport)
(makeBool "LLAMA_VULKAN" vulkanSupport)
(makeBool "LLAMA_METAL" metalSupport)
(lib.optionals cublasSupport "CUDA_DOCKER_ARCH=sm_${builtins.head cudaArches}")
(lib.optionals cublasSupport "CUDA_DOCKER_ARCH=${builtins.head cudaArches}")
];
installPhase = ''
@ -158,7 +158,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
postFixup = ''
wrapPythonProgramsIn "$out/bin" "$pythonPath"
makeWrapper "$out/bin/koboldcpp.unwrapped" "$out/bin/koboldcpp" \
--prefix PATH ${lib.makeBinPath [ tk ]} ${libraryPathWrapperArgs}
--prefix PATH : ${lib.makeBinPath [ tk ]} ${libraryPathWrapperArgs}
'';
passthru.updateScript = gitUpdater { rev-prefix = "v"; };