Skip to content

Commit

Permalink
Enable DML on Windows and CUDA on Linux for Node.js binding (#19274)
Browse files Browse the repository at this point in the history
This pull request includes modifications to the `c-api-cpu.yml` Azure
Pipelines configuration file. The changes mainly revolve around the
Node.js packaging stage and the handling of Node.js artifacts. The most
significant changes include renaming the Node.js packaging stage, adding
a new dependency to the stage, changing artifact names, adding a new
script to list Node.js artifacts, and updating the source folder for
copying NuGet binaries.

Changes in Node.js packaging:

*
[`tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml`](diffhunk://#diff-00815920cc190d10fdebceac0c3a4b8a59e408684ae38177dfe7f96cae276c59L503-R508):
Renamed the Node.js packaging stage from `Nodejs_Packaging_CPU` to
`Nodejs_Packaging` and added `Windows_CI_GPU_DML_Dev` as a new
dependency to the stage.

Changes in handling of Node.js artifacts:

*
[`tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml`](diffhunk://#diff-00815920cc190d10fdebceac0c3a4b8a59e408684ae38177dfe7f96cae276c59L568-R569):
Changed the artifact name from `drop-onnxruntime-nodejs-win-x64` to
`drop-onnxruntime-nodejs-win-x64-dml` in the task to download pipeline
artifacts for Windows x64.
*
[`tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml`](diffhunk://#diff-00815920cc190d10fdebceac0c3a4b8a59e408684ae38177dfe7f96cae276c59R595-R598):
Added a new script to list Node.js artifacts from the directory
`$(Build.BinariesDirectory)/nodejs-artifacts/win32/x64/`.
*
[`tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml`](diffhunk://#diff-00815920cc190d10fdebceac0c3a4b8a59e408684ae38177dfe7f96cae276c59L635-R640):
Updated the source folder from
`$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64\lib`
to `$(Build.BinariesDirectory)\nodejs-artifacts\win32\x64` in the task
to copy NuGet binaries to the directory
`$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64`.

---------

Co-authored-by: Yulong Wang <[email protected]>
  • Loading branch information
2 people authored and rachguo committed Feb 20, 2024
1 parent 485e17e commit e79a06b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
stages:
- stage: Nodejs_Test_${{ parameters.StageSuffix }}
dependsOn:
- Nodejs_Packaging_CPU
- Nodejs_Packaging
condition: succeeded()
jobs:
- job:
Expand All @@ -18,4 +18,3 @@ stages:
value: '$(Build.BinariesDirectory)'
steps:
- template: test.yml

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parameters:
stages:
- stage: Nodejs_Test_MacOS_${{ parameters.StageSuffix }}
dependsOn:
- Nodejs_Packaging_CPU
- Nodejs_Packaging
condition: succeeded()
jobs:
- job:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
stages:
- stage: Nodejs_Test_${{ parameters.StageSuffix }}
dependsOn:
- Nodejs_Packaging_CPU
- Nodejs_Packaging
condition: succeeded()
jobs:
- job:
Expand Down
57 changes: 20 additions & 37 deletions tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,13 @@ stages:
displayName: 'Clean Agent Directories'
condition: always()

- stage: Nodejs_Packaging_CPU
- stage: Nodejs_Packaging
dependsOn:
- Windows_CI_GPU_DML_Dev
- Windows_CI_GPU_DML_Dev_arm64
- Linux_C_API_Packaging_CPU
- Linux_C_API_Packaging_GPU_TensorRT_x64
- MacOS_C_API_Package_Publish
- Windows_Packaging_CPU_x64_${{ parameters.BuildVariant }}
- Windows_Packaging_CPU_arm64_${{ parameters.BuildVariant }}
condition: succeeded()
jobs:
- job:
Expand All @@ -533,18 +534,6 @@ stages:
workingDirectory: '$(Build.SourcesDirectory)'
displayName: 'Testing: force EOL to lf on windows for /js/**'
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet (Win x64)'
inputs:
artifactName: 'onnxruntime-win-x64'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'

- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet (Win ARM64)'
inputs:
artifactName: 'onnxruntime-win-arm64'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'

- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet (OSX)'
inputs:
Expand All @@ -554,7 +543,7 @@ stages:
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet (Linux x64)'
inputs:
artifactName: 'onnxruntime-linux-x64'
artifactName: 'onnxruntime-linux-x64-tensorrt'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'

- task: DownloadPipelineArtifact@0
Expand All @@ -566,13 +555,13 @@ stages:
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - Nodejs (Win x64)'
inputs:
artifactName: 'drop-onnxruntime-nodejs-win-x64'
artifactName: 'drop-onnxruntime-nodejs-win-x64-dml'
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/win32/x64/'

- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - Nodejs (Win ARM64)'
inputs:
artifactName: 'drop-onnxruntime-nodejs-win-arm64'
artifactName: 'drop-onnxruntime-nodejs-win-arm64-dml'
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/win32/arm64/'

- task: DownloadPipelineArtifact@0
Expand All @@ -590,7 +579,7 @@ stages:
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - Nodejs (Linux x64)'
inputs:
artifactName: 'drop-onnxruntime-nodejs-linux-x64'
artifactName: 'drop-onnxruntime-nodejs-linux-x64-tensorrt'
targetPath: '$(Build.BinariesDirectory)/nodejs-artifacts/linux/x64/'

- task: DownloadPipelineArtifact@0
Expand Down Expand Up @@ -631,38 +620,32 @@ stages:
# Node.js binding win32/x64
- task: CopyFiles@2
displayName: 'Copy nuget binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64\'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64\lib'
Contents: '*.dll'
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64'
- task: CopyFiles@2
displayName: 'Copy nodejs binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64\'
displayName: 'Copy binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64\'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\win32\x64'
Contents: '*.node'
Contents: |
*.dll
*.node
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\x64'

# Node.js binding win32/arm64
- task: CopyFiles@2
displayName: 'Copy nuget binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\arm64\'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-arm64\lib'
Contents: '*.dll'
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\arm64'
- task: CopyFiles@2
displayName: 'Copy nodejs binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\arm64\'
displayName: 'Copy binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\arm64\'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\nodejs-artifacts\win32\arm64'
Contents: '*.node'
Contents: |
*.dll
*.node
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\arm64'

# Node.js binding linux/x64
- task: CopyFiles@2
displayName: 'Copy nuget binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\x64\'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64\lib'
Contents: 'libonnxruntime.so.*'
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-tensorrt\lib'
Contents: |
libonnxruntime.so.*
libonnxruntime_providers_*.so
TargetFolder: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\x64'
- task: CopyFiles@2
displayName: 'Copy nodejs binaries to: $(Build.SourcesDirectory)\js\node\bin\napi-v3\linux\x64\'
Expand Down

0 comments on commit e79a06b

Please sign in to comment.