mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 15:36:47 +03:00
Merge pull request #302350 from ck3d/localai-config-cuda
local-ai: better defaults and smaller closure size
This commit is contained in:
commit
29bc928c6e
@ -1,5 +1,7 @@
|
|||||||
{ stdenv
|
{ config
|
||||||
|
, stdenv
|
||||||
, lib
|
, lib
|
||||||
|
, addDriverRunpath
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, protobuf
|
, protobuf
|
||||||
@ -21,7 +23,7 @@
|
|||||||
# CPU extensions
|
# CPU extensions
|
||||||
, enable_avx ? true
|
, enable_avx ? true
|
||||||
, enable_avx2 ? true
|
, enable_avx2 ? true
|
||||||
, enable_avx512 ? false
|
, enable_avx512 ? stdenv.hostPlatform.avx512Support
|
||||||
, enable_f16c ? true
|
, enable_f16c ? true
|
||||||
, enable_fma ? true
|
, enable_fma ? true
|
||||||
|
|
||||||
@ -31,7 +33,7 @@
|
|||||||
, with_openblas ? false
|
, with_openblas ? false
|
||||||
, openblas
|
, openblas
|
||||||
|
|
||||||
, with_cublas ? false
|
, with_cublas ? config.cudaSupport
|
||||||
, cudaPackages
|
, cudaPackages
|
||||||
|
|
||||||
, with_clblas ? false
|
, with_clblas ? false
|
||||||
@ -54,7 +56,6 @@
|
|||||||
, fetchzip
|
, fetchzip
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, writeText
|
, writeText
|
||||||
, writeTextFile
|
|
||||||
, symlinkJoin
|
, symlinkJoin
|
||||||
, linkFarmFromDrvs
|
, linkFarmFromDrvs
|
||||||
, jq
|
, jq
|
||||||
@ -67,9 +68,17 @@ let
|
|||||||
else if with_clblas then "clblas"
|
else if with_clblas then "clblas"
|
||||||
else "";
|
else "";
|
||||||
|
|
||||||
|
inherit (cudaPackages) libcublas cuda_nvcc cuda_cccl cuda_cudart;
|
||||||
|
|
||||||
typedBuiltInputs =
|
typedBuiltInputs =
|
||||||
lib.optionals with_cublas
|
lib.optionals with_cublas
|
||||||
[ cudaPackages.cudatoolkit cudaPackages.cuda_cudart ]
|
[
|
||||||
|
cuda_nvcc # should be part of nativeBuildInputs
|
||||||
|
cuda_cudart
|
||||||
|
cuda_cccl
|
||||||
|
(lib.getDev libcublas)
|
||||||
|
(lib.getLib libcublas)
|
||||||
|
]
|
||||||
++ lib.optionals with_clblas
|
++ lib.optionals with_clblas
|
||||||
[ clblast ocl-icd opencl-headers ]
|
[ clblast ocl-icd opencl-headers ]
|
||||||
++ lib.optionals with_openblas
|
++ lib.optionals with_openblas
|
||||||
@ -166,7 +175,6 @@ let
|
|||||||
patches = [ ];
|
patches = [ ];
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
cmakeFlags = (self.cmakeFlags or [ ]) ++ [
|
cmakeFlags = (self.cmakeFlags or [ ]) ++ [
|
||||||
# -DCMAKE_C_FLAGS="-D_FILE_OFFSET_BITS=64"
|
|
||||||
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
|
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
|
||||||
(lib.cmakeBool "USE_ASYNC" false)
|
(lib.cmakeBool "USE_ASYNC" false)
|
||||||
(lib.cmakeBool "USE_MBROLA" false)
|
(lib.cmakeBool "USE_MBROLA" false)
|
||||||
@ -431,7 +439,7 @@ let
|
|||||||
"VERSION=v${version}"
|
"VERSION=v${version}"
|
||||||
"BUILD_TYPE=${BUILD_TYPE}"
|
"BUILD_TYPE=${BUILD_TYPE}"
|
||||||
]
|
]
|
||||||
++ lib.optional with_cublas "CUDA_LIBPATH=${cudaPackages.cuda_cudart}/lib"
|
++ lib.optional with_cublas "CUDA_LIBPATH=${cuda_cudart}/lib"
|
||||||
++ lib.optional with_tts "PIPER_CGO_CXXFLAGS=-DSPDLOG_FMT_EXTERNAL=1";
|
++ lib.optional with_tts "PIPER_CGO_CXXFLAGS=-DSPDLOG_FMT_EXTERNAL=1";
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
@ -465,19 +473,19 @@ let
|
|||||||
|
|
||||||
# patching rpath with patchelf doens't work. The execuable
|
# patching rpath with patchelf doens't work. The execuable
|
||||||
# raises an segmentation fault
|
# raises an segmentation fault
|
||||||
postFixup = ''
|
postFixup =
|
||||||
wrapProgram $out/bin/${pname} \
|
let
|
||||||
'' + lib.optionalString with_cublas ''
|
LD_LIBRARY_PATH = [ ]
|
||||||
--prefix LD_LIBRARY_PATH : "${cudaPackages.libcublas}/lib:${cudaPackages.cuda_cudart}/lib:/run/opengl-driver/lib" \
|
++ lib.optionals with_cublas [ (lib.getLib libcublas) cuda_cudart addDriverRunpath.driverLink ]
|
||||||
'' + lib.optionalString with_clblas ''
|
++ lib.optionals with_clblas [ clblast ocl-icd ]
|
||||||
--prefix LD_LIBRARY_PATH : "${clblast}/lib:${ocl-icd}/lib" \
|
++ lib.optionals with_openblas [ openblas ]
|
||||||
'' + lib.optionalString with_openblas ''
|
++ lib.optionals with_tts [ piper-phonemize ];
|
||||||
--prefix LD_LIBRARY_PATH : "${openblas}/lib" \
|
in
|
||||||
'' + lib.optionalString with_tts ''
|
''
|
||||||
--prefix LD_LIBRARY_PATH : "${piper-phonemize}/lib" \
|
wrapProgram $out/bin/${pname} \
|
||||||
'' + ''
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath LD_LIBRARY_PATH}" \
|
||||||
--prefix PATH : "${ffmpeg}/bin"
|
--prefix PATH : "${ffmpeg}/bin"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.local-packages = {
|
passthru.local-packages = {
|
||||||
inherit
|
inherit
|
||||||
|
Loading…
Reference in New Issue
Block a user