Auto-scale hardware: CUDA 13 only on cc>=7.5, pin ctranslate2 4.8 (cu12), fp16-less GPUs, CPU threads, llama --fit on >=7 GiB GPUs, CPU-only embeddings

This commit is contained in:
Stefano Zini
2026-11-04 14:14:26 +01:00
parent 03ba83fba8
commit a741859140
5 changed files with 48 additions and 19 deletions
+6 -3
View File
@@ -13,12 +13,15 @@ module.exports = {
},
{
// highest CUDA the driver supports ("CUDA Version: 13.0", newer drivers "CUDA UMD Version: 13.4" in nvidia-smi) -> llama.cpp build; no NVIDIA/driver -> CPU build
// CUDA 13 also needs compute capability >= 7.5 (Maxwell/Pascal/Volta dropped, even on R580+ drivers)
method: async (req, ondata, kernel) => {
let m = null
let m = null, cc = 0
try { m = execFileSync("nvidia-smi", { encoding: "utf8" }).match(/CUDA (?:UMD )?Version:\s*(\d+)\.(\d+)/) } catch (e) {}
// lowest GPU wins
try { cc = Math.min(...execFileSync("nvidia-smi", ["--query-gpu=compute_cap", "--format=csv,noheader"], { encoding: "utf8" }).trim().split(/\r?\n/).map(Number)) } catch (e) {}
const v = m ? +m[1] * 100 + +m[2] : 0
const build = v >= 1300 ? "cuda-13.4" : v >= 1204 ? "cuda-12.4" : "cpu"
ondata({ raw: `CUDA: ${m ? m[1] + "." + m[2] : "none"} -> llama.cpp ${build}\r\n` })
const build = v >= 1300 && cc >= 7.5 ? "cuda-13.4" : v >= 1204 ? "cuda-12.4" : "cpu"
ondata({ raw: `CUDA: ${m ? m[1] + "." + m[2] : "none"}, compute ${cc || "?"} -> llama.cpp ${build}\r\n` })
return { build }
}
},