-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from AlexanderRichert-NOAA/ci_updates_nov2023
Add IntelLLVM support and Spack-based CI
- Loading branch information
Showing
6 changed files
with
201 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp 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 | ||
make install | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: landsfcutil | ||
submodules: true | ||
|
||
- name: build | ||
run: | | ||
cd landsfcutil | ||
mkdir build | ||
cd build | ||
${{ matrix.compilers }} cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit" | ||
make -j2 VERBOSE=1 | ||
- name: test | ||
run: | | ||
cd $GITHUB_WORKSPACE/landsfcutil/build | ||
make test VERBOSE=1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# This is a CI workflow for the NCEPLIBS-landsfcutil project. | ||
# | ||
# This workflow builds landsfcutil with Spack, including installing with the "--test | ||
# root" option to run the pFunit test. It also has a one-off job that validates | ||
# the recipe by ensuring that every CMake option that should be set in the | ||
# Spack recipe is so set. | ||
# | ||
# Alex Richert, Sep 2023 | ||
name: Spack | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
Spack: | ||
strategy: | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
|
||
- name: checkout-landsfcutil | ||
uses: actions/checkout@v4 | ||
with: | ||
path: landsfcutil | ||
|
||
- name: spack-build-and-test | ||
run: | | ||
git clone -c feature.manyFiles=true https://github.com/jcsda/spack | ||
. spack/share/spack/setup-env.sh | ||
spack env create landsfcutil-env | ||
spack env activate landsfcutil-env | ||
cp $GITHUB_WORKSPACE/landsfcutil/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/landsfcutil/package.py | ||
spack develop --no-clone --path $GITHUB_WORKSPACE/landsfcutil landsfcutil@develop | ||
spack add landsfcutil@develop%gcc@11 +pfunit | ||
spack external find cmake gmake m4 python | ||
spack concretize | ||
# Run installation and run pFunit testing | ||
spack install --verbose --fail-fast --test root | ||
# Run 'spack load' to check for obvious errors in setup_run_environment | ||
spack load landsfcutil | ||
ls $LANDSFCUTIL_LIB | ||
ls $LANDSFCUTIL_LIB4 | ||
# This job validates the Spack recipe by making sure each cmake build option is represented | ||
recipe-check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: checkout-landsfcutil | ||
uses: actions/checkout@v4 | ||
with: | ||
path: landsfcutil | ||
|
||
- name: recipe-check | ||
run: | | ||
echo "If this jobs fails, look at the most recently output CMake option below and make sure that option appears in spack/package.py" | ||
for opt in $(grep -ioP '^option\(\K(?!(DUMMY_ENTRY))[^ ]+' $GITHUB_WORKSPACE/landsfcutil/CMakeLists.txt) ; do | ||
echo "Checking for presence of '$opt' CMake option in package.py" | ||
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/landsfcutil/spack/package.py | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This directory contains an authoritative, up-to-date Spack recipe for NCEPLIBS-landsfcutil, which is found under Spack as "landsfcutil". | ||
|
||
Before each release of NCEPLIBS-landsfcutil, this file should be updated to accommodate changes in build options, etc., and .github/workflows/spack.yml should be updated to exercise all variants. Only the version entry should need to be updated after the release prior to incorporation into the Spack repository and the JCSDA Spack fork. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other | ||
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
from spack.package import * | ||
|
||
|
||
class Landsfcutil(CMakePackage): | ||
"""Utility routines useful for initializing land-surface states in | ||
NCEP models. | ||
This is part of NOAA's NCEPLIBS project.""" | ||
|
||
homepage = "https://github.com/NOAA-EMC/NCEPLIBS-landsfcutil" | ||
url = "https://github.com/NOAA-EMC/NCEPLIBS-landsfcutil/archive/refs/tags/v2.4.1.tar.gz" | ||
git = "https://github.com/NOAA-EMC/NCEPLIBS-landsfcutil" | ||
|
||
maintainers("edwardhartnett", "AlexanderRichert-NOAA", "Hang-Lei-NOAA") | ||
|
||
version("develop", branch="develop") | ||
version("2.4.1", sha256="831c5005a480eabe9a8542b4deec838c2650f6966863ea2711cc0cc5db51ca14") | ||
|
||
variant("pfunit", default=False, description="Enable pFunit testing") | ||
|
||
depends_on("pfunit", when="+pfunit") | ||
|
||
def cmake_args(self): | ||
args = [ | ||
self.define("ENABLE_TESTS", self.run_tests), | ||
] | ||
return args | ||
|
||
def setup_run_environment(self, env): | ||
for suffix in ("4", "d"): | ||
lib = find_libraries( | ||
"liblandsfcutil_" + suffix, root=self.prefix, shared=False, recursive=True | ||
) | ||
|
||
env.set("LANDSFCUTIL_LIB" + suffix, lib[0]) | ||
env.set("LANDSFCUTIL_INC" + suffix, join_path(self.prefix, "include_" + suffix)) | ||
|
||
def flag_handler(self, name, flags): | ||
if self.spec.satisfies("%fj"): | ||
if name == "fflags": | ||
flags.append("-Free") | ||
return (None, None, flags) | ||
|
||
def check(self): | ||
with working_dir(self.builder.build_directory): | ||
make("test") |
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