Skip to content

Instantly share code, notes, and snippets.

@ezyang
Created April 24, 2019 15:10
Show Gist options
  • Select an option

  • Save ezyang/aa12f2e68bf80ef7ed022d01bf881105 to your computer and use it in GitHub Desktop.

Select an option

Save ezyang/aa12f2e68bf80ef7ed022d01bf881105 to your computer and use it in GitHub Desktop.
commit 841d4b9c81b06178f83adc0ee3ff78fa4fc0ca41
Author: Edward Z. Yang <[email protected]>
Date: Wed Apr 24 11:10:07 2019 -0400
Install VS 2019 on all Windows images.
Signed-off-by: Edward Z. Yang <[email protected]>
diff --git a/packer-windows/jenkins-win2012r2.json b/packer-windows/jenkins-win2012r2.json
index ee3af65..b713f96 100644
--- a/packer-windows/jenkins-win2012r2.json
+++ b/packer-windows/jenkins-win2012r2.json
@@ -76,6 +76,17 @@
},
{
"type": "powershell",
+ "valid_exit_codes": [0, 3010],
+ "scripts": [
+ "./scripts/SetUpVisualStudio2019.ps1"
+ ]
+ },
+ {
+ "type": "windows-restart",
+ "restart_timeout": "30m"
+ },
+ {
+ "type": "powershell",
"scripts": [
"./scripts/SetUpLLVM.ps1",
"./scripts/SetUpCUDA.ps1",
diff --git a/packer-windows/jenkins-win2016.json b/packer-windows/jenkins-win2016.json
index 9c21fc4..e171bd8 100644
--- a/packer-windows/jenkins-win2016.json
+++ b/packer-windows/jenkins-win2016.json
@@ -76,6 +76,17 @@
},
{
"type": "powershell",
+ "valid_exit_codes": [0, 3010],
+ "scripts": [
+ "./scripts/SetUpVisualStudio2019.ps1"
+ ]
+ },
+ {
+ "type": "windows-restart",
+ "restart_timeout": "30m"
+ },
+ {
+ "type": "powershell",
"scripts": [
"./scripts/SetUpLLVM.ps1",
"./scripts/SetUpCUDA.ps1",
diff --git a/packer-windows/scripts/SetUpCUDA.ps1 b/packer-windows/scripts/SetUpCUDA.ps1
index 6d3357a..4eb8590 100644
--- a/packer-windows/scripts/SetUpCUDA.ps1
+++ b/packer-windows/scripts/SetUpCUDA.ps1
@@ -174,3 +174,30 @@ Unzip "X:\${base}.zip" "X:\${base}"
Remove-Item -Path "X:\${base}.zip"
xcopy "X:\${base}\cuda" 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0' /e /y
Remove-Item "X:\${base}" -Force -Recurse
+
+# Install CUDA 10.1
+Set-Location -Path "X:/"
+$base = "cuda_10.1.105_418.96_${suffix}"
+$url = "${baseURL}/${base}.exe"
+echo "Downloading ${url}"
+curl.exe -k -O "${url}"
+$bin = "./${base}.exe"
+If(!(Test-Path ${base})) {
+ New-Item -ItemType Directory -Force -Path ${base}
+}
+Set-Location -Path "X:/${base}"
+echo "Running ${bin}"
+7z x ../${bin}
+Remove-Item -Path "X:/${bin}"
+./setup.exe -s nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 gpu_library_advisor_10.1 memcheck_10.1 nvdisasm_10.1 nvprof_10.1 visual_profiler_10.1 visual_studio_integration_10.1 demo_suite_10.1 documentation_10.1 cublas_10.1 cublas_dev_10.1 cudart_10.1 cufft_10.1 cufft_dev_10.1 curand_10.1 curand_dev_10.1 cusolver_10.1 cusolver_dev_10.1 cusparse_10.1 cusparse_dev_10.1 nvgraph_10.1 nvgraph_dev_10.1 npp_10.1 npp_dev_10.1 nvrtc_10.1 nvrtc_dev_10.1 nvml_dev_10.1 occupancy_calculator_10.1 fortran_examples_101 | Out-Null
+
+# Install cuDNN for CUDA 10.1
+Set-Location -Path "X:/"
+$base = "cudnn-10.1-${cudnnSuffix}-v7.5.1.10"
+$url = "${baseURL}/${base}.zip"
+echo "Downloading ${url}"
+curl.exe -k -O "${url}"
+Unzip "X:\${base}.zip" "X:\${base}"
+Remove-Item -Path "X:\${base}.zip"
+xcopy "X:\${base}\cuda" 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1' /e /y
+Remove-Item "X:\${base}" -Force -Recurse
diff --git a/packer-windows/scripts/SetUpVisualStudio2019.ps1 b/packer-windows/scripts/SetUpVisualStudio2019.ps1
new file mode 100644
index 0000000..0637c2b
--- /dev/null
+++ b/packer-windows/scripts/SetUpVisualStudio2019.ps1
@@ -0,0 +1,25 @@
+Set-Location -Path "${env:TEMP}"
+
+# Download
+$execFile = 'vs_community_2019.exe'
+$url = "https://s3.amazonaws.com/ossci-windows/${execFile}"
+echo "Downloading ${url}"
+curl "https://s3.amazonaws.com/ossci-windows/${execFile}" -OutFile "${execFile}"
+
+# Run
+$path = "./$execFile"
+$params = @(
+"--quiet",
+"--norestart",
+"--wait",
+"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
+"--add", "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
+"--add", "Microsoft.VisualStudio.Component.Windows10SDK.17763",
+"--add", "Microsoft.VisualStudio.Component.VC.CMake.Project",
+"--add", "Microsoft.VisualStudio.Component.VC.ATL",
+"--add", "Microsoft.VisualStudio.Component.VC.140"
+)
+
+echo "Running $path $params"
+& $path $params | Out-Null
+echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment