feat: deteccion de GPU NVIDIA y aceleracion automatica
- Detecta nvidia-smi (driver Windows 535+ hace passthrough a WSL2) - Con GPU: ollama arranca con --gpus all (docker run) / override compose docker-compose.gpu.yml (gpus: all) -> 30-50 tok/s - Sin GPU: como hasta ahora (CPU ~10-20 tok/s) + aviso honesto
This commit is contained in:
1 parent
6f052cf738
commit
25970017fa
4 files changed
+72
-4
No files matched your search
+20
-1
@@ -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 -------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user