Skip to content

Clang transpiler integration #1257

Clang transpiler integration

Clang transpiler integration #1257

Workflow file for this run

name: Build
on:
push:
paths-ignore:
- 'README.md'
- 'INSTALL.md'
- 'docs/**'
pull_request:
paths-ignore:
- 'README.md'
- 'INSTALL.md'
- 'docs/**'
jobs:
run:
strategy:
matrix:
include:
- name: "[Ubuntu] gcc-12"
os: ubuntu-22.04
CC: gcc-12
CXX: g++-12
CXXFLAGS: -Wno-maybe-uninitialized
FC: gfortran-12
GCOV: gcov-12
OCCA_COVERAGE: 1
OCCA_FORTRAN_ENABLED: 1
- name: "[Ubuntu] CMake + gcc-12"
os: ubuntu-22.04
CC: gcc-12
CXX: g++-12
CXXFLAGS: -Wno-maybe-uninitialized -Wno-cpp
FC: gfortran-12
OCCA_FORTRAN_ENABLED: 1
useCMake: true
- name: "[Ubuntu] clang-14"
os: ubuntu-22.04
CC: clang-14
CXX: clang++-14
CXXFLAGS: -Wno-uninitialized
OCCA_COVERAGE: 0
- name: "[Ubuntu] clang-13"
os: ubuntu-22.04
CC: clang-13
CXX: clang++-13
CXXFLAGS: -Wno-uninitialized
OCCA_COVERAGE: 0
- name: "[Ubuntu] CMake + Intel/LLVM"
os: ubuntu-22.04
CC: icx
CXX: icpx
CXXFLAGS: -Wno-uninitialized
FC: ifx
OCCA_COVERAGE: 0
OCCA_FORTRAN_ENABLED: 1
useCMake: true
useoneAPI: true
- name: "[MacOS] clang"
os: macos-12
CC: clang
CXX: clang++
CXXFLAGS: -Wno-uninitialized
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
FC: ${{ matrix.FC }}
CXXFLAGS: -O3 -Wall -pedantic -Wshadow -Wsign-compare -Wuninitialized -Wtype-limits -Wignored-qualifiers -Wempty-body -Wextra -Wno-unused-parameter -Werror -Wno-strict-aliasing ${{ matrix.CXXFLAGS }}
OCCA_CXXFLAGS: -O3
GCOV: ${{ matrix.GCOV }}
OCCA_COVERAGE: ${{ matrix.OCCA_COVERAGE }}
OCCA_FORTRAN_ENABLED: ${{ matrix.OCCA_FORTRAN_ENABLED }}
FORTRAN_EXAMPLES: ${{ matrix.OCCA_FORTRAN_ENABLED }}
steps:
- uses: actions/checkout@v4
- name: add oneAPI to apt
if: ${{ matrix.useoneAPI }}
shell: bash
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
- name: install oneAPI dpcpp compiler
if: ${{ matrix.useoneAPI }}
shell: bash
run: |
sudo apt update
sudo apt install intel-oneapi-compiler-dpcpp-cpp
sudo apt install intel-oneapi-compiler-fortran
- name: Compiler info
if: ${{ !matrix.useCMake }}
run: make -j 16 info
- name: CMake configure
if: ${{ matrix.useCMake && !matrix.useoneAPI}}
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_Fortran_COMPILER=${FC} \
-DOCCA_ENABLE_TESTS=ON \
-DOCCA_ENABLE_EXAMPLES=ON \
-DOCCA_ENABLE_FORTRAN=${OCCA_FORTRAN_ENABLED}
- name: CMake configure
if: ${{ matrix.useCMake && matrix.useoneAPI}}
env:
OCCA_CC: ${{ matrix.CC }}
OCCA_CXX: ${{ matrix.CXX }}
run: |
source /opt/intel/oneapi/setvars.sh
cmake -S . -B build \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_Fortran_COMPILER=${FC} \
-DOCCA_ENABLE_TESTS=ON \
-DOCCA_ENABLE_EXAMPLES=ON \
-DOCCA_ENABLE_FORTRAN=${OCCA_FORTRAN_ENABLED}
- name: CMake build
if: ${{ matrix.useCMake && !matrix.useoneAPI}}
run: |
cmake --build build --parallel 16
- name: CMake build
if: ${{ matrix.useCMake && matrix.useoneAPI}}
env:
OCCA_CC: ${{ matrix.CC }}
OCCA_CXX: ${{ matrix.CXX }}
run: |
source /opt/intel/oneapi/setvars.sh
cmake --build build --parallel 16
- name: Compile library
if: ${{ !matrix.useCMake }}
run: make -j 16
- name: Compile tests
if: ${{ !matrix.useCMake }}
run: make -j 16 tests
- name: Run unit tests
if: ${{ !matrix.useCMake }}
run: ./tests/run_tests
- name: Run examples
if: ${{ !matrix.useCMake }}
run: ./tests/run_examples
- name: Run CTests
if: ${{ matrix.useCMake && !matrix.useoneAPI }}
run: |
ctest --test-dir build --progress --output-on-failure --parallel 8 --schedule-random -E "examples_cpp_arrays-opencl|examples_cpp_for_loops-opencl|examples_cpp_generic_inline_kernel-opencl|examples_cpp_shared_memory-opencl|examples_cpp_nonblocking_streams-opencl|examples_cpp_for_loops-dpcpp|examples_cpp_arrays-dpcpp|examples_cpp_generic_inline_kernel-dpcpp|examples_cpp_nonblocking_streams-dpcpp"
- name: Run CTests
if: ${{ matrix.useCMake && matrix.useoneAPI }}
env:
OCCA_CC: ${{ matrix.CC }}
OCCA_CXX: ${{ matrix.CXX }}
OCCA_DPCPP_COMPILER: icpx
run: |
source /opt/intel/oneapi/setvars.sh
export ONEAPI_DEVICE_SELECTOR=*:cpu
ctest --test-dir build --progress --output-on-failure --parallel 8 --schedule-random -E "opencl-*|dpcpp-*"
- name: Upload code coverage
if: ${{ matrix.OCCA_COVERAGE }}
run: bash <(curl --no-buffer -s https://codecov.io/bash) -x "${GCOV}"