You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/10/13 22:43:17 UTC

[GitHub] [incubator-mxnet-ci] josephevans commented on a change in pull request #37: Update AMI generation tools. Add configs for Windows AMIs with Cuda 11.4.

josephevans commented on a change in pull request #37:
URL: https://github.com/apache/incubator-mxnet-ci/pull/37#discussion_r728499014



##########
File path: tools/ami-creator/userdata/mxnetwindows_cpu_win2019_cuda114.txt
##########
@@ -0,0 +1,98 @@
+<powershell>
+$ErrorActionPreference = "Stop"
+Set-StrictMode -Version Latest
+function Check-Call {
+    param (
+        [scriptblock]$ScriptBlock
+    )
+    Write-Host "Executing $ScriptBlock"
+    & @ScriptBlock
+    if (($lastexitcode -ne 0)) {
+        Write-Error "Execution failed with $lastexitcode"
+        exit $lastexitcode
+    }
+}
+Set-ExecutionPolicy Bypass -Scope Process -Force
+
+# install ssh server and client, enable auto-startup, and start services
+Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
+Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
+Set-Service -Name ssh-agent -StartupType ‘Automatic’
+Set-Service -Name sshd -StartupType ‘Automatic’
+Start-Service ssh-agent
+Start-Service sshd
+
+# setup administrator ssh key
+Invoke-WebRequest -Uri http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key -OutFile C:\ProgramData\ssh\administrators_authorized_keys
+icacls C:\ProgramData\ssh\administrators_authorized_keys /inheritance:r
+icacls C:\ProgramData\ssh\administrators_authorized_keys /grant "Administrators:(F)"
+Restart-Service -Name sshd, ssh-agent -Force
+
+# install chocolatey
+Invoke-WebRequest -Uri https://chocolatey.org/install.ps1 -OutFile install.ps1
+./install.ps1
+refreshenv
+Remove-Item -path ./install.ps1 -force
+
+# install dependencies
+Check-Call { C:\ProgramData\chocolatey\choco install python --version=3.8.12 --force -y --no-progress }
+refreshenv
+Check-Call { C:\Python37\python -m pip install --upgrade pip  }
+Invoke-WebRequest -Uri https://raw.githubusercontent.com/aiengines/ci/master/ami_generation/windows/requirements.txt -OutFile requirements.txt
+Check-Call { C:\Python37\python -m pip install -r requirements.txt  }
+
+Check-Call { C:\ProgramData\chocolatey\choco install git -y }
+Check-Call { C:\ProgramData\chocolatey\choco install 7zip -y }
+Check-Call { C:\ProgramData\chocolatey\choco install cmake -y }
+Check-Call { C:\ProgramData\chocolatey\choco install ninja -y }
+refreshenv
+Check-Call { C:\ProgramData\chocolatey\choco install javaruntime -y }
+refreshenv
+
+# get jenkins slave connect scripts
+Invoke-WebRequest -Uri https://windows-post-install.s3-us-west-2.amazonaws.com/slave-autoconnect.py -OutFile C:\slave-autoconnect.py
+Invoke-WebRequest -Uri https://windows-post-install.s3-us-west-2.amazonaws.com/run-auto-connect.bat -OutFile C:\run-auto-connect.bat
+
+# create required directories
+New-Item -ItemType directory -Path C:\jenkins_slave
+New-Item -ItemType directory -Path C:\jenkins_slave\workspace
+
+# setup jenkins slave autoconnect script at startup
+$progressPreference = 'silentlyContinue'
+$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay 00:00:30
+$action = New-ScheduledTaskAction -Execute C:\run-auto-connect.bat
+$principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
+Register-ScheduledTask -TaskName "JenkinsAutoConnect" -Description "Connect to Jenkins at startup" -Action $action -Trigger $trigger -Principal $principal
+
+# create second stage powershell script
+Set-Content -Path C:\Users\Administrator\stage2.ps1 -Value @'
+$ErrorActionPreference = "Stop"
+Set-StrictMode -Version Latest
+function Check-Call {
+    param (
+        [scriptblock]$ScriptBlock
+    )
+    Write-Host "Executing $ScriptBlock"
+    & @ScriptBlock
+    if (($lastexitcode -ne 0)) {
+        Write-Error "Execution failed with $lastexitcode"
+        exit $lastexitcode
+    }
+}
+Set-ExecutionPolicy Bypass -Scope Process -Force
+cd C:\Users\Administrator
+Invoke-WebRequest -Uri https://windows-post-install.s3-us-west-2.amazonaws.com/win2019_cuda114_installer.py -OutFile C:\Users\Administrator\windows_deps_headless_installer.py

Review comment:
       We install Cuda on both CPU and GPU Windows AMI, the only difference is the NVidia driver that gets installed on the GPU systems.
   
   We do this because we use the CPU images to build both CPU and GPU images, but then use only the GPU image for testing GPU builds.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org