Skip to content

Commit

Permalink
OpenCL CI trial and error
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomestre committed Oct 27, 2023
1 parent 2ab0734 commit 6c6bf8d
Show file tree
Hide file tree
Showing 20 changed files with 197 additions and 420 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Runs bandit security checker for code written in Python.
name: Bandit

on: [push, pull_request, workflow_dispatch]

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

jobs:
linux:
name: Bandit
runs-on: ubuntu-latest
steps:
- name: Clone the git repo
uses: actions/checkout@v3

- name: Install pip packages
run: pip install -r third_party/requirements.txt

# Scan is run only for the 'tools' folder.
- name: Run Bandit
run: |
bandit -r tools
## Runs bandit security checker for code written in Python.
#name: Bandit
#
#on: [push, pull_request, workflow_dispatch]
#
#concurrency:
# group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
# cancel-in-progress: true
#
#jobs:
# linux:
# name: Bandit
# runs-on: ubuntu-latest
#
# steps:
# - name: Clone the git repo
# uses: actions/checkout@v3
#
# - name: Install pip packages
# run: pip install -r third_party/requirements.txt
#
# # Scan is run only for the 'tools' folder.
# - name: Run Bandit
# run: |
# bandit -r tools
311 changes: 27 additions & 284 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,177 +7,48 @@ concurrency:
cancel-in-progress: true

jobs:
ubuntu-build:
name: Build - Ubuntu
strategy:
matrix:
os: ['ubuntu-20.04', 'ubuntu-22.04']
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}]
libbacktrace: ['-DVAL_USE_LIBBACKTRACE_BACKTRACE=OFF']
pool_tracking: ['-DUMF_ENABLE_POOL_TRACKING=ON', '-DUMF_ENABLE_POOL_TRACKING=OFF']
include:
- os: 'ubuntu-22.04'
build_type: Release
compiler: {c: clang, cxx: clang++}
libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=OFF'
- os: 'ubuntu-22.04'
build_type: Release
compiler: {c: gcc, cxx: g++}
libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
- os: 'ubuntu-22.04'
build_type: Release
compiler: {c: clang, cxx: clang++}
libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
- os: 'ubuntu-20.04'
build_type: Release
compiler: {c: gcc-7, cxx: g++-7}

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3

- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y doxygen ${{matrix.compiler.c}}
- name: Install g++-7
if: matrix.compiler.cxx == 'g++-7'
run: |
sudo apt-get install -y ${{matrix.compiler.cxx}}
- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Install libbacktrace
if: matrix.libbacktrace == '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
run: |
git clone https://github.com/ianlancetaylor/libbacktrace.git
cd libbacktrace
./configure
make
sudo make install
cd ..
- name: Download DPC++
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt install libncurses5
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-09-21/sycl_linux.tar.gz
mkdir -p ${{github.workspace}}/dpcpp_compiler
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C ${{github.workspace}}/dpcpp_compiler
- name: Configure CMake
if: matrix.os == 'ubuntu-22.04'
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
${{matrix.libbacktrace}}
${{matrix.pool_tracking}}
- name: Configure CMake
if: matrix.os == 'ubuntu-20.04'
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
${{matrix.libbacktrace}}
${{matrix.pool_tracking}}
- name: Generate source from spec, check for uncommitted diff
if: matrix.os == 'ubuntu-22.04'
run: cmake --build ${{github.workspace}}/build --target check-generated

- name: Verify that each source file contains a license
run: cmake --build ${{github.workspace}}/build --target verify-licenses

- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "python|umf|loader|validation|tracing|unit|urtrace"

fuzztest-build:
name: Build and run quick fuzztest scenarios
strategy:
matrix:
build_type: [Debug, Release]
compiler: [{c: clang, cxx: clang++}]

runs-on: 'ubuntu-22.04'

steps:
- uses: actions/checkout@v3

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Download DPC++
run: |
sudo apt install libncurses5
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz
- name: Setup DPC++
run: |
source ${{github.workspace}}/dpcpp_compiler/startup.sh
- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DUR_ENABLE_TRACING=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_TESTS=ON
-DUR_USE_ASAN=ON
-DUR_USE_UBSAN=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)

