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-07-01 22:46:41 +08:00
|
|
|
Import-Module -Name $PSScriptRoot/utils.psm1 -Force
|
2022-03-07 06:41:08 +08:00
|
|
|
|
2022-07-01 22:46:41 +08:00
|
|
|
$url = "https://developer.download.nvidia.com/compute/cuda/${cuda_version_full}/network_installers/cuda_${cuda_version_full}_windows_network.exe"
|
|
|
|
|
|
|
|
$CudaFeatures = "nvcc_${cuda_version_short} cuobjdump_${cuda_version_short} nvprune_${cuda_version_short} " + `
|
|
|
|
" cupti_${cuda_version_short} memcheck_${cuda_version_short} nvdisasm_${cuda_version_short} nvprof_${cuda_version_short} " + `
|
|
|
|
" cublas_${cuda_version_short} cublas_dev_${cuda_version_short} nvjpeg_${cuda_version_short} nvjpeg_dev_${cuda_version_short} " + `
|
|
|
|
" nvtx_${cuda_version_short} cuxxfilt_${cuda_version_short} sanitizer_${cuda_version_short} " + `
|
|
|
|
" cudart_${cuda_version_short} cufft_${cuda_version_short} cufft_dev_${cuda_version_short} curand_${cuda_version_short} " + `
|
|
|
|
" curand_dev_${cuda_version_short} cusolver_${cuda_version_short} cusolver_dev_${cuda_version_short} " + `
|
|
|
|
" cusparse_${cuda_version_short} cusparse_dev_${cuda_version_short} npp_${cuda_version_short} npp_dev_${cuda_version_short} " + `
|
|
|
|
" nvrtc_${cuda_version_short} nvrtc_dev_${cuda_version_short} nvml_dev_${cuda_version_short} " + `
|
|
|
|
" occupancy_calculator_${cuda_version_short} documentation_${cuda_version_short} "
|
2022-03-07 06:41:08 +08:00
|
|
|
|
|
|
|
if (-Not $DisableVisualStudioFeatures) {
|
2022-07-01 22:46:41 +08:00
|
|
|
$CudaFeatures = $CudaFeatures + "visual_studio_integration_${cuda_version_short} visual_profiler_${cuda_version_short} "
|
2022-03-07 06:41:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2022-07-01 22:46:41 +08:00
|
|
|
Write-Host "Downloading CUDA from $url..."
|
|
|
|
Invoke-WebRequest -Uri $url -OutFile "cuda_${cuda_version_full}_windows_network.exe"
|
2021-04-22 00:25:46 +08:00
|
|
|
Write-Host 'Installing CUDA...'
|
2022-07-01 22:46:41 +08:00
|
|
|
$proc = Start-Process -PassThru -FilePath "./cuda_${cuda_version_full}_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)"
|
|
|
|
}
|