Skip to content

Commit

Permalink
Add build note for C/C++ examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kunal-vaishnavi committed Dec 20, 2024
1 parent 06167c7 commit 86c4708
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions examples/c/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ONNX Runtime GenAI C Example

Note: ONNX Runtime GenAI needs to be built from source. The headers and shared libraries that are built need to be copied over to the appropriate folders (i.e. the `include` and `lib` folders). Building from source is necessary because these examples have been updated to run with the latest changes. Once the next version of ONNX Runtime GenAI is released, the below instructions will be accurate again.

## Setup

Clone this repo and change into the `examples/c` folder.
Expand Down Expand Up @@ -38,20 +40,20 @@ Change into the `onnxruntime-genai\examples\c` folder.

```cmd
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-win-x64-1.20.1.zip -o onnxruntime-win-x64-1.20.1.zip
tar xvf onnxruntime-win-x64-1.20.1.zip
tar -xvf onnxruntime-win-x64-1.20.1.zip
copy onnxruntime-win-x64-1.20.1\include\* include
copy onnxruntime-win-x64-1.20.1\lib\* lib
```

2. Install onnxruntime-genai

```cmd
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.5.2/onnxruntime-genai-win-cpu-x64-capi.zip -o onnxruntime-genai-win-cpu-x64-capi.zip
tar xvf onnxruntime-genai-win-cpu-x64-capi.zip
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.6.0/onnxruntime-genai-win-cpu-x64-capi.zip -o onnxruntime-genai-win-cpu-x64-capi.zip
tar -xvf onnxruntime-genai-win-cpu-x64-capi.zip
cd onnxruntime-genai-win-cpu-x64-capi
tar xvf onnxruntime-genai-0.5.2-win-x64.zip
copy onnxruntime-genai-0.5.2-win-x64\include\* ..\include
copy onnxruntime-genai-0.5.2-win-x64\lib\* ..\lib
tar -xvf onnxruntime-genai-0.6.0-win-x64.zip
copy onnxruntime-genai-0.6.0-win-x64\include\* ..\include
copy onnxruntime-genai-0.6.0-win-x64\lib\* ..\lib
cd ..
```

Expand Down Expand Up @@ -82,7 +84,7 @@ Change into the `onnxruntime-genai\examples\c` folder.
mkdir onnxruntime-win-x64-directml
cd onnxruntime-win-x64-directml
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg -o Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg
tar xvf Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg
tar -xvf Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg
copy build\native\include\* ..\include
copy runtimes\win-x64\native\* ..\lib
cd ..
Expand All @@ -91,12 +93,12 @@ Change into the `onnxruntime-genai\examples\c` folder.
2. Install onnxruntime-genai

```cmd
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.5.2/onnxruntime-genai-win-directml-x64-capi.zip -o onnxruntime-genai-win-directml-x64-capi.zip
tar xvf onnxruntime-genai-win-directml-x64-capi.zip
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.6.0/onnxruntime-genai-win-directml-x64-capi.zip -o onnxruntime-genai-win-directml-x64-capi.zip
tar -xvf onnxruntime-genai-win-directml-x64-capi.zip
cd onnxruntime-genai-win-directml-x64-capi
tar xvf onnxruntime-genai-0.5.2-win-x64-dml.zip
copy onnxruntime-genai-0.5.2-win-x64-dml\include\* ..\include
copy onnxruntime-genai-0.5.2-win-x64-dml\lib\* ..\lib
tar -xvf onnxruntime-genai-0.6.0-win-x64-dml.zip
copy onnxruntime-genai-0.6.0-win-x64-dml\include\* ..\include
copy onnxruntime-genai-0.6.0-win-x64-dml\lib\* ..\lib
cd ..
```

Expand Down Expand Up @@ -125,20 +127,20 @@ Change into the `onnxruntime-genai\examples\c` folder.

```cmd
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-win-arm64-1.20.1.zip -o onnxruntime-win-arm64-1.20.1.zip
tar xvf onnxruntime-win-arm64-1.20.1.zip
tar -xvf onnxruntime-win-arm64-1.20.1.zip
copy onnxruntime-win-arm64-1.20.1\include\* include
copy onnxruntime-win-arm64-1.20.1\lib\* lib
```

2. Install onnxruntime-genai

```cmd
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.5.2/onnxruntime-genai-win-cpu-arm64-capi.zip -o onnxruntime-genai-win-cpu-arm64-capi.zip
tar xvf onnxruntime-genai-win-cpu-arm64-capi.zip
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.6.0/onnxruntime-genai-win-cpu-arm64-capi.zip -o onnxruntime-genai-win-cpu-arm64-capi.zip
tar -xvf onnxruntime-genai-win-cpu-arm64-capi.zip
cd onnxruntime-genai-win-cpu-arm64-capi
tar xvf onnxruntime-genai-0.5.2-win-arm64.zip
copy onnxruntime-genai-0.5.2-win-arm64\include\* ..\include
copy onnxruntime-genai-0.5.2-win-arm64\lib\* ..\lib
tar -xvf onnxruntime-genai-0.6.0-win-arm64.zip
copy onnxruntime-genai-0.6.0-win-arm64\include\* ..\include
copy onnxruntime-genai-0.6.0-win-arm64\lib\* ..\lib
cd ..
```

Expand Down Expand Up @@ -169,7 +171,7 @@ Change into the `onnxruntime-genai\examples\c` folder.
mkdir onnxruntime-win-arm64-directml
cd onnxruntime-win-arm64-directml
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg -o Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg
tar xvf Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg
tar -xvf Microsoft.ML.OnnxRuntime.DirectML.1.20.1.nupkg
copy build\native\include\* ..\include
copy runtimes\win-arm64\native\* ..\lib
cd ..
Expand All @@ -178,12 +180,12 @@ Change into the `onnxruntime-genai\examples\c` folder.
2. Install onnxruntime-genai

```cmd
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.5.2/onnxruntime-genai-win-directml-arm64-capi.zip -o onnxruntime-genai-win-directml-arm64-capi.zip
tar xvf onnxruntime-genai-win-directml-arm64-capi.zip
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.6.0/onnxruntime-genai-win-directml-arm64-capi.zip -o onnxruntime-genai-win-directml-arm64-capi.zip
tar -xvf onnxruntime-genai-win-directml-arm64-capi.zip
cd onnxruntime-genai-win-directml-arm64-capi
tar xvf onnxruntime-genai-0.5.2-win-arm64-dml.zip
copy onnxruntime-genai-0.5.2-win-arm64-dml\include\* ..\include
copy onnxruntime-genai-0.5.2-win-arm64-dml\lib\* ..\lib
tar -xvf onnxruntime-genai-0.6.0-win-arm64-dml.zip
copy onnxruntime-genai-0.6.0-win-arm64-dml\include\* ..\include
copy onnxruntime-genai-0.6.0-win-arm64-dml\lib\* ..\lib
cd ..
```

Expand Down Expand Up @@ -281,7 +283,7 @@ Change into the onnxruntime-genai folder.
```cmd
cd examples\c
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-win-x64-1.20.1.zip -o onnxruntime-win-x64-1.20.1.zip
tar xvf onnxruntime-win-x64-1.20.1.zip
tar -xvf onnxruntime-win-x64-1.20.1.zip
copy onnxruntime-win-x64-1.20.1\include\* include
copy onnxruntime-win-x64-1.20.1\lib\* lib
```
Expand Down

0 comments on commit 86c4708

Please sign in to comment.