mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-19 05:07:20 +02:00
Sync état à jour + fix perf GPU/CPU
- LD_LIBRARY_PATH inclut désormais les dossiers runtime CUDA (/usr/local/cuda*/lib64) : corrige le chargement du backend GPU. - Unit systemd : Nice=-10 + CPUSchedulingPolicy=other (priorité CPU). - Met à niveau le reste du projet (models, webauth, presets, web UI).
This commit is contained in:
1 parent
65b2ada540
commit
6ea2e91810
14 files changed
+1143
-318
No files matched your search
+35
-4
@@ -6,6 +6,9 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@@ -17,13 +20,41 @@ func defaultJeanHome() string { return "/etc/jean" }
|
||||
func defaultEditor() string { return "nano" }
|
||||
|
||||
// setLibraryPath ensures llama-server can load shared libs bundled next to the
|
||||
// binary by prepending dir to LD_LIBRARY_PATH.
|
||||
// binary by prepending dir to LD_LIBRARY_PATH. It also appends the CUDA runtime
|
||||
// lib directories: a CUDA-enabled build links against libcudart/libcublas, which
|
||||
// live under /usr/local/cuda*/lib64 and are often absent from the global ld
|
||||
// cache — without them llama-server fails to load the GPU backend (or runs
|
||||
// degraded), costing a large chunk of throughput.
|
||||
func setLibraryPath(dir string) {
|
||||
ld := dir
|
||||
parts := []string{dir}
|
||||
parts = append(parts, cudaLibDirs()...)
|
||||
if existing := os.Getenv("LD_LIBRARY_PATH"); existing != "" {
|
||||
ld = ld + ":" + existing
|
||||
parts = append(parts, existing)
|
||||
}
|
||||
_ = os.Setenv("LD_LIBRARY_PATH", ld)
|
||||
_ = os.Setenv("LD_LIBRARY_PATH", strings.Join(parts, ":"))
|
||||
}
|
||||
|
||||
// cudaLibDirs returns the CUDA runtime lib directories present on the machine,
|
||||
// preferring the highest-versioned install. Empty when no CUDA toolkit is found.
|
||||
func cudaLibDirs() []string {
|
||||
var dirs []string
|
||||
seen := map[string]bool{}
|
||||
add := func(d string) {
|
||||
if d != "" && !seen[d] && isDir(d) {
|
||||
seen[d] = true
|
||||
dirs = append(dirs, d)
|
||||
}
|
||||
}
|
||||
// Default symlink first (usually points at the active toolkit).
|
||||
add("/usr/local/cuda/lib64")
|
||||
add("/usr/local/cuda/targets/x86_64-linux/lib")
|
||||
// Versioned installs, newest last so it takes precedence in PATH order.
|
||||
versioned, _ := filepath.Glob("/usr/local/cuda-*/lib64")
|
||||
sort.Strings(versioned)
|
||||
for i := len(versioned) - 1; i >= 0; i-- {
|
||||
add(versioned[i])
|
||||
}
|
||||
return dirs
|
||||
}
|
||||
|
||||
// execServer replaces the current process with llama-server (so systemd
|
||||
|
||||
Reference in new issue
Block a user