Skip to content

Commit

Permalink
unify the steps of downloading cuda sdk and setup env (microsoft#16896)
Browse files Browse the repository at this point in the history
### Description
The `%AGENT_TEMPDIRECTORY%\v11.8` is created in azcopy step.
So, the set env step should be after the azcopy step.

### Motivation and Context
Correct the previous logic
Unify the step since multiple jobs are using it.
  • Loading branch information
mszhanyi authored Jul 31, 2023
1 parent 5076436 commit 28a099f
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 59 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
parameters:
- name: EnvSetupScript
type: string

- name: DownloadCUDA
type: boolean
default: false

steps:
- ${{ if eq(parameters.DownloadCUDA, 'true') }}:
- powershell: |
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v11.8" $(Agent.TempDirectory)
- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\${{ parameters.EnvSetupScript }}'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ parameters:
- name: OnnxruntimeTestGpuDeviceId
type: number
default: 0


jobs:
- job: build_${{ parameters.job_name_suffix }}
Expand Down Expand Up @@ -108,6 +108,7 @@ jobs:
versionSpec: '16.x'
force32bit: ${{ parameters.isX86 }}


# Our build machine doesn't have java x86
- ${{ if eq(parameters.buildArch, 'x64') }}:
- task: JavaToolInstaller@0
Expand All @@ -116,12 +117,11 @@ jobs:
jdkArchitectureOption: ${{ parameters.buildArch }}
jdkSourceOption: 'PreInstalled'

- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\${{ parameters.EnvSetupScript }}'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
- template: set-winenv.yml
parameters:
EnvSetupScript: ${{ parameters.EnvSetupScript }}
${{ if contains(parameters.additionalBuildFlags, 'use_cuda') }}:
DownloadCUDA: true

- script: |
set ORT_DOXY_SRC=$(Build.SourcesDirectory)
Expand All @@ -137,10 +137,6 @@ jobs:
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- ${{ if contains(parameters.additionalBuildFlags, 'use_cuda') }}:
- powershell: |
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v11.8" $(Agent.TempDirectory)
- ${{ if eq(parameters.WITH_CACHE, true) }}:
- powershell: |
if ([string]::IsNullOrEmpty((Get-Command ccache -errorAction SilentlyContinue)))
Expand Down
13 changes: 4 additions & 9 deletions tools/ci_build/github/azure-pipelines/templates/py-win-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ jobs:
tsaConfigFilePath: '$(Build.SourcesDirectory)\.config\tsaoptions.json'
appendSourceBranchName: false

- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\${{ parameters.ENV_SETUP_SCRIPT }}'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'

- task: PythonScript@0
inputs:
scriptSource: inline
Expand All @@ -68,8 +61,10 @@ jobs:

- template: download-deps.yml

- powershell: |
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v11.8" $(Agent.TempDirectory)
- template: jobs/set-winenv.yml
parameters:
EnvSetupScript: ${{ parameters.ENV_SETUP_SCRIPT }}
DownloadCUDA: true

- task: PythonScript@0
displayName: 'Update deps.txt'
Expand Down
15 changes: 5 additions & 10 deletions tools/ci_build/github/azure-pipelines/templates/win-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ stages:
inputs:
versionSpec: '16.x'

- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\${{ parameters.EnvSetupScript }}'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
- template: jobs/set-winenv.yml
parameters:
EnvSetupScript: ${{ parameters.EnvSetupScript }}
${{ if contains(parameters.buildparameter, 'use_cuda') }}:
DownloadCUDA: true

- template: download-deps.yml

Expand All @@ -121,10 +120,6 @@ stages:

- template: set-version-number-variables-step.yml

- ${{ if contains(parameters.buildparameter, 'use_cuda') }}:
- powershell: |
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v11.8" $(Agent.TempDirectory)
- task: PythonScript@0
displayName: 'Generate cmake config'
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,20 @@ jobs:
clean: all
steps:
- task: UsePythonVersion@0
inputs:
inputs:
versionSpec: '3.8'
addToPath: true
architecture: $(buildArch)

- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'

- script: |
python -m pip install -q setuptools wheel numpy flatbuffers
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Install python modules'
- powershell: |
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v11.8" $(Agent.TempDirectory)
- template: templates/jobs/set-winenv.yml
parameters:
EnvSetupScript: $(EnvSetupScript)
DownloadCUDA: true

- task: PowerShell@2
displayName: 'Install ONNX'
Expand All @@ -58,4 +53,3 @@ jobs:
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'

Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ jobs:
addToPath: true
architecture: $(buildArch)

- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'

- script: |
python -m pip install -q setuptools wheel numpy
workingDirectory: '$(Build.BinariesDirectory)'
Expand All @@ -43,16 +36,10 @@ jobs:
arguments: --new_dir $(Build.BinariesDirectory)/deps
workingDirectory: $(Build.BinariesDirectory)

- powershell: |
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v11.8" $(Agent.TempDirectory)
displayName: 'Download CUDA SDK'
- task: BatchScript@1
displayName: 'setup env'
inputs:
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)'
modifyEnvironment: true
workingFolder: '$(Build.BinariesDirectory)'
- template: templates/jobs/set-winenv.yml
parameters:
EnvSetupScript: $(EnvSetupScript)
DownloadCUDA: true

- task: PowerShell@2
displayName: 'Install ONNX'
Expand Down
9 changes: 8 additions & 1 deletion tools/ci_build/github/windows/setup_env_trt.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
set PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\extras\CUPTI\lib64;%PATH%
REM Copyright (c) Microsoft Corporation. All rights reserved.
REM Licensed under the MIT License.

if exist PATH=%AGENT_TEMPDIRECTORY%\v11.8\ {
set PATH=%AGENT_TEMPDIRECTORY%\v11.8\bin;%AGENT_TEMPDIRECTORY%\v11.8\extras\CUPTI\lib64;%PATH%
} else {
set PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\extras\CUPTI\lib64;%PATH%
}
set GRADLE_OPTS=-Dorg.gradle.daemon=false

0 comments on commit 28a099f

Please sign in to comment.