mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-09 17:28:58 +00:00
Release ARM/ARM64 Nuget packages (#2987)
* Enable ARM64 release builds * Add ARM release * Skip C# dll signing in ARM * Copy ARM binaries to Nuget * Restore nuget packages before ARM packaging * wip * Use host protoc at C# build * Set ProtocDirectory on cross-compiled builds * wip * Fix typo
This commit is contained in:
parent
3afb83ac3c
commit
fb2182f3fc
5 changed files with 101 additions and 41 deletions
|
|
@ -27,7 +27,7 @@ CMake creates a target to this project
|
|||
/>
|
||||
<MSBuild Projects="test\Microsoft.ML.OnnxRuntime.Tests\Microsoft.ML.OnnxRuntime.Tests.csproj"
|
||||
Targets="Restore"
|
||||
Properties=""
|
||||
Properties="ProtocDirectory=$(ProtocDirectory)"
|
||||
/>
|
||||
<MSBuild Projects="tools\Microsoft.ML.OnnxRuntime.PerfTool\Microsoft.ML.OnnxRuntime.PerfTool.csproj"
|
||||
Targets="Restore"
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@
|
|||
Visible="false"
|
||||
/>
|
||||
<!-- Some tools to be packaged in nightly build only, should not be released -->
|
||||
<!-- These are copied to the runtimes folder for coveniennce of loading with the dlls -->
|
||||
<!-- These are copied to the runtimes folder for convenience of loading with the dlls -->
|
||||
<None Include="$(NativeBuildOutputDir)\onnxruntime_perf_test.exe"
|
||||
Condition="('$(IsReleaseBuild)' != 'true') And ($(TargetArchitecture)=='x64') And Exists('$(NativeBuildOutputDir)\onnxruntime_perf_test.exe')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<Platforms>AnyCPU;x86</Platforms>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Windows</OnnxRuntimeBuildDirectory>
|
||||
<ProtocDirectory>$(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration)</ProtocDirectory>
|
||||
<ProtocDirectory Condition="'$(ProtocDirectory)'==''">$(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration)</ProtocDirectory>
|
||||
<ProtoSrc>$(OnnxRuntimeCsharpRoot)\..\onnxruntime\core\protobuf</ProtoSrc>
|
||||
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,48 @@ jobs:
|
|||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
- template: ../../templates/win-ci-2019.yml
|
||||
parameters:
|
||||
AgentPool : 'Win-CPU-2019'
|
||||
ArtifactName: 'drop-win-arm64-zip'
|
||||
JobName: 'Windows_CI_Dev_arm64'
|
||||
BuildCommand: '--build_dir $(Build.BinariesDirectory) --skip_submodule_sync --use_openmp --build_shared_lib --use_featurizers --enable_onnx_tests --arm64 --use_telemetry --use_winml --cmake_generator "Visual Studio 16 2019"'
|
||||
BuildArch: 'x64'
|
||||
EnvSetupScript: 'setup_env.bat'
|
||||
sln_platform: 'arm64'
|
||||
DoDebugBuild: 'false'
|
||||
DoNugetPack : 'true'
|
||||
DoCompliance: ${{ parameters.DoCompliance }}
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /p:TargetArchitecture=arm64 /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release /t:CreatePackage
|
||||
cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\
|
||||
ren *.nupkg win-arm64.zip
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
- template: ../../templates/win-ci-2019.yml
|
||||
parameters:
|
||||
AgentPool : 'Win-CPU-2019'
|
||||
ArtifactName: 'drop-win-arm-zip'
|
||||
JobName: 'Windows_CI_Dev_arm'
|
||||
BuildCommand: '--build_dir $(Build.BinariesDirectory) --skip_submodule_sync --use_openmp --build_shared_lib --use_featurizers --enable_onnx_tests --arm --use_telemetry --use_winml --cmake_generator "Visual Studio 16 2019"'
|
||||
BuildArch: 'x64'
|
||||
EnvSetupScript: 'setup_env.bat'
|
||||
sln_platform: 'arm'
|
||||
DoDebugBuild: 'false'
|
||||
DoNugetPack : 'true'
|
||||
DoCompliance: ${{ parameters.DoCompliance }}
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /p:TargetArchitecture=arm /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release /t:CreatePackage
|
||||
cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\
|
||||
ren *.nupkg win-arm.zip
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
- job: 'Linux_CI_Dev'
|
||||
workspace:
|
||||
clean: all
|
||||
|
|
@ -128,6 +170,18 @@ jobs:
|
|||
artifactName: 'drop-win-x86-zip'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
||||
|
||||
- task: DownloadPipelineArtifact@0
|
||||
displayName: 'Download Pipeline Artifact - Win-arm64'
|
||||
inputs:
|
||||
artifactName: 'drop-win-arm64-zip'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
||||
|
||||
- task: DownloadPipelineArtifact@0
|
||||
displayName: 'Download Pipeline Artifact - Win-arm'
|
||||
inputs:
|
||||
artifactName: 'drop-win-arm-zip'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
||||
|
||||
- task: DownloadPipelineArtifact@0
|
||||
displayName: 'Download Pipeline Artifact - Linux'
|
||||
inputs:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ parameters:
|
|||
DoEsrp: 'false'
|
||||
DoTestCoverage: 'false'
|
||||
BuildArch: 'x64' # Optional. Options: x86, x64
|
||||
sln_platform: 'x64' # Options: Win32, x64
|
||||
sln_platform: 'x64' # Options: Win32, x64, arm, arm64
|
||||
EnvSetupScript: 'setup_env.bat'
|
||||
CudaVersion: ''
|
||||
AgentPool: 'Win-CPU-2019'
|
||||
|
|
@ -72,6 +72,11 @@ jobs:
|
|||
arguments: '$(BuildCommand) --update --config RelWithDebInfo'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
|
||||
- ${{ if notIn(parameters['sln_platform'], 'Win32', 'x64') }}:
|
||||
# Use cross-compiled protoc
|
||||
- script: |
|
||||
@echo ##vso[task.setvariable variable=ProtocDirectory]$(Build.BinariesDirectory)\host_protoc\Release
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build'
|
||||
inputs:
|
||||
|
|
@ -93,14 +98,7 @@ jobs:
|
|||
- task: NuGetToolInstaller@0
|
||||
displayName: Use Nuget 4.9
|
||||
inputs:
|
||||
versionSpec: 4.9.4
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Download test data'
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\github\download_test_data.py'
|
||||
arguments: --test_data_url $(TestDataUrl) --build_dir $(Build.BinariesDirectory)
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
versionSpec: 4.9.4
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Restore nuget packages'
|
||||
|
|
@ -109,45 +107,53 @@ jobs:
|
|||
projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
configuration: 'RelWithDebInfo'
|
||||
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId }}'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Build C#'
|
||||
displayName: 'Build C#'
|
||||
inputs:
|
||||
command: build
|
||||
projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
|
||||
configuration: 'RelWithDebInfo'
|
||||
configuration: 'RelWithDebInfo'
|
||||
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=${{ parameters.OrtPackageId }}'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Test C#'
|
||||
inputs:
|
||||
command: test
|
||||
projects: '$(Build.SourcesDirectory)\csharp\test\Microsoft.ML.OnnxRuntime.Tests\Microsoft.ML.OnnxRuntime.Tests.csproj'
|
||||
configuration: 'RelWithDebInfo'
|
||||
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=${{ parameters.OrtPackageId }}'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
- ${{ if in(parameters['sln_platform'], 'Win32', 'x64') }}:
|
||||
- task: PythonScript@0
|
||||
displayName: 'Download test data'
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\github\download_test_data.py'
|
||||
arguments: --test_data_url $(TestDataUrl) --build_dir $(Build.BinariesDirectory)
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
|
||||
- script: |
|
||||
mklink /D /J $(Build.BinariesDirectory)\RelWithDebInfo\models $(Build.BinariesDirectory)\models
|
||||
DIR dist\ /S /B > wheel_filename_file
|
||||
set /p WHEEL_FILENAME=<wheel_filename_file
|
||||
del wheel_filename_file
|
||||
python.exe -m pip install -q --upgrade %WHEEL_FILENAME%
|
||||
set PATH=%PATH%;$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo
|
||||
@echo %PATH%
|
||||
python $(Build.SourcesDirectory)\tools\ci_build\build.py $(BuildCommand) --test --config RelWithDebInfo
|
||||
workingDirectory: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
||||
displayName: 'Run tests'
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Test C#'
|
||||
inputs:
|
||||
command: test
|
||||
projects: '$(Build.SourcesDirectory)\csharp\test\Microsoft.ML.OnnxRuntime.Tests\Microsoft.ML.OnnxRuntime.Tests.csproj'
|
||||
configuration: 'RelWithDebInfo'
|
||||
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=${{ parameters.OrtPackageId }}'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish unit test results'
|
||||
inputs:
|
||||
testResultsFiles: '**\*.results.xml'
|
||||
searchFolder: '$(Build.BinariesDirectory)'
|
||||
testRunTitle: 'Unit Test Run'
|
||||
condition: succeededOrFailed()
|
||||
- script: |
|
||||
mklink /D /J $(Build.BinariesDirectory)\RelWithDebInfo\models $(Build.BinariesDirectory)\models
|
||||
DIR dist\ /S /B > wheel_filename_file
|
||||
set /p WHEEL_FILENAME=<wheel_filename_file
|
||||
del wheel_filename_file
|
||||
python.exe -m pip install -q --upgrade %WHEEL_FILENAME%
|
||||
set PATH=%PATH%;$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo
|
||||
@echo %PATH%
|
||||
python $(Build.SourcesDirectory)\tools\ci_build\build.py $(BuildCommand) --test --config RelWithDebInfo
|
||||
workingDirectory: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
||||
displayName: 'Run tests'
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish unit test results'
|
||||
inputs:
|
||||
testResultsFiles: '**\*.results.xml'
|
||||
searchFolder: '$(Build.BinariesDirectory)'
|
||||
testRunTitle: 'Unit Test Run'
|
||||
condition: succeededOrFailed()
|
||||
|
||||
# Nuget packaging if needed
|
||||
- ${{ if eq(parameters['DoNugetPack'], 'true') }}:
|
||||
|
|
|
|||
Loading…
Reference in a new issue