1 # Copyright (c) Microsoft Corporation.
2 # SPDX-License-Identifier: MIT
4 # REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
6 # REPLACE WITH UTILITY-PREFIX.ps1
8 # REPLACE WITH $CudnnUrl
10 $CudnnLocalZipPath = "$PSScriptRoot\cudnn-11.2-windows-x64-v8.1.1.33.zip"
12 $CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/11.3.0/network_installers/cuda_11.3.0_win10_network.exe'
14 $CudaFeatures = 'nvcc_11.3 cuobjdump_11.3 nvprune_11.3 cupti_11.3 memcheck_11.3 nvdisasm_11.3 nvprof_11.3 ' + `
15 'visual_studio_integration_11.3 visual_profiler_11.3 visual_profiler_11.3 cublas_11.3 cublas_dev_11.3 ' + `
16 'cudart_11.3 cufft_11.3 cufft_dev_11.3 curand_11.3 curand_dev_11.3 cusolver_11.3 cusolver_dev_11.3 ' + `
17 'cusparse_11.3 cusparse_dev_11.3 npp_11.3 npp_dev_11.3 nvrtc_11.3 nvrtc_dev_11.3 nvml_dev_11.3 ' + `
18 'occupancy_calculator_11.3 thrust_11.3 '
20 $destination = "$env:ProgramFiles\NVIDIA GPU Computing Toolkit\CUDA\v11.3"
23 Write-Host 'Downloading CUDA...'
24 [string]$installerPath = Get-TempFilePath -Extension 'exe'
25 curl.exe -L -o $installerPath -s -S $CudaUrl
26 Write-Host 'Installing CUDA...'
27 $proc = Start-Process -FilePath $installerPath -ArgumentList @('-s ' + $CudaFeatures) -Wait -PassThru
28 $exitCode = $proc.ExitCode
29 if ($exitCode -eq 0) {
30 Write-Host 'Installation successful!'
33 Write-Error "Installation failed! Exited with $exitCode."
38 Write-Error "Failed to install CUDA! $($_.Exception.Message)"
43 if ([string]::IsNullOrWhiteSpace($CudnnUrl)) {
44 if (-Not (Test-Path $CudnnLocalZipPath)) {
45 throw "CUDNN zip ($CudnnLocalZipPath) was missing, please download from NVidia and place next to this script."
48 $cudnnZipPath = $CudnnLocalZipPath
50 Write-Host 'Downloading CUDNN...'
51 $cudnnZipPath = Get-TempFilePath -Extension 'zip'
52 curl.exe -L -o $cudnnZipPath -s -S $CudnnUrl
55 Write-Host "Installing CUDNN to $destination..."
56 tar.exe -xvf "$cudnnZipPath" --strip 1 --directory "$destination"
57 Write-Host 'Installation successful!'
60 Write-Error "Failed to install CUDNN! $($_.Exception.Message)"