Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Intel oneAPI GitHub Actions with MKL and MPI (C, C++, Fortran) and CMake
jobs:
linux-intel-oneapi:
runs-on: ubuntu-latest
env:
CC: icx
CXX: icpx
FC: ifort
steps:
- name: Intel Apt repository
timeout-minutes: 1
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
- name: Install Intel oneAPI
timeout-minutes: 5
run: sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mpi intel-oneapi-mpi-devel intel-oneapi-mkl ninja-build
- name: checkout project code
uses: actions/checkout@v2
- name: Setup Intel oneAPI environment
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- name: CMake Configure
run: cmake -B build
- name: CMake build
run: cmake --build build
- name: CMake test
run: ctest --test-dir build
@scivision
Copy link
Author

Set env: CC: etc workflow-wide so that ExternalProjects get the Intel compiler too

@Koushikphy
Copy link

Can you update this with caching the installation step?

@scivision
Copy link
Author

https://github.com/scivision/fortran-filesystem/blob/main/.github/workflows/oneapi-linux.yml
This uses auxiliary scripts and cache still takes a couple minutes to setup. I didn't switch to cached in other projects as a result of not much time savings and additional setup hassle

@Koushikphy
Copy link

I was using the exact same Install Intel oneAPI step (without the ninja_build) and the apt installation takes almost 3 and half minutes, whereas the cache setup took 50 sec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment