feat: deteccion de GPU NVIDIA y aceleracion automatica (#16)

Co-authored-by: Hermes Agent <hermes@d0a1.es>
This commit was merged in pull request #16.
This commit is contained in:
hermes authored and Hermes committed 2026-09-12 21:33:43 +02:00
1 parent 6f052cf738
commit fbf567f942
4 files changed
+72 -4

No files matched your search

+20 -1
View File
@@ -119,6 +119,19 @@ if (-not (Test-Path $EnvFile)) {
Info "Contrasenas generadas en $EnvFile"
}
# --- GPU NVIDIA? (si hay, Ollama la usa y va 5-10x mas rapido) ---------------
$HasGpu = $false
if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) {
$GpuInfo = & nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>$null
if ($LASTEXITCODE -eq 0 -and $GpuInfo) {
$HasGpu = $true
$GpuName = ($GpuInfo -split ',')[0].Trim()
Info "GPU NVIDIA detectada: $GpuName (aceleracion activada)"
}
}
if (-not $HasGpu) {
Warn 'Sin GPU NVIDIA: modo CPU (~10-20 tokens/s). Con una GPU NVIDIA va 5-10x mas rapido.'
}
# --- Auto-detect ports ----------------------------------------------------
# --- Tumbar deploy previo (antes de detectar puertos) ----------------------
cmd /c docker compose -f $ComposeFile down '>' NUL '2>&1'
@@ -161,7 +174,13 @@ cmd /c docker compose -f $ComposeFile down '>' NUL '2>&1'
$env:OLLAMA_PORT = "$OllamaPort"
$env:WP_PORT = "$WpPort"
$env:WEBUI_PORT = "$WebUiPort"
docker compose -f $ComposeFile up -d
$ComposeArgs = @('-f', $ComposeFile)
if ($HasGpu) {
$OverrideFile = Join-Path $ScriptDir 'docker-compose.gpu.yml'
Set-Content -Path $OverrideFile -Value "services:`r`n ollama:`r`n gpus: all`r`n"
$ComposeArgs += @('-f', $OverrideFile)
}
docker compose @ComposeArgs up -d
if ($LASTEXITCODE -ne 0) { Err "docker compose up fallo (exit $LASTEXITCODE)."; exit 1 }
# --- Pull model -------------------------------------------------------------