@@ -44,13 +44,15 @@ jobs:
4444 FC : gfortran
4545 OCCA_FORTRAN_ENABLED : 1
4646 useCMake : true
47+ useTranspiler : true
4748
4849 - name : " [Ubuntu] CMake + clang"
4950 os : ubuntu-latest
5051 CC : clang
5152 CXX : clang++
5253 CXXFLAGS : -Wno-uninitialized
5354 useCMake : true
55+ useTranspiler : true
5456
5557 - name : " [Ubuntu] CMake + Intel/LLVM"
5658 os : ubuntu-latest
6264 OCCA_FORTRAN_ENABLED : 1
6365 useCMake : true
6466 useoneAPI : true
67+ useTranspiler : true
6568
6669 runs-on : ${{ matrix.os }}
6770 name : ${{ matrix.name }}
7679 OCCA_COVERAGE : ${{ matrix.OCCA_COVERAGE }}
7780 OCCA_FORTRAN_ENABLED : ${{ matrix.OCCA_FORTRAN_ENABLED }}
7881 FORTRAN_EXAMPLES : ${{ matrix.OCCA_FORTRAN_ENABLED }}
82+ TRANSPILER_VERSION : 1.1
83+ TRANSPILER_CACHE_NUMBER : 0 # Increase to reset cache manually.
84+
7985
8086 steps :
8187 - uses : actions/checkout@v4
8793 - name : Set OCCA install directory
8894 run : echo "OCCA_INSTALL_DIR=${PWD}/install" >> ${GITHUB_ENV}
8995
90- - name : add oneAPI to apt
96+ - name : Setup environment variables for oneAPI
97+ if : ${{ matrix.useoneAPI }}
98+ run : echo "USE_ONEAPI=1" >> ${GITHUB_ENV}
99+
100+ - name : Setup environment variables for transpiler
101+ if : ${{ matrix.useTranspiler }}
102+ run : |
103+ echo "USE_TRANSPILER=1" >> ${GITHUB_ENV}
104+
105+ - name : Add oneAPI to apt
91106 if : ${{ matrix.useoneAPI }}
92107 shell : bash
93108 run : |
@@ -97,15 +112,82 @@ jobs:
97112 rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
98113 sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
99114
100- - name : install oneAPI dpcpp compiler
115+ - name : Install oneAPI dpcpp compiler
101116 if : ${{ matrix.useoneAPI }}
102117 shell : bash
103118 run : |
104119 sudo apt update
105120 sudo apt install intel-oneapi-compiler-dpcpp-cpp
106121 sudo apt install intel-oneapi-compiler-fortran
107122
108- - name : Compiler info
123+ - name : Install clang compiler required for transpiler
124+ if : ${{ matrix.useTranspiler }}
125+ shell : bash
126+ run : |
127+ wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/master/llvm.sh
128+ chmod +x llvm.sh
129+ sudo ./llvm.sh 17 all
130+
131+ - name : Cache transpiler install directory
132+ if : ${{ matrix.useTranspiler }}
133+ uses : actions/cache@v3
134+ id : cache
135+ with :
136+ path : occa-transpiler-${{ env.TRANSPILER_VERSION }}/install
137+ key : transpiler-${{ runner.os }}-${{ env.CXX }}-${{ env.CC }}-${{ hashFiles('.github/workflows/build.yml') }}-${{ env.TRANSPILER_CACHE_NUMBER }}
138+
139+ - name : Download and build clang transpiler
140+ if : ${{ matrix.useTranspiler && (steps.cache.outputs.cache-hit != 'true' ) }}
141+ shell : bash
142+ run : |
143+ if [ ! -z ${USE_ONEAPI+x} ] && [ "${USE_ONEAPI}" -eq 1 ]; then
144+ source /opt/intel/oneapi/setvars.sh
145+ fi
146+
147+ wget https://github.com/libocca/occa-transpiler/releases/download/v${TRANSPILER_VERSION}/occa-transpiler-${TRANSPILER_VERSION}-including-submodules.tar.gz
148+ tar -zxvf occa-transpiler-${TRANSPILER_VERSION}-including-submodules.tar.gz
149+ cd occa-transpiler-${TRANSPILER_VERSION}
150+ mkdir -p build
151+ cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DCMAKE_CXX_FLAGS="-Wall"
152+ cmake --build build --target install --parallel 8
153+
154+ - name : Compile library with CMake
155+ if : ${{ matrix.useCMake }}
156+ run : |
157+ if [ ! -z ${USE_ONEAPI+x} ] && [ "${USE_ONEAPI}" -eq 1 ]; then
158+ source /opt/intel/oneapi/setvars.sh
159+ fi
160+
161+ cmake -S . -B build \
162+ -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
163+ -DCMAKE_INSTALL_PREFIX=${OCCA_INSTALL_DIR} \
164+ -DCMAKE_C_COMPILER=${CC} \
165+ -DCMAKE_CXX_COMPILER=${CXX} \
166+ -DCMAKE_Fortran_COMPILER=${FC} \
167+ -DOCCA_ENABLE_TESTS=ON \
168+ -DOCCA_ENABLE_EXAMPLES=ON \
169+ -DOCCA_CLANG_BASED_TRANSPILER=${USE_TRANSPILER} \
170+ -DCMAKE_PREFIX_PATH=occa-transpiler-${TRANSPILER_VERSION}/install/ \
171+ -DOCCA_ENABLE_FORTRAN=${OCCA_FORTRAN_ENABLED}
172+
173+ cmake --build build --parallel 16
174+
175+ - name : Run CTests
176+ if : ${{ matrix.useCMake }}
177+ env :
178+ OCCA_DPCPP_COMPILER : icpx
179+ run : |
180+ if [ ! -z ${USE_ONEAPI+x} ] && [ "${USE_ONEAPI}" -eq 1 ]; then
181+ source /opt/intel/oneapi/setvars.sh
182+ export ONEAPI_DEVICE_SELECTOR=*:cpu
183+ exclude_list="opencl-*|dpcpp-*"
184+ else
185+ exclude_list="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"
186+ fi
187+
188+ ctest --test-dir build --progress --output-on-failure --parallel 8 --schedule-random -E ${exclude_list}
189+
190+ - name : Print compiler info for GNU Make
109191 if : ${{ !matrix.useCMake }}
110192 run : make PREFIX=${OCCA_INSTALL_DIR} -j 16 info
111193
@@ -153,11 +235,11 @@ jobs:
153235 source /opt/intel/oneapi/setvars.sh
154236 cmake --build build --target install --parallel 16
155237
156- - name : Compile library and install
238+ - name : Compile library with GNU Make
157239 if : ${{ !matrix.useCMake }}
158240 run : make -j 16
159241
160- - name : Compile tests
242+ - name : Compile tests with GNU Make
161243 if : ${{ !matrix.useCMake }}
162244 run : make -j 16 tests
163245
@@ -169,22 +251,6 @@ jobs:
169251 if : ${{ !matrix.useCMake }}
170252 run : ./tests/run_examples
171253
172- - name : Run CTests
173- if : ${{ matrix.useCMake && !matrix.useoneAPI }}
174- run : |
175- 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"
176-
177- - name : Run CTests
178- if : ${{ matrix.useCMake && matrix.useoneAPI }}
179- env :
180- OCCA_CC : ${{ matrix.CC }}
181- OCCA_CXX : ${{ matrix.CXX }}
182- OCCA_DPCPP_COMPILER : icpx
183- run : |
184- source /opt/intel/oneapi/setvars.sh
185- export ONEAPI_DEVICE_SELECTOR=*:cpu
186- ctest --test-dir build --progress --output-on-failure --parallel 8 --schedule-random -E "opencl-*|dpcpp-*"
187-
188254 - name : Upload code coverage
189255 if : ${{ matrix.OCCA_COVERAGE }}
190256 run : bash <(curl --no-buffer -s https://codecov.io/bash) -x "${GCOV}"
0 commit comments