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:
1 parent
6f052cf738
commit
fbf567f942
4 files changed
+72
-4
No files matched your search
+20
-1
@@ -91,6 +91,19 @@ Ok "RAM: $TotalRamGb GB"
|
||||
# los puertos para que Find-FreePort vea el estado REAL tras el down.
|
||||
cmd /c docker compose -f $ComposeFile down '>' NUL '2>&1'
|
||||
|
||||
# --- 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 ----------------------------------------------------
|
||||
$OllamaPort = Find-FreePort 11434
|
||||
$WebUiPort = Find-FreePort 3000
|
||||
@@ -124,7 +137,13 @@ Write-Host ''
|
||||
Warn 'Descargando contenedores (2-3 min la primera vez)...'
|
||||
$env:OLLAMA_PORT = "$OllamaPort"
|
||||
$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