Skip to content

Commit

Permalink
[ZENDNN FWK] Add build from source file
Browse files Browse the repository at this point in the history
Signed-off-by: Devasena Kirthika S <[email protected]>
Change-Id: Ib95c3a7316b29e0f1aad3381afc575fcb96f7900
Signed-off-by: Devasena Kirthika S <[email protected]>
Reviewed-on: https://gerrit-git.amd.com/c/amd/ec/ZenDNN_ONNXRuntime/+/1050801
Reviewed-by: Ajeet Singh <[email protected]>
Reviewed-by: Pratap Gadi <[email protected]>
Reviewed-by: Chandra Kumar Ramasamy <[email protected]>
Tested-by: Llvm Cpu <[email protected]>
(cherry picked from commit 6509ffb)
Reviewed-on: https://gerrit-git.amd.com/c/amd/ec/ZenDNN_ONNXRuntime/+/1052177
Tested-by: Kiriti Pendyala <[email protected]>
  • Loading branch information
Devasena Kirthika S authored and kiriti-pendyala committed May 8, 2024
1 parent 964219a commit 19b5e16
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions BUILD_SOURCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

**`Documentation`** |
------------------- |
To build ONNXRUNTIME with ZenDNN follow below steps.

## Build From Source
### Setup for Linux
Create and activate a conda environment
```
$ conda create -n onnxrt-v1.17.0-zendnn-4.2-rel-env python=3.8 -y
$ conda activate onnxrt-v1.17.0-zendnn-4.2-rel-env
```
Install necessary dependencies
```
$ pip install -U cmake numpy==1.24.4 protobuf==3.20.2 onnx==1.15.0 pytest
$ pip install psutil coloredlogs torch==2.1.2 torchvision transformers==4.39.3 sympy
```

### Download the AMD ZenDNN ONNXRUNTIME source code
Location of AMD ZenDNN ONNXRUNTIME: [AMD ZenDNN ONNXRUNTIME](https://github.com/amd/ZenDNN-onnxruntime).

Checkout AMD ZenDNN ONNXRUNTIME
```
$ git clone https://github.com/amd/ZenDNN-onnxruntime.git
$ cd ZenDNN-onnxruntime
```

The repo defaults to the main development branch which doesn't have ZenDNN support. You need to check out a release branch to build, e.g. `rel-1.17.0_zendnn_rel`.
```
$ git checkout branch_name # rel-1.17.0_zendnn_rel.
```

### Set environment variables
Set environment variables for optimum performance. Some of the environment variables are for housekeeping purposes and can be ignored.
```
$ source scripts/zendnn_ONNXRT_env_setup.sh
```

### Build and install the pip package
Ensure that you install the ONNX Runtime-ZenDNN package corresponding to the Python version with which you created the conda environment.
```
$ ./build.sh --config Release --build_shared_lib --parallel --use_zendnn --build_wheel --use_openmp --skip_onnx_tests
$ pip install --force-reinstall ./build/Linux/Release/dist/<*.whl>
$ pip install --force protobuf==3.20.2
```

### Quick verification of Build. You should see ZendnnExecutionProvider and ONNXRuntime version
### Change directory to parent folder
```
$ cd ../
$ python -c 'import onnxruntime as ort; print("\nONNXRuntime version : ", ort.__version__); print("\nAvailable Execution Providers : ", ort.get_available_providers())'
```

0 comments on commit 19b5e16

Please sign in to comment.