From 9102a712cbcf5e1fec197a447235458c02df87e9 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 9 Nov 2023 14:57:29 -0800 Subject: [PATCH] Add IntelLLVM support (+Intel-based CI) --- .github/workflows/Intel.yml | 78 +++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/Intel.yml diff --git a/.github/workflows/Intel.yml b/.github/workflows/Intel.yml new file mode 100644 index 0000000..8bab3aa --- /dev/null +++ b/.github/workflows/Intel.yml @@ -0,0 +1,78 @@ +name: Intel +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh +# without having to do it in manually every step +defaults: + run: + shell: bash -leo pipefail {0} + +jobs: + Intel: + runs-on: ubuntu-latest + strategy: + matrix: + compilers: ["CC=icc FC=ifort", "CC=icx FC=ifx"] + + steps: + + # See https://software.intel.com/content/www/us/en/develop/articles/oneapi-repo-instructions.html + - name: install-intel + 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 + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile + + - name: checkout-pfunit + uses: actions/checkout@v2 + with: + repository: Goddard-Fortran-Ecosystem/pFUnit + path: pfunit + + - name: cache-pfunit + id: cache-pfunit + uses: actions/cache@v2 + with: + path: ~/pfunit + key: pfunit-${{ runner.os }}-${{ matrix.compilers }} + + - name: build-pfunit + if: steps.cache-pfunit.outputs.cache-hit != 'true' + run: | + cd pfunit + mkdir build + cd build + ${{ matrix.compilers }} cmake .. -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit -DCMAKE_BUILD_TYPE=Release + make -j2 VERBOSE=1 + make install + + - name: checkout + uses: actions/checkout@v4 + with: + path: sfcio + submodules: true + + - name: build + run: | + cd sfcio + mkdir build + cd build + ${{ matrix.compilers }} cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit" + make -j2 VERBOSE=1 + + - name: test + run: | + cd $GITHUB_WORKSPACE/sfcio/build + make test VERBOSE=1 + diff --git a/CMakeLists.txt b/CMakeLists.txt index 32901d2..84d009d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") "MinSizeRel" "RelWithDebInfo") endif() -if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") +if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM|GNU|Clang|AppleClang)$") message( WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f69f26a..bdaf3e4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,7 @@ # # Mark Potts, Kyle Gerheiser -if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$") set(CMAKE_Fortran_FLAGS "-g -traceback -free -convert big_endian -assume byterecl ${CMAKE_Fortran_FLAGS}") set(CMAKE_Fortran_FLAGS_RELEASE "-O2")