Using GitHub Actions cache is a little more complicated than not caching, but makes the setup time dramatically shorter.
This example uses MKL and MPI.
Live example with Fortran only (no MKL or MPI).
Using GitHub Actions cache is a little more complicated than not caching, but makes the setup time dramatically shorter.
This example uses MKL and MPI.
Live example with Fortran only (no MKL or MPI).
name: oneapi-linux | |
env: | |
LINUX_CPP_COMPONENTS: intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic | |
LINUX_FORTRAN_COMPONENTS: intel-oneapi-compiler-fortran | |
LINUX_MKL_COMPONENTS: "intel-oneapi-mkl intel-oneapi-mkl-devel" | |
LINUX_MPI_COMPONENTS: "intel-oneapi-mpi intel-oneapi-mpi-devel" | |
# https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml | |
CTEST_NO_TESTS_ACTION: error | |
on: | |
push: | |
paths: | |
- "**.c" | |
- "**.f" | |
- "**.F" | |
- "**.f90" | |
- "**.F90" | |
- "**.cmake" | |
- "**/CMakeLists.txt" | |
- ".github/workflows/oneapi-linux.yml" | |
- "!scripts/*" | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
# must be first as we're using scripts from this repo | |
- uses: actions/checkout@v4 | |
- name: cache install oneAPI | |
id: cache-install | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/opt/intel/oneapi | |
key: install-apt | |
- name: non-cache install oneAPI | |
if: steps.cache-install.outputs.cache-hit != 'true' | |
timeout-minutes: 10 | |
run: | | |
sh -c .github/workflows/oneapi_setup_apt_repo_linux.sh | |
sudo apt install ${{ env.LINUX_CPP_COMPONENTS }} ${{ env.LINUX_FORTRAN_COMPONENTS }} ${{ env.LINUX_MKL_COMPONENTS }} ${{ env.LINUX_MPI_COMPONENTS }} | |
- name: Setup Intel oneAPI environment | |
run: | | |
source /opt/intel/oneapi/setvars.sh | |
printenv >> $GITHUB_ENV | |
# optional: any non-oneAPI packages are not cached by this script | |
- name: install Ninja | |
run: sudo apt install ninja-build | |
- name: CMake Configure | |
run: cmake -B build | |
- name: print config log | |
if: ${{ failure() }} | |
run: cat build/CMakeFiles/CMakeConfigureLog.yaml | |
- name: CMake build | |
run: cmake --build build --parallel | |
- name: CMake Test | |
run: ctest --test-dir build -V | |
- name: exclude unused files from cache | |
if: steps.cache-install.outputs.cache-hit != 'true' | |
run: sh -c .github/workflows/oneapi_cache_exclude_linux.sh |
#!/bin/bash | |
# SPDX-FileCopyrightText: 2020 Intel Corporation | |
# | |
# SPDX-License-Identifier: MIT | |
#shellcheck disable=SC2010 | |
LATEST_VERSION=$(ls -1 /opt/intel/oneapi/compiler/ | grep -v latest | sort | tail -1) | |
sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/compiler/lib/ia32_lin | |
sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/bin/ia32 | |
sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/emu | |
sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/oclfpga |
#!/bin/bash | |
# SPDX-FileCopyrightText: 2020 Intel Corporation | |
# | |
# SPDX-License-Identifier: MIT | |
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 | |
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | |
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/oneAPI.list" -o APT::Get::List-Cleanup="0" |
@mathomp4 this cache approach may be of interest as it makes the oneAPI Install time seconds instead of minutes for each CI run.