diff --git a/scripts/install-cuda.ps1 b/scripts/install-cuda.ps1 index 09d6054..6534932 100644 --- a/scripts/install-cuda.ps1 +++ b/scripts/install-cuda.ps1 @@ -233,18 +233,28 @@ if ($DownloadOnly) { Write-Step "Installation (UAC et acceptation de la licence NVIDIA demandees)" Write-Host " Choisir l'installation PERSONNALISEE et decocher tout composant pilote graphique" -ForegroundColor Yellow Write-Host " s'il est propose, pour conserver le pilote actuel." -ForegroundColor Yellow +Write-Host " Installateur : $installer" +# Le code de retour de l'installateur NVIDIA n'est pas documente et n'est pas fiable +# (code 8 observe alors que l'installation manuelle fonctionne) : seule la presence de +# nvcc apres coup fait foi. $process = Start-Process -FilePath $installer -Wait -PassThru -if ($process.ExitCode -ne 0) { throw "L'installateur NVIDIA a retourne le code $($process.ExitCode)." } +$exitCode = $process.ExitCode +if ($exitCode -ne 0) { + Write-Host " L'installateur NVIDIA a retourne le code $exitCode (non documente) : verification de l'installation..." -ForegroundColor Yellow +} # --- Verification ----------------------------------------------------------- Write-Step "Verification" -$cudaPath = [Environment]::GetEnvironmentVariable("CUDA_PATH", "Machine") -$nvcc = if ($cudaPath) { Join-Path $cudaPath "bin\nvcc.exe" } else { $null } -if (-not $nvcc -or -not (Test-Path $nvcc)) { - $latest = @(Get-InstalledCuda) | Select-Object -First 1 - if (-not $latest) { throw "nvcc introuvable apres installation." } - $nvcc = Join-Path $latest.Path "bin\nvcc.exe" +$installedNow = @(Get-InstalledCuda) | Where-Object { $_.Version.Major -eq $wanted.Major -and $_.Version.Minor -eq $wanted.Minor } | Select-Object -First 1 +if (-not $installedNow) { + Write-Host "" + Write-Host "CUDA $($wanted.Major).$($wanted.Minor) n'est pas installe (code de l'installateur : $exitCode)." -ForegroundColor Red + Write-Host "L'installateur verifie reste dans le cache. Le lancer a la main (double-clic) :" -ForegroundColor Yellow + Write-Host " $installer" + Write-Host "puis relancer ce script pour verifier l'installation." + exit 1 } +$nvcc = Join-Path $installedNow.Path "bin\nvcc.exe" & $nvcc --version Write-Host "" Write-Host "CUDA installe. L'installateur peut etre supprime du cache : $installer" -ForegroundColor Green