- name: Fuzz test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-short"

adapter-build-hw:
name: Build - Adapters on HW
if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
strategy:
matrix:
adapter: [
{name: CUDA, triplet: nvptx64-nvidia-cuda},
{name: HIP, triplet: spir64}, # should be amdgcn-amdhsa, but build scripts for device binaries are currently broken for this target.
{name: L0, triplet: spir64}
{name: OPENCL, runner: ubuntu-22.04, triplet: spir64}
]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
build_type: [Release]
compiler: [{c: clang, cxx: clang++}]

runs-on: ${{matrix.adapter.name}}
runs-on: ${{matrix.adapter.runner}}

steps:
- uses: actions/checkout@v3

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Install OpenCL
if: matrix.adapter.name == 'OPENCL'
run: |
sudo gpasswd -a $USER render
sudo gpasswd -a $USER video
lscpu
sudo apt-get update
sudo apt-get install ocl-icd-libopencl1 ocl-icd-opencl-dev clinfo
mkdir intel-ocl-packages
cd intel-ocl-packages
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.14828.8/intel-igc-core_1.0.14828.8_amd64.deb
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.14828.8/intel-igc-opencl_1.0.14828.8_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-level-zero-gpu-dbgsym_1.3.26918.9_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-level-zero-gpu_1.3.26918.9_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-opencl-icd-dbgsym_23.30.26918.9_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-opencl-icd_23.30.26918.9_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/libigdgmm12_22.3.0_amd64.deb
sudo dpkg -i *.deb
cat /etc/OpenCL/vendors/intel.icd
ls /usr/lib/x86_64-linux-gnu/intel-opencl/libigdrcl.so
echo "CLINFO:"
clinfo
- name: Download DPC++
run: |
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-09-21/sycl_linux.tar.gz
Expand Down Expand Up @@ -215,131 +86,3 @@ jobs:
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180

examples-build-hw:
name: Build - examples on HW
if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
strategy:
matrix:
adapter: [
{name: L0}
]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]

runs-on: ${{matrix.adapter.name}}

steps:
- uses: actions/checkout@v3

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Init conda env
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: examples
environment-file: third_party/deps.yml
auto-activate-base: false

- name: Configure CMake
shell: bash -el {0}
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
-DUR_BUILD_EXAMPLE_CODEGEN=ON
-DUR_DEVELOPER_MODE=ON
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)

- name: Test codegen example
working-directory: ${{github.workspace}}/build
run: bin/codegen

windows-build:
name: Build - Windows
strategy:
matrix:
os: ['windows-2019', 'windows-2022']
adapter: [
{name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
]

# TODO: building level zero loader on windows-2019 is currently broken
exclude:
- os: 'windows-2019'
adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
build_type: [Debug, Release]
compiler: [{c: cl.exe, cxx: cl.exe}, {c: clang-cl.exe, cxx: clang-cl.exe}]
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install prerequisites
run: python3 -m pip install -r third_party/requirements.txt

- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-DCMAKE_POLICY_DEFAULT_CMP0094=NEW
-DUR_ENABLE_TRACING=ON
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
${{matrix.adapter.var}}
# TODO: re-enable when check-generated is fixed for windows runners see #888
# - name: Generate source from spec, check for uncommitted diff
# if: matrix.os == 'windows-2022'
# run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}}

- name: Build all
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j 2

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "python|umf|loader|validation|tracing|unit|urtrace"


macos-build:
name: Build - MacOS
strategy:
matrix:
os: ['macos-12', 'macos-13']
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install prerequisites
run: python3 -m pip install -r third_party/requirements.txt

- name: Configure CMake
run: >
cmake
-B${{github.workspace}}/build
-DUR_ENABLE_TRACING=ON
-DUR_DEVELOPER_MODE=ON
-DCMAKE_BUILD_TYPE=Release
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
-DUMF_ENABLE_POOL_TRACKING=ON
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
Loading

0 comments on commit 6c6bf8d

Please sign in to comment.