mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-13 18:08:13 +00:00
- Only set them as targets for the ORT nuget package
- Use OrtPackageId as the condition for inclusion, if installed
- need to do the nuget restore via msbuild so that this property is set correctly
- Add desktop-only version of the C# sln as there is no way to exclude the mobile specific csproj's from an sln
- use this when applicable if someone is running build.py with the `--build_nuget` flag
Other
- remove attempt to include symbols in the nuget package as nuget doesn't support symbols in native packages
- update build.py to use `nuget` and not a windows specific path and filename for a linux build with `--build_nuget`
233 lines
No EOL
9.9 KiB
YAML
233 lines
No EOL
9.9 KiB
YAML
parameters:
|
|
- name: RunOnnxRuntimeTests
|
|
displayName: Run Tests?
|
|
type: boolean
|
|
default: true
|
|
|
|
stages:
|
|
- stage: inference
|
|
dependsOn: []
|
|
jobs:
|
|
- job: 'build'
|
|
pool: 'Win-GPU-2019'
|
|
strategy:
|
|
matrix:
|
|
cuda:
|
|
additionalBuildFlags: --build_java --build_nodejs --use_cuda --cuda_version=11.4 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4" --cudnn_home="C:\local\cudnn-11.4-windows-x64-v8.2.2.26\cuda" --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=52 --gen_doc validate
|
|
EnvSetupScript: setup_env_cuda_11.bat
|
|
ORT_EP_NAME: CUDA
|
|
dml:
|
|
additionalBuildFlags: --use_dml --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 --enable_wcos --use_winml
|
|
EnvSetupScript: setup_env.bat
|
|
ORT_EP_NAME: DML
|
|
variables:
|
|
OrtPackageId: 'Microsoft.ML.OnnxRuntime.Gpu'
|
|
MsbuildArguments: '-maxcpucount'
|
|
TESTONGPU: 'ON'
|
|
OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)'
|
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
|
setVcvars: true
|
|
BuildConfig: 'RelWithDebInfo'
|
|
UseOmp: ''
|
|
buildArch: x64
|
|
msbuildPlatform: x64
|
|
isX86: false
|
|
ALLOW_RELEASED_ONNX_OPSET_ONLY: '0'
|
|
DocUpdateNeeded: false
|
|
timeoutInMinutes: 180
|
|
workspace:
|
|
clean: all
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: '3.7'
|
|
addToPath: true
|
|
architecture: $(buildArch)
|
|
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '12.x'
|
|
force32bit: $(isX86)
|
|
|
|
- task: JavaToolInstaller@0
|
|
#Our build machine doesn't have java x86
|
|
condition: and(succeeded(), eq(variables['buildArch'], 'x64'))
|
|
inputs:
|
|
versionSpec: '11'
|
|
jdkArchitectureOption: $(buildArch)
|
|
jdkSourceOption: 'PreInstalled'
|
|
|
|
- task: BatchScript@1
|
|
displayName: 'setup env'
|
|
inputs:
|
|
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)'
|
|
modifyEnvironment: true
|
|
workingFolder: '$(Build.BinariesDirectory)'
|
|
|
|
- script: |
|
|
set ORT_DOXY_SRC=$(Build.SourcesDirectory)
|
|
set ORT_DOXY_OUT=$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)
|
|
mkdir %ORT_DOXY_SRC%
|
|
mkdir %ORT_DOXY_OUT%
|
|
"C:\Program Files\doxygen\bin\doxygen.exe" $(Build.SourcesDirectory)\tools\ci_build\github\Doxyfile_csharp.cfg
|
|
|
|
workingDirectory: '$(Build.SourcesDirectory)'
|
|
displayName: 'API Documentation Check and generate'
|
|
|
|
- script: |
|
|
python -m pip install -q setuptools wheel numpy
|
|
workingDirectory: '$(Build.BinariesDirectory)'
|
|
displayName: 'Install python modules'
|
|
|
|
- powershell: |
|
|
$Env:USE_MSVC_STATIC_RUNTIME=1
|
|
$Env:ONNX_ML=1
|
|
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
|
|
python setup.py bdist_wheel
|
|
python -m pip uninstall -y onnx -qq
|
|
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
|
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
|
displayName: 'Install ONNX'
|
|
|
|
- task: NuGetToolInstaller@0
|
|
displayName: Use Nuget 5.7.0
|
|
inputs:
|
|
versionSpec: 5.7.0
|
|
|
|
- task: NuGetCommand@2
|
|
displayName: 'NuGet restore'
|
|
inputs:
|
|
command: 'restore'
|
|
feedsToUse: 'config'
|
|
restoreSolution: '$(Build.SourcesDirectory)\packages.config'
|
|
nugetConfigPath: '$(Build.SourcesDirectory)\NuGet.config'
|
|
restoreDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)'
|
|
|
|
- task: PythonScript@0
|
|
displayName: 'Generate cmake config'
|
|
inputs:
|
|
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
|
arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) $(UseOmp) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --enable_onnx_tests $(additionalBuildFlags)'
|
|
workingDirectory: '$(Build.BinariesDirectory)'
|
|
|
|
- task: VSBuild@1
|
|
displayName: 'Build'
|
|
inputs:
|
|
solution: '$(Build.BinariesDirectory)\$(BuildConfig)\onnxruntime.sln'
|
|
platform: $(msbuildPlatform)
|
|
configuration: $(BuildConfig)
|
|
msbuildArgs: $(MsbuildArguments)
|
|
msbuildArchitecture: $(buildArch)
|
|
maximumCpuCount: true
|
|
logProjectEvents: false
|
|
workingFolder: '$(Build.BinariesDirectory)\$(BuildConfig)'
|
|
createLogFile: true
|
|
|
|
- task: PythonScript@0
|
|
displayName: 'Build wheel'
|
|
inputs:
|
|
scriptPath: '$(Build.SourcesDirectory)\setup.py'
|
|
arguments: 'bdist_wheel'
|
|
workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)'
|
|
|
|
- task: MSBuild@1
|
|
displayName: 'Restore NuGet Packages'
|
|
inputs:
|
|
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
|
platform: 'Any CPU'
|
|
configuration: '$(BuildConfig)'
|
|
msbuildArguments: '-t:restore -p:OrtPackageId=$(OrtPackageId)'
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- task: MSBuild@1
|
|
displayName: 'Build C#'
|
|
inputs:
|
|
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
|
platform: 'Any CPU'
|
|
configuration: '$(BuildConfig)'
|
|
msbuildArguments: '-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:DefineConstants=USE_$(ORT_EP_NAME)'
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'Test C#'
|
|
condition: and(and(succeeded(), eq(variables['BuildConfig'], 'RelWithDebInfo')),eq('${{ parameters.RunOnnxRuntimeTests}}', true))
|
|
inputs:
|
|
command: test
|
|
projects: '$(Build.SourcesDirectory)\csharp\test\Microsoft.ML.OnnxRuntime.Tests.NetCoreApp\Microsoft.ML.OnnxRuntime.Tests.NetCoreApp.csproj'
|
|
configuration: '$(BuildConfig)'
|
|
arguments: '--configuration $(BuildConfig) -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:DefineConstants=USE_$(ORT_EP_NAME)'
|
|
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
|
|
|
- powershell: |
|
|
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
|
python $(Build.SourcesDirectory)\tools\ci_build\build.py --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) $(UseOmp) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_wheel --enable_onnx_tests $(additionalBuildFlags)
|
|
workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)'
|
|
condition: and(succeeded(), eq('${{ parameters.RunOnnxRuntimeTests}}', true))
|
|
displayName: 'Run tests'
|
|
|
|
# if the validation from --gen_doc failed it sets a variable so we can publish the latest version of the docs
|
|
# as an artifact, allowing a developer to download this and replace the current version instead of having to build
|
|
# and generate the docs locally themselves. handle each of the two md files separately - simpler than copying
|
|
# them to another location and publishing from there in a single task.
|
|
- task: PublishBuildArtifacts@1
|
|
condition: and(failed(), eq(variables['DocUpdateNeeded'], 'true'))
|
|
inputs:
|
|
pathtoPublish: '$(Build.SourcesDirectory)/docs/OperatorKernels.md'
|
|
artifactName: 'OperatorKernels.md'
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
condition: and(failed(), eq(variables['DocUpdateNeeded'], 'true'))
|
|
inputs:
|
|
pathtoPublish: '$(Build.SourcesDirectory)/docs/ContribOperators.md'
|
|
artifactName: 'ContribOperators.md'
|
|
|
|
|
|
- task: PublishSecurityAnalysisLogs@3
|
|
displayName: 'Publish Security Analysis Logs'
|
|
condition: and(succeeded(), eq(variables['BuildConfig'], 'RelWithDebInfo'))
|
|
inputs:
|
|
ArtifactName: CodeAnalysisLogs
|
|
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish unit test results'
|
|
inputs:
|
|
testResultsFiles: '**/*.results.xml'
|
|
searchFolder: '$(Build.BinariesDirectory)'
|
|
testRunTitle: 'Unit Test Run'
|
|
condition: succeededOrFailed()
|
|
|
|
- template: templates/component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|
|
|
|
- stage: training
|
|
dependsOn: []
|
|
jobs:
|
|
- template: templates/win-ci-2019.yml
|
|
parameters:
|
|
AgentPool : 'Win-GPU-2019'
|
|
JobName: 'Win_GPU_Training'
|
|
# TODO fix test failures and remove --skip_onnx_tests
|
|
BuildCommand: >-
|
|
--build_dir $(Build.BinariesDirectory)
|
|
--build_shared_lib
|
|
--cmake_generator "Visual Studio 16 2019"
|
|
--enable_onnx_tests
|
|
--enable_training
|
|
--skip_onnx_tests
|
|
--skip_submodule_sync
|
|
--use_cuda
|
|
--cuda_version 10.2
|
|
--cuda_home "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2"
|
|
--cudnn_home "C:\local\cudnn-10.2-windows10-x64-v8.0.3.33\cuda"
|
|
--cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=52"
|
|
BuildArch: 'x64'
|
|
EnvSetupScript: 'setup_env_cuda.bat'
|
|
sln_platform: 'x64'
|
|
CudaVersion: '10.2'
|
|
OrtPackageId: 'Microsoft.ML.OnnxRuntime.Gpu'
|
|
BuildConfigurations: ['RelWithDebInfo']
|
|
# Enable unreleased onnx opsets in CI builds
|
|
# This facilitates testing the implementation for the new opsets
|
|
AllowReleasedOpsetOnly: '0'
|
|
DoCompliance: 'true' |