Skip to content

Build and Run OCK Demo #87

Build and Run OCK Demo

Build and Run OCK Demo #87

Workflow file for this run

# Build, Run and Test OCK Demo EcoSystem
name: Build and Run OCK Demo
on:
push:
branches:
- stable
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# build and run for RISCV
run_riscv_m1_ock_demo:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
# installs tools, ninja, installs llvm and sets up sccahe
- name: setup ubuntu
uses: ./.github/actions/setup_ubuntu_build
with:
llvm_version: 17
llvm_build_type: RelAssert
- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install Python libraries and system dependencies
run: |
pip install --user requests numpy h5py Pillow
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install -y libblas-dev libopenblas64-dev libopenblas-dev libpthread-stubs0-dev libboost-all-dev
- name: Build riscv M1
uses: ./.github/actions/do_build_ock/do_build_m1
with:
build_type: Release
extra_flags: '-DCA_REFSI_M1_DEMO_MODE=ON'
- name: Create OCK install
run: |
ninja -C $(pwd)/build install
- name: Get Intel OneAPI BaseToolkit
run: |
wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/bb99984f-370f-413d-bbec-38928d2458f2/l_dpcpp-cpp-compiler_p_2024.0.2.29.sh
export TERMINFO=/usr/lib/terminfo
sh $(pwd)/l_dpcpp-cpp-compiler_p_2024.0.2.29.sh -a --silent --eula accept
mv /home/runner/intel $(pwd)
- name: Test RSICV examples
run: |
# Set environment variables
export LD_LIBRARY_PATH=$(pwd)/install/lib:$(pwd)/intel/oneapi/compiler/2024.0/lib/libsycl.so:$(pwd)/intel/oneapi/compiler/2024.0/lib:$LD_LIBRARY_PATH
export CMAKE_CXX_COMPILER=$(pwd)/intel/oneapi/compiler/2024.0/bin/compiler/clang++
export CMAKE_C_COMPILER=$(pwd)/intel/oneapi/compiler/2024.0/bin/compiler/clang
export CA_HAL_DEBUG=1
export CA_PROFILE_LEVEL=3
export ONEAPI_DEVICE_SELECTOR=opencl:fpga
export OCL_ICD_FILENAMES=$(pwd)/install/lib/libCL.so
# As the oneAPI basetoolkit release has a whitelist of devices, it filters out RefSi.
# To override it, as a temporary solution we can point SYCL_CONFIG_FILE_NAME to ``.
# This way it doesn't set the default sycl.conf.
export SYCL_CONFIG_FILE_NAME=""
mkdir ock_example_tests
cmake -GNinja -Bock_example_tests -DCMAKE_CXX_COMPILER=$(pwd)/intel/oneapi/compiler/2024.0/bin/compiler/clang++ -DCMAKE_C_COMPILER=$(pwd)/intel/oneapi/compiler/2024.0/bin/compiler/clang -DOpenCL_LIBRARY=$(pwd)/install/lib/libCL.so -DOpenCL_INCLUDE_DIR=$(pwd)/intel/oneapi/compiler/2024.0/include/sycl $(pwd)/examples/applications
ninja -C ock_example_tests
# Run tests
cd ock_example_tests
ctest bin/ --verbose
cd ..
mv ock_example_tests/bin install/tests
- name: Package build artifacts
run: |
mv install ock_install_dir
tar -cvzf ock_demo_artifacts.tar.gz ock_install_dir -C examples/technical_blogs/ock_demo_blog getting_started.md envvars
- name: Upload OCK artifacts
uses: actions/upload-artifact@v4
with:
name: ock_demo_build
path: ock_demo_artifacts.tar.gz
build_portBLAS:
runs-on: ubuntu-22.04
needs: run_riscv_m1_ock_demo
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download OCK artifacts
uses: actions/download-artifact@v4
with:
name: ock_demo_build
- name: Untar artifacts
run: |
tar -xvzf ock_demo_artifacts.tar.gz
- name: Build portBLAS
uses: ./.github/actions/build_portBLAS_action
with:
workspace: ${{ github.workspace }}
build_portDNN:
runs-on: ubuntu-22.04
needs: run_riscv_m1_ock_demo
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download OCK artifacts
uses: actions/download-artifact@v4
with:
name: ock_demo_build
- name: Untar artifacts
run: |
tar -xvzf ock_demo_artifacts.tar.gz
rm ock_demo_artifacts.tar.gz
df .
- name: Build portDNN
uses: ./.github/actions/build_portDNN_action
with:
workspace: ${{ github.workspace }}
build_and_run_networks:
runs-on: ubuntu-22.04
needs: [run_riscv_m1_ock_demo, build_portDNN]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download OCK artifacts
uses: actions/download-artifact@v4
with:
name: ock_demo_build
- name: Download portDNN build artifacts
uses: actions/download-artifact@v4
with:
name: portDNN_build
- name: Untar artifacts
run: |
tar -xvzf ock_demo_artifacts.tar.gz
tar -xvzf portDNN_build.tar.gz
- name: Build vgg and resnet
uses: ./.github/actions/build_vgg_resnet_action
with:
workspace: ${{ github.workspace }}
publish_OCK_demo_artifacts:
runs-on: ubuntu-22.04
needs: [run_riscv_m1_ock_demo, build_portBLAS, build_portDNN, build_and_run_networks]
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Download OCK artifacts
uses: actions/download-artifact@v4
with:
name: ock_demo_build
- name: Download portDNN build artifacts
uses: actions/download-artifact@v4
with:
name: portDNN_build
- name: Download portBLAS build artifacts
uses: actions/download-artifact@v4
with:
name: portBLAS_build
- name: Download network artifacts
uses: actions/download-artifact@v4
with:
name: network_build
- name: Compute tag
id: tag
run: |
if [ "${{ github.event_name == 'schedule' }}" == "true" ]; then
echo "TAG=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
else
# TODO: Use date of the commit?
echo "TAG=$(date +'%Y-%m-%d')-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
fi
- name: Concatenate the tars to create OCK components
run: |
tar -rf ock_demo_components.tar.gz portDNN_build.tar.gz portBLAS_build.tar.gz
- name: Create OCK demo release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files: |
ock_demo_artifacts.tar.gz
ock_demo_components.tar.gz
network_artifacts.tar.gz
tag_name: ock-demo-${{ steps.tag.outputs.TAG }}
name: OCK Demo Package ${{ steps.tag.outputs.TAG }}
prerelease: true
body: "ock-demo build ${{ steps.tag.outputs.TAG }}"
target_commitish: ${{ github.sha }}