Last active
February 11, 2022 16:38
-
-
Save kris-rowe/243ec5e90b3cc897c9b8f1138903e218 to your computer and use it in GitHub Desktop.
Add Intel oneAPI toolkits to GitHub actions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: add oneAPI to apt | |
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 | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt install intel-oneapi-compiler-dpcpp-cpp | |
- name: install oneAPI MKL library | |
shell: bash | |
run: | | |
sudo apt install intel-oneapi-mkl-devel | |
- name: configure | |
shell: bash | |
run: | | |
source /opt/intel/oneapi/setvars.sh | |
cmake -S . -B build \ | |
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ | |
-DCMAKE_INSTALL_PREFIX=install \ | |
-DCMAKE_CXX_COMPILER=dpcpp \ | |
-DCMAKE_C_COMPILER=icx \ | |
-DIntelDPCPP_DIR="/opt/intel/oneapi/compiler/latest/linux/cmake/SYCL" \ | |
-DMKL_ROOT="/opt/intel/oneapi/mkl/latest" \ | |
-DTBB_ROOT="/opt/intel/oneapi/tbb/latest" | |
- name: build | |
shell: bash | |
run: | | |
source /opt/intel/oneapi/setvars.sh | |
cmake --build build | |
- name: test | |
shell: bash | |
run: | | |
source /opt/intel/oneapi/setvars.sh | |
export SYCL_DEVICE_FILTER=opencl.cpu | |
ctest --test-dir build --output-on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enable_language(CXX) | |
set(CMAKE_CXX_STANDARD 17) | |
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | |
list(APPEND CMAKE_MODULE_PATH "${IntelDPCPP_DIR}") | |
find_package(IntelDPCPP REQUIRED) | |
find_package(MKL REQUIRED) |
Unfortunately, am not familiar with using the oneAPI toolkits on Windows.
Recently I came across this repository of CI scripts for projects using oneAPI: https://github.com/oneapi-src/oneapi-ci
There is an example using Windows here:
https://github.com/oneapi-src/oneapi-ci/blob/ba5035fc01bd1bb7015fbb9c7a79975e1e5db6c3/.github/workflows/build_all.yml#L29
Hopefully this helps.
Cheers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First off, thanks for this I found it really helpful.
Secondly, are there similar instructions for Windows?