2021-04-22 00:25:46 +08:00
|
|
|
#!/usr/bin/env pwsh
|
|
|
|
|
2022-03-07 06:41:08 +08:00
|
|
|
param (
|
|
|
|
[switch]$DisableVisualStudioFeatures = $false,
|
|
|
|
[switch]$DisableSilentMode = $false
|
|
|
|
)
|
2021-04-22 00:25:46 +08:00
|
|
|
|
2022-03-07 06:41:08 +08:00
|
|
|
$url = 'https://developer.download.nvidia.com/compute/cuda/11.6.1/network_installers/cuda_11.6.1_windows_network.exe'
|
|
|
|
|
|
|
|
$CudaFeatures = 'nvcc_11.6 cuobjdump_11.6 nvprune_11.6 cupti_11.6 memcheck_11.6 nvdisasm_11.6 nvprof_11.6 ' + `
|
|
|
|
'cublas_11.6 cublas_dev_11.6 nvjpeg_11.6 nvjpeg_dev_11.6 nvtx_11.6 cuxxfilt_11.6 sanitizer_11.6 ' + `
|
|
|
|
'cudart_11.6 cufft_11.6 cufft_dev_11.6 curand_11.6 curand_dev_11.6 cusolver_11.6 cusolver_dev_11.6 ' + `
|
|
|
|
'cusparse_11.6 cusparse_dev_11.6 npp_11.6 npp_dev_11.6 nvrtc_11.6 nvrtc_dev_11.6 nvml_dev_11.6 ' + `
|
|
|
|
'occupancy_calculator_11.6 documentation_11.6 '
|
|
|
|
|
|
|
|
if (-Not $DisableVisualStudioFeatures) {
|
|
|
|
$CudaFeatures = $CudaFeatures + 'visual_studio_integration_11.6 visual_profiler_11.6 '
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($DisableSilentMode) {
|
|
|
|
$SilentFlag = ' '
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$SilentFlag = '-s '
|
|
|
|
}
|
2021-04-22 00:25:46 +08:00
|
|
|
|
|
|
|
try {
|
2022-03-07 06:41:08 +08:00
|
|
|
Push-Location $PSScriptRoot
|
2021-04-22 00:25:46 +08:00
|
|
|
Write-Host 'Downloading CUDA...'
|
2022-03-07 06:41:08 +08:00
|
|
|
Invoke-WebRequest -Uri $url -OutFile "cuda_11.6.1_windows_network.exe"
|
2021-04-22 00:25:46 +08:00
|
|
|
Write-Host 'Installing CUDA...'
|
2022-03-07 06:41:08 +08:00
|
|
|
$proc = Start-Process -PassThru -FilePath "./cuda_11.6.1_windows_network.exe" -ArgumentList @($SilentFlag + $CudaFeatures)
|
2021-04-22 23:03:23 +08:00
|
|
|
$proc.WaitForExit()
|
2021-04-22 00:25:46 +08:00
|
|
|
$exitCode = $proc.ExitCode
|
2022-03-07 06:41:08 +08:00
|
|
|
Pop-Location
|
2021-04-22 00:25:46 +08:00
|
|
|
if ($exitCode -eq 0) {
|
|
|
|
Write-Host 'Installation successful!'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Throw "Installation failed! Exited with $exitCode."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
Throw "Failed to install CUDA! $($_.Exception.Message)"
|
|
|
|
}
|