Skip to content

Commit

Permalink
Merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanUnderhill committed May 1, 2024
2 parents eecf360 + f94280f commit 8c2ecbe
Show file tree
Hide file tree
Showing 30 changed files with 444 additions and 150 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/linux-cpu-arm64-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: "Linux CPU ARM64 Build"
on: [ workflow_dispatch, pull_request ]
on:
workflow_dispatch:
push:
branches:
- main
- rel-*
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
60 changes: 48 additions & 12 deletions .github/workflows/linux-cpu-x64-build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
name: "Linux CPU x64 Build"
on: [ workflow_dispatch, pull_request ]
on:
workflow_dispatch:
push:
branches:
- main
- rel-*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
ort_dir: "onnxruntime-linux-x64-1.17.3"
ort_zip: "onnxruntime-linux-x64-1.17.3.tgz"
ort_url: "https://github.com/microsoft/onnxruntime/releases/download/v1.17.3/onnxruntime-linux-x64-1.17.3.tgz"

ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime&api-version=6.0-preview.1"
ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime"
ORT_NIGHTLY_SOURCE: "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json"
NUGET_EXE: "mono /usr/local/bin/nuget.exe"
jobs:
linux_cpu_x64:
runs-on: [ "self-hosted", "1ES.Pool=onnxruntime-genai-Ubuntu2204-AMD-CPU" ]
Expand All @@ -16,19 +22,49 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true
- name: install Mono and Nuget
run: |
sudo apt install ca-certificates gnupg
sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install -y mono-devel
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
sudo chmod +x /usr/local/bin/nuget.exe
- name: Install jq and dotnet
run: |
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0 jq
- name: Download OnnxRuntime
- name: Get the Latest OnnxRuntime Nightly Version
run: |
curl -L -o ${{ env.ort_zip }} ${{ env.ort_url }}
ORT_NIGHTLY_VERSION=$(curl -s "${{ env.ORT_NIGHTLY_REST_API }}" | jq -r '.value[0].versions[0].normalizedVersion')
echo "$ORT_NIGHTLY_VERSION"
echo "ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" >> $GITHUB_ENV
- name: Unzip OnnxRuntime
- name: Download OnnxRuntime Nightly
run: |
tar -xzf ${{ env.ort_zip }}
rm ${{ env.ort_zip }}
${{ env.NUGET_EXE }} install ${{ env.ORT_PACKAGE_NAME }} -version ${{ env.ORT_NIGHTLY_VERSION }} -x
continue-on-error: true

- name: list files
shell: bash
run: |
ls -l
ls -R ${{ env.ORT_PACKAGE_NAME }}
continue-on-error: true

- name: Rename OnnxRuntime to ort
# TODO: Find out why do we need to to have libonnxruntime.so.$ort_version
- name: Extra OnnxRuntime library and header files
run: |
mv ${{ env.ort_dir }} ort
mkdir -p ort/lib
mv ${{ env.ORT_PACKAGE_NAME }}/build/native/include ort/
mv ${{ env.ORT_PACKAGE_NAME }}/runtimes/linux-x64/native/* ort/lib/
ort_version=$(echo ${{ env.ORT_NIGHTLY_VERSION }} | cut -d- -f1-1)
cp ort/lib/libonnxruntime.so ort/lib/libonnxruntime.so.$ort_version
- name: Build with CMake and GCC
run: |
Expand Down
60 changes: 49 additions & 11 deletions .github/workflows/linux-gpu-x64-build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
name: "Linux CUDA x64 Build"
on: [ workflow_dispatch, pull_request ]
on:
workflow_dispatch:
push:
branches:
- main
- rel-*
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
ort_dir: "onnxruntime-linux-x64-gpu-1.17.3"
ort_zip: "onnxruntime-linux-x64-gpu-1.17.3.tgz"
ort_url: "https://github.com/microsoft/onnxruntime/releases/download/v1.17.3/onnxruntime-linux-x64-gpu-1.17.3.tgz"
ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime.Gpu.Linux&api-version=6.0-preview.1"
ORT_PACKAGE_NAME: Microsoft.ML.OnnxRuntime.Gpu.Linux
ORT_NIGHTLY_SOURCE: "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json"
NUGET_EXE: "mono /usr/local/bin/nuget.exe"


jobs:
linux-cuda-x64-build:
Expand All @@ -29,19 +37,49 @@ jobs:
clean: true
path: manylinux
submodules: true
- name: install Mono and Nuget
run: |
sudo apt install ca-certificates gnupg
sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install -y mono-devel
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
sudo chmod +x /usr/local/bin/nuget.exe
- name: Install jq and dotnet
run: |
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0 jq
- name: Download OnnxRuntime
run: |
curl -L -o ${{ env.ort_zip }} ${{ env.ort_url }}
ORT_NIGHTLY_VERSION=$(curl -s "${{ env.ORT_NIGHTLY_REST_API }}" | jq -r '.value[0].versions[0].normalizedVersion')
echo "$ORT_NIGHTLY_VERSION"
echo "ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" >> $GITHUB_ENV
- name: Unzip OnnxRuntime
- name: Download OnnxRuntime Nightly
run: |
mono /usr/local/bin/nuget.exe install ${{ env.ORT_PACKAGE_NAME }} -version ${{ env.ORT_NIGHTLY_VERSION }} -x
continue-on-error: true
- name: list files
shell: bash
run: |
tar -xzf ${{ env.ort_zip }}
rm ${{ env.ort_zip }}
ls -l
ls -R ${{ env.ORT_PACKAGE_NAME }}
continue-on-error: true

- name: Rename OnnxRuntime to ort
# TODO: Find out why do we need to to have libonnxruntime.so.$ort_version
- name: Extra OnnxRuntime library and header files
run: |
mv ${{ env.ort_dir }} ort
mkdir -p ort/lib
mv ${{ env.ORT_PACKAGE_NAME }}/buildTransitive/native/include ort/
mv ${{ env.ORT_PACKAGE_NAME }}/runtimes/linux-x64/native/* ort/lib/
ort_version=$(echo ${{ env.ORT_NIGHTLY_VERSION }} | cut -d- -f1-1)
cp ort/lib/libonnxruntime.so ort/lib/libonnxruntime.so.$ort_version
- name: Get Docker Image
run: |
Expand Down Expand Up @@ -78,7 +116,7 @@ jobs:
--volume $GITHUB_WORKSPACE:/ort_genai_src \
-w /ort_genai_src onnxruntimecudabuildx64 \
bash -c " \
/usr/bin/cmake --build --preset linux_gcc_cuda_release --parallel $( nproc )"
/usr/bin/cmake --build --preset linux_gcc_cuda_release"
- name: Get HuggingFace Token
run: |
Expand Down
34 changes: 19 additions & 15 deletions .github/workflows/mac-cpu-arm64-build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: "MacOS CPU ARM64 Build"
on: [ workflow_dispatch, pull_request ]
on:
workflow_dispatch:
push:
branches:
- main
- rel-*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
ort_dir: "onnxruntime-osx-arm64-1.17.3"
ort_zip: "onnxruntime-osx-arm64-1.17.3.tgz"
ort_url: "https://github.com/microsoft/onnxruntime/releases/download/v1.17.3/onnxruntime-osx-arm64-1.17.3.tgz"
ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime&api-version=6.0-preview.1"
ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime"
jobs:
mac-cpu-arm64-build:
runs-on: macos-latest
Expand All @@ -16,22 +21,21 @@ jobs:
with:
submodules: true

- name: Install ninja
- name: Get the Latest OnnxRuntime Nightly Version
run: |
brew install ninja
- name: Download OnnxRuntime
ORT_NIGHTLY_VERSION=$(curl -s "${{ env.ORT_NIGHTLY_REST_API }}" | jq -r '.value[0].versions[0].normalizedVersion')
echo "$ORT_NIGHTLY_VERSION"
echo "ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" >> $GITHUB_ENV
- name: Download OnnxRuntime Nightly
run: |
curl -L -o ${{ env.ort_zip }} ${{ env.ort_url }}
nuget install ${{ env.ORT_PACKAGE_NAME }} -version ${{ env.ORT_NIGHTLY_VERSION }} -x
- name: Unzip OnnxRuntime
- name: Extra OnnxRuntime library and header files
run: |
tar -xzf ${{ env.ort_zip }}
rm ${{ env.ort_zip }}
mkdir -p ort/lib
mv ${{ env.ORT_PACKAGE_NAME }}/build/native/include ort/
mv ${{ env.ORT_PACKAGE_NAME }}/runtimes/osx-arm64/native/* ort/lib/
- name: Rename OnnxRuntime to ort
run: |
mv ${{ env.ort_dir }} ort
- name: Configure CMake
run: |
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/win-cpu-arm64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ jobs:
run: |
cmake --build --preset windows_arm64_cpu_release --parallel
- name: Build the C# API and Run the C# Tests
run: |
cd test\csharp
dotnet test /p:NativeBuildOutputDir="$env:GITHUB_WORKSPACE\$env:binaryDir\Release"
- name: Install the Python Wheel and Test Dependencies
run: |
python -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl"))
Expand All @@ -62,10 +67,7 @@ jobs:
run: |
python test/python/test_onnxruntime_genai.py --cwd "test\python" --test_models "test\test_models"
- name: Build the C# API and Run the C# Tests
run: |
cd test\csharp
dotnet test /p:NativeBuildOutputDir="$env:GITHUB_WORKSPACE\$env:binaryDir\Release"
- name: Verify Build Artifacts
if: always()
Expand Down
44 changes: 29 additions & 15 deletions .github/workflows/win-cpu-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
ort_dir: "onnxruntime-win-x64-1.17.3"
ort_zip: "$(ort_dir).zip"
ort_url: "https://github.com/microsoft/onnxruntime/releases/download/v1.17.3/$(ort_zip)"
binaryDir: 'build/cpu'
ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime&api-version=6.0-preview.1"
ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime"

jobs:
windows-cpu-x64-build:
Expand All @@ -33,19 +32,32 @@ jobs:
with:
vs-version: '17.5'

- name: Download OnnxRuntime
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'

- name : Install jq and nuget
run: |
$env:ort_url = "https://github.com/microsoft/onnxruntime/releases/download/v1.17.3/onnxruntime-win-x64-1.17.3.zip"
Invoke-WebRequest -Uri $env:ort_url -OutFile $env:ort_zip
choco install -y jq curl
- name: Unzip OnnxRuntime
- name: Get the Latest OnnxRuntime Nightly Version
shell: pwsh
run: |
Expand-Archive $env:ort_zip -DestinationPath .
Remove-Item -Path $env:ort_zip
$ORT_NIGHTLY_VERSION = $(curl -s "${{ env.ORT_NIGHTLY_REST_API }}" | jq -r '.value[0].versions[0].normalizedVersion')
echo "$ORT_NIGHTLY_VERSION"
"ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Download OnnxRuntime Nightly
run: |
nuget install ${{ env.ORT_PACKAGE_NAME }} -version ${{ env.ORT_NIGHTLY_VERSION }} -x -NonInteractive
- run: Get-ChildItem ${{ env.ORT_PACKAGE_NAME }} -Recurse
continue-on-error: true

- name: Rename OnnxRuntime to ort
- name: Extra OnnxRuntime library and header files
run: |
Rename-Item -Path $env:ort_dir -NewName ort
mkdir ort/lib
move ${{ env.ORT_PACKAGE_NAME }}/build/native/include ort/
move ${{ env.ORT_PACKAGE_NAME }}/runtimes/win-x64/native/* ort/lib/
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand All @@ -60,6 +72,11 @@ jobs:
run: |
cmake --build --preset windows_x64_cpu_release --parallel
- name: Build the C# API and Run the C# Tests
run: |
cd test\csharp
dotnet test /p:NativeBuildOutputDir="$env:GITHUB_WORKSPACE\$env:binaryDir\Release"
- name: Install the python wheel and test dependencies
run: |
python -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl"))
Expand All @@ -76,10 +93,7 @@ jobs:
run: |
python test/python/test_onnxruntime_genai.py --cwd "test\python" --test_models "test\test_models"
- name: Build the C# API and Run the C# Tests
run: |
cd test\csharp
dotnet test /p:NativeBuildOutputDir="$env:GITHUB_WORKSPACE\$env:binaryDir\Release"
- name: Verify Build Artifacts
if: always()
Expand Down
Loading

0 comments on commit 8c2ecbe

Please sign in to comment.