From eff57d2bc57c26c7982500e817a7673be93bd5b6 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Fri, 7 May 2021 09:35:58 -0400 Subject: [PATCH] Github Action Improvements (#503) Add Intel build Add NetCDF build to test different versions of NetCDF, currently only 4.8.0 Documentation and debug build for test coverage and memory leaks Matrix build for macOS/Linux, OpenMPI/MPICH, NCEPLIBS develop/1.3.0 --- .../workflows/debug-docs-test_coverage.yml | 113 +++++++++ ...smf-8.0.1_jasper-2.0.22_nceplibs-1.3.0.yml | 155 ------------ ...f-8.0.1_jasper-2.0.22_nceplibs-develop.yml | 163 ------------- .github/workflows/intel.yml | 169 +++++++++++++ .github/workflows/linux-mac-nceplibs-mpi.yml | 223 ++++++++++++++++++ .github/workflows/netcdf-versions.yml | 155 ++++++++++++ 6 files changed, 660 insertions(+), 318 deletions(-) create mode 100644 .github/workflows/debug-docs-test_coverage.yml delete mode 100644 .github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-1.3.0.yml delete mode 100644 .github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-develop.yml create mode 100644 .github/workflows/intel.yml create mode 100644 .github/workflows/linux-mac-nceplibs-mpi.yml create mode 100644 .github/workflows/netcdf-versions.yml diff --git a/.github/workflows/debug-docs-test_coverage.yml b/.github/workflows/debug-docs-test_coverage.yml new file mode 100644 index 000000000..a903a7d59 --- /dev/null +++ b/.github/workflows/debug-docs-test_coverage.yml @@ -0,0 +1,113 @@ +name: debug-docs-test_coverage +on: [push, pull_request] + +defaults: + run: + shell: bash -exo pipefail {0} + +jobs: + debug-build-and-test: + runs-on: ubuntu-latest + + steps: + + - name: install-dependencies + run: | + sudo apt-get update + sudo apt-get install libmpich-dev + sudo apt-get install doxygen + sudo apt-get install libpng-dev + sudo apt-get install libjpeg-dev + sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config + python3 -m pip install gcovr + + - name: cache-esmf + id: cache-esmf + uses: actions/cache@v2 + with: + path: ~/esmf + key: esmf-8.0.1-${{ runner.os }} + + - name: build-esmf + if: steps.cache-esmf.outputs.cache-hit != 'true' + run: | + pushd ~ + export ESMF_DIR=~/esmf-ESMF_8_0_1 + wget https://github.com/esmf-org/esmf/archive/ESMF_8_0_1.tar.gz &> /dev/null + tar zxf ESMF_8_0_1.tar.gz + cd esmf-ESMF_8_0_1 + export ESMF_COMM=mpich3 + export ESMF_INSTALL_BINDIR=bin + export ESMF_INSTALL_LIBDIR=lib + export ESMF_INSTALL_MODDIR=mod + export ESMF_COMPILER=gfortran + export ESMF_INSTALL_PREFIX=~/esmf + export ESMF_NETCDF=split + export ESMF_NETCDF_INCLUDE=/usr/include + export ESMF_NETCDF_LIBPATH=/usr/x86_64-linux-gnu + make -j2 + make install + + - name: cache-jasper + id: cache-jasper + uses: actions/cache@v2 + with: + path: ~/jasper + key: jasper-2.0.25-${{ runner.os }} + + - name: build-jasper + if: steps.cache-jasper.outputs.cache-hit != 'true' + run: | + wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null + tar zxf version-2.0.25.tar.gz + cd jasper-version-2.0.25 + mkdir build-jasper && cd build-jasper + cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper + make -j2 + make install + + - name: cache-nceplibs + id: cache-nceplibs + uses: actions/cache@v2 + with: + path: ~/nceplibs + key: nceplibs-1.3.0-${{ runner.os }} + + - name: build-nceplibs + if: steps.cache-nceplibs.outputs.cache-hit != 'true' + run: | + wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.3.0.tar.gz &> /dev/null + tar zxf v1.3.0.tar.gz + cd NCEPLIBS-1.3.0 + export ESMFMKFILE=~/esmf/lib/esmf.mk + mkdir build && cd build + cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON + make -j2 + + - name: checkout-ufs-utils + uses: actions/checkout@v2 + with: + path: ufs_utils + + - name: build + run: | + export ESMFMKFILE=~/esmf/lib/esmf.mk + cd ufs_utils + mkdir build && cd build + export CC=mpicc + export CXX=mpicxx + export FC=mpifort + cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs' -DCMAKE_BUILD_TYPE=Debug -DENABLE_DOCS=On -DCMAKE_Fortran_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" + make -j2 + + - name: test + run: | + cd ufs_utils/build + ctest --rerun-failed --output-on-failure + export PATH="/home/runner/.local/bin:$PATH" + gcovr -r .. --html-details -o test-coverage.html + + - uses: actions/upload-artifact@v2 + with: + name: test-coverage + path: ufs_utils/build/*.html diff --git a/.github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-1.3.0.yml b/.github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-1.3.0.yml deleted file mode 100644 index 48fe75cef..000000000 --- a/.github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-1.3.0.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: esmf-8.0.1_jasper-2.0.22_nceplibs-1.3.0 -on: [push, pull_request] - -jobs: - build: - runs-on: ${{ matrix.os }} - env: - CC: gcc-9 - FC: gfortran-9 - CXX: g++-9 - strategy: - matrix: - os: [macos-10.15, ubuntu-20.04] - compiler: [gcc-9] - - steps: - - - name: cache-mpich - id: cache-mpich - uses: actions/cache@v2 - with: - path: ~/mpich - key: mpich-${{ runner.os }}-3.3.2-1 - - - name: build-mpich - if: steps.cache-mpich.outputs.cache-hit != 'true' - run: | - if [[ ${{ matrix.os }} == "macos-10.15" ]]; then - wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz &> /dev/null - tar -xzf mpich-3.3.2.tar.gz - pushd mpich-3.3.2 - ./configure --prefix=$HOME/mpich - make - sudo make install - popd - fi - - - name: install-dependencies - run: | - echo "$HOME/mpich/bin" >> $GITHUB_PATH - if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then - sudo apt-get update - sudo apt-get install libmpich-dev - sudo apt-get install doxygen - sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config - sudo apt-get install libpng-dev - sudo apt-get install libjpeg-dev - elif [[ ${{ matrix.os }} == "macos-10.15" ]]; then - brew update - brew install doxygen - brew install mpich - brew install netcdf - brew install wget - if [[ ${{ matrix.compiler }} == "gcc-9" ]]; then - sudo ln -sf /usr/local/bin/gfortran-9 /usr/local/bin/gfortran - elif [[ ${{ matrix.compiler }} == "gcc-10" ]]; then - sudo ln -sf /usr/local/bin/gfortran-10 /usr/local/bin/gfortran - fi - fi - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: esmf-${{ runner.os }}-8.0.1-2 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - set -x - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_0_1 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_0_1.tar.gz &> /dev/null && ls -l - tar zxf ESMF_8_0_1.tar.gz && ls -l - cd esmf-ESMF_8_0_1 - export ESMF_COMM=mpich3 - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then - export ESMF_NETCDF_INCLUDE=/usr/include - export ESMF_NETCDF_LIBPATH=/usr/x86_64-linux-gnu - elif [[ ${{ matrix.os }} == "macos-10.15" ]]; then - export ESMF_NETCDF_INCLUDE=/usr/local/include - export ESMF_NETCDF_LIBPATH=/usr/local/lib - fi - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: jasper-${{ runner.os }}-2.0.22 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - set -x - pwd - wget https://github.com/jasper-software/jasper/archive/version-2.0.22.tar.gz &> /dev/null && ls -l - tar zxf version-2.0.22.tar.gz && ls -l - cd jasper-version-2.0.22 - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper - make -j2 - make install - - - name: checkout-nceplibs - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS - path: nceplibs - - - name: cache-nceplibs - id: cache-nceplibs - uses: actions/cache@v2 - with: - path: ~/nceplibs - key: nceplibs-${{ runner.os }}-1.3.0 - - - name: build-nceplibs - if: steps.cache-nceplibs.outputs.cache-hit != 'true' - run: | - set -x - export ESMFMKFILE=~/esmf/lib/esmf.mk - wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.3.0.tar.gz &> /dev/null - tar zxf v1.3.0.tar.gz && ls -l - cd NCEPLIBS-1.3.0 - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON - make -j2 - - - name: checkout-ufs-utils - uses: actions/checkout@v2 - with: - path: ufs_utils - - - name: build-ufs-utils - run: | - set -x - mpicc --version - mpifort --version - pwd - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd ufs_utils - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/nceplibs' -DENABLE_DOCS=On - make -j2 - make test diff --git a/.github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-develop.yml b/.github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-develop.yml deleted file mode 100644 index c06b9c680..000000000 --- a/.github/workflows/esmf-8.0.1_jasper-2.0.22_nceplibs-develop.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: esmf-8.0.1_jasper-2.0.22_nceplibs-develop -on: [push, pull_request] - -jobs: - build: - runs-on: ${{ matrix.os }} - env: - CC: gcc-9 - FC: gfortran-9 - CXX: g++-9 - strategy: - matrix: - os: [macos-10.15, ubuntu-20.04] - compiler: [gcc-9] - - steps: - - name: cache-mpich - id: cache-mpich - uses: actions/cache@v2 - with: - path: ~/mpich - key: mpich-${{ runner.os }}-3.3.2-1 - - - name: build-mpich - if: steps.cache-mpich.outputs.cache-hit != 'true' - run: | - if [[ ${{ matrix.os }} == "macos-10.15" ]]; then - wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz &> /dev/null - tar -xzf mpich-3.3.2.tar.gz - pushd mpich-3.3.2 - ./configure --prefix=$HOME/mpich - make - sudo make install - popd - fi - - - name: install-dependencies - run: | - echo "/home/runner/mpich/bin" >> $GITHUB_PATH - if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then - sudo apt-get update - sudo apt-get install libmpich-dev - sudo apt-get install doxygen - sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config - sudo apt-get install libpng-dev - sudo apt-get install libjpeg-dev - elif [[ ${{ matrix.os }} == "macos-10.15" ]]; then - echo "$HOME/mpich/bin" >> $GITHUB_PATH - brew update - brew install doxygen - brew install mpich - brew install netcdf - brew install wget - if [[ ${{ matrix.compiler }} == "gcc-9" ]]; then - sudo ln -sf /usr/local/bin/gfortran-9 /usr/local/bin/gfortran - elif [[ ${{ matrix.compiler }} == "gcc-10" ]]; then - sudo ln -sf /usr/local/bin/gfortran-10 /usr/local/bin/gfortran - fi - fi - python3 -m pip install gcovr - - - name: cache-esmf - id: cache-esmf - uses: actions/cache@v2 - with: - path: ~/esmf - key: esmf-${{ runner.os }}-8.0.1-2 - - - name: build-esmf - if: steps.cache-esmf.outputs.cache-hit != 'true' - run: | - set -x - pushd ~ - export ESMF_DIR=~/esmf-ESMF_8_0_1 - wget https://github.com/esmf-org/esmf/archive/ESMF_8_0_1.tar.gz &> /dev/null && ls -l - tar zxf ESMF_8_0_1.tar.gz && ls -l - cd esmf-ESMF_8_0_1 - export ESMF_COMM=mpich3 - export ESMF_INSTALL_BINDIR=bin - export ESMF_INSTALL_LIBDIR=lib - export ESMF_INSTALL_MODDIR=mod - export ESMF_COMPILER=gfortran - export ESMF_INSTALL_PREFIX=~/esmf - export ESMF_NETCDF=split - if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then - export ESMF_NETCDF_INCLUDE=/usr/include - export ESMF_NETCDF_LIBPATH=/usr/x86_64-linux-gnu - elif [[ ${{ matrix.os }} == "macos-10.15" ]]; then - export ESMF_NETCDF_INCLUDE=/usr/local/include - export ESMF_NETCDF_LIBPATH=/usr/local/lib - fi - make -j2 - make install - - - name: cache-jasper - id: cache-jasper - uses: actions/cache@v2 - with: - path: ~/jasper - key: jasper-${{ runner.os }}-2.0.22 - - - name: build-jasper - if: steps.cache-jasper.outputs.cache-hit != 'true' - run: | - set -x - pwd - wget https://github.com/jasper-software/jasper/archive/version-2.0.22.tar.gz &> /dev/null && ls -l - tar zxf version-2.0.22.tar.gz && ls -l - cd jasper-version-2.0.22 - mkdir build-jasper && cd build-jasper - cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper - make -j2 - make install - - - name: checkout-nceplibs - uses: actions/checkout@v2 - with: - repository: NOAA-EMC/NCEPLIBS - path: nceplibs - - - name: get-git-hash - run: | - cd nceplibs - git rev-parse HEAD > hash.txt - - - name: cache-nceplibs-develop - id: cache-nceplibs-develop - uses: actions/cache@v2 - with: - path: ~/nceplibs - key: nceplibs-develop-${{ runner.os }}-${{ hashFiles('nceplibs/hash.txt') }} - - - name: build-nceplibs - if: steps.cache-nceplibs-develop.outputs.cache-hit != 'true' - run: | - set -x - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd nceplibs - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON - make -j2 - - - name: checkout-ufs-utils - uses: actions/checkout@v2 - with: - path: ufs_utils - - - name: build-ufs-utils - run: | - export ESMFMKFILE=~/esmf/lib/esmf.mk - cd ufs_utils - mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs' -DENABLE_DOCS=On -DCMAKE_Fortran_FLAGS="-g -fprofile-arcs -ftest-coverage -O0" -DCMAKE_BUILD_TYPE=Debug - make -j2 - make test - export PATH="/home/runner/.local/bin:$PATH" - gcovr -r .. --html-details -o test-coverage.html - - - uses: actions/upload-artifact@v2 - if: ${{ matrix.os == 'ubuntu-20.04' }} - with: - name: test-coverage - path: ufs_utils/build/*.html diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml new file mode 100644 index 000000000..696589cfa --- /dev/null +++ b/.github/workflows/intel.yml @@ -0,0 +1,169 @@ +name: intel +on: [push, pull_request] + +# 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-build-and-test: + runs-on: ${{ matrix.os }} + env: + CC: icc + FC: ifort + CXX: icpc + strategy: + matrix: + os: [ubuntu-20.04] + + 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: cache-netcdf + id: cache-netcdf + uses: actions/cache@v2 + with: + path: ~/netcdf + key: netcdf-c-$4.7.4-{{ runner.os }}-intel + + - name: build-hdf5 + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + export CC=mpiicc + wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null + tar -xzf hdf5-1.10.7.tar.gz + pushd hdf5-1.10.7 + ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests + make -j2 + make install + + - name: build-netcdf-c + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + export CC=mpiicc + export CPPFLAGS=-I${HOME}/netcdf/include + export LDFLAGS=-L${HOME}/netcdf/lib + wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-c-4.7.4.tar.gz &> /dev/null + tar -xzf netcdf-c-4.7.4.tar.gz + pushd netcdf-c-4.7.4 + ./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities + make -j2 + make install + + - name: build-netcdf-fortran + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${HOME}/netcdf/lib" + export PATH="${HOME}/netcdf/bin:$PATH" + export CC=mpiicc + export FC=mpiifort + export CPPFLAGS=-I${HOME}/netcdf/include + export LDFLAGS=-L${HOME}/netcdf/lib + wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null + tar -xzf v4.5.3.tar.gz + pushd netcdf-fortran-4.5.3 + ./configure --prefix=${HOME}/netcdf + make -j2 + make install + + - name: cache-esmf + id: cache-esmf + uses: actions/cache@v2 + with: + path: ~/esmf + key: esmf-8.0.1-${{ runner.os }}-intel + + - name: build-esmf + if: steps.cache-esmf.outputs.cache-hit != 'true' + run: | + pushd ~ + export ESMF_DIR=~/esmf-ESMF_8_0_1 + wget https://github.com/esmf-org/esmf/archive/ESMF_8_0_1.tar.gz &> /dev/null + tar zxf ESMF_8_0_1.tar.gz + cd esmf-ESMF_8_0_1 + export ESMF_COMM=intelmpi + export ESMF_INSTALL_BINDIR=bin + export ESMF_INSTALL_LIBDIR=lib + export ESMF_INSTALL_MODDIR=mod + export ESMF_COMPILER=intel + export ESMF_INSTALL_PREFIX=~/esmf + export ESMF_NETCDF=split + export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include + export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib + make -j2 + make install + + - name: cache-jasper + id: cache-jasper + uses: actions/cache@v2 + with: + path: ~/jasper + key: jasper-2.0.25-${{ runner.os }}-intel + + - name: build-jasper + if: steps.cache-jasper.outputs.cache-hit != 'true' + run: | + wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null + tar zxf version-2.0.25.tar.gz + cd jasper-version-2.0.25 + mkdir build-jasper && cd build-jasper + cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper + make -j2 + make install + + - name: checkout-nceplibs + uses: actions/checkout@v2 + with: + repository: NOAA-EMC/NCEPLIBS + path: nceplibs + + - name: cache-nceplibs + id: cache-nceplibs + uses: actions/cache@v2 + with: + path: ~/nceplibs + key: nceplibs-1.3.0-${{ runner.os }}-intel + + - name: build-nceplibs + if: steps.cache-nceplibs.outputs.cache-hit != 'true' + run: | + export ESMFMKFILE=~/esmf/lib/esmf.mk + wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.3.0.tar.gz &> /dev/null + tar zxf v1.3.0.tar.gz + cd NCEPLIBS-1.3.0 + mkdir build && cd build + cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON + make -j2 + + - name: checkout-ufs-utils + uses: actions/checkout@v2 + with: + path: ufs_utils + + - name: build + run: | + export ESMFMKFILE=~/esmf/lib/esmf.mk + cd ufs_utils + mkdir build && cd build + cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH='~;~/jasper;~/nceplibs;~/netcdf' + make -j2 + + - name: test + run: | + cd ufs_utils/build + ctest --rerun-failed --output-on-failure + + diff --git a/.github/workflows/linux-mac-nceplibs-mpi.yml b/.github/workflows/linux-mac-nceplibs-mpi.yml new file mode 100644 index 000000000..51af07062 --- /dev/null +++ b/.github/workflows/linux-mac-nceplibs-mpi.yml @@ -0,0 +1,223 @@ +name: linux-mac-mpi-nceplibs +on: [push, pull_request] + +defaults: + run: + shell: bash -exo pipefail {0} + +jobs: + matrix-build-and-test: + runs-on: ${{ matrix.os }} + env: + CC: gcc-9 + FC: gfortran-9 + CXX: g++-9 + strategy: + matrix: + os: [macos-10.15, ubuntu-20.04] + compiler: [gcc-9] + nceplibs_version: [develop, 1.3.0] + mpi_type: [mpich, openmpi] + netcdf_version: [4.7.4] + + steps: + + - name: install-dependencies + run: | + echo "$HOME/mpi/bin" >> $GITHUB_PATH + if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then + sudo apt-get update + sudo apt-get install libpng-dev + sudo apt-get install libjpeg-dev + elif [[ ${{ matrix.os }} == "macos-10.15" ]]; then + brew update + brew install wget + if [[ ${{ matrix.compiler }} == "gcc-9" ]]; then + sudo ln -sf /usr/local/bin/gfortran-9 /usr/local/bin/gfortran + elif [[ ${{ matrix.compiler }} == "gcc-10" ]]; then + sudo ln -sf /usr/local/bin/gfortran-10 /usr/local/bin/gfortran + fi + fi + python3 -m pip install gcovr + + - name: cache-mpi + id: cache-mpi + uses: actions/cache@v2 + with: + path: ~/mpi + key: mpi-${{ matrix.mpi_type }}-${{ runner.os }} + + - name: build-mpi + if: steps.cache-mpi.outputs.cache-hit != 'true' + run: | + if [[ ${{ matrix.mpi_type}} == "mpich" ]]; then + wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz &> /dev/null + tar -xzf mpich-3.3.2.tar.gz + cd mpich-3.3.2 + ./configure --prefix=$HOME/mpi --enable-fortran --enable-cxx + make -j2 + make install + elif [[ ${{ matrix.mpi_type }} == "openmpi" ]]; then + wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.1.tar.gz &> /dev/null + tar -xzf openmpi-4.1.1.tar.gz + cd openmpi-4.1.1 + if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then + ./configure --prefix=$HOME/mpi --enable-mpi-fortran --enable-mpi-cxx + elif [[ ${{ matrix.os }} == "macos-10.15" ]]; then + ./configure --prefix=$HOME/mpi --enable-mpi-fortran --enable-mpi-cxx --enable-two-level-namespace + fi + make -j2 + make install + fi + + - name: cache-netcdf + id: cache-netcdf + uses: actions/cache@v2 + with: + path: ~/netcdf + key: netcdf-c-${{ matrix.netcdf_version }}-${{ runner.os }}-${{ matrix.mpi_type }} + + - name: build-hdf5 + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + export CC=mpicc + wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null + tar -xzf hdf5-1.10.7.tar.gz + pushd hdf5-1.10.7 + ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests + make -j2 + make install + + - name: build-netcdf-c + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + export CC=mpicc + export CPPFLAGS=-I${HOME}/netcdf/include + export LDFLAGS=-L${HOME}/netcdf/lib + wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-c-${{ matrix.netcdf_version }}.tar.gz &> /dev/null + tar -xzf netcdf-c-${{ matrix.netcdf_version }}.tar.gz + cd netcdf-c-${{ matrix.netcdf_version }} + ./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities + make -j2 + make install + + - name: build-netcdf-fortran + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + set -x + export PATH="${HOME}/netcdf/bin:$PATH" + export CC=mpicc + export FC=mpifort + export CPPFLAGS=-I${HOME}/netcdf/include + export LDFLAGS=-L${HOME}/netcdf/lib + wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null + tar -xzf v4.5.3.tar.gz + pushd netcdf-fortran-4.5.3 + ./configure --prefix=${HOME}/netcdf + make -j2 + make install + + - name: cache-esmf + id: cache-esmf + uses: actions/cache@v2 + with: + path: ~/esmf + key: esmf--8.0.1-${{ runner.os }}-${{ matrix.mpi_type }}-netcdf-${{ matrix.netcdf_version }} + + - name: build-esmf + if: steps.cache-esmf.outputs.cache-hit != 'true' + run: | + set -x + pushd ~ + export ESMF_DIR=~/esmf-ESMF_8_0_1 + wget https://github.com/esmf-org/esmf/archive/ESMF_8_0_1.tar.gz &> /dev/null + tar zxf ESMF_8_0_1.tar.gz + cd esmf-ESMF_8_0_1 + if [[ ${{ matrix.mpi_type}} == "mpich" ]]; then + export ESMF_COMM=mpich3 + elif [[ ${{ matrix.mpi_type}} == "openmpi" ]]; then + export ESMF_COMM=openmpi + fi + export ESMF_INSTALL_BINDIR=bin + export ESMF_INSTALL_LIBDIR=lib + export ESMF_INSTALL_MODDIR=mod + export ESMF_COMPILER=gfortran + export ESMF_INSTALL_PREFIX=~/esmf + export ESMF_NETCDF=split + export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include + export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib + make -j2 + make install + + - name: cache-jasper + id: cache-jasper + uses: actions/cache@v2 + with: + path: ~/jasper + key: jasper-2.0.25-${{ runner.os }} + + - name: build-jasper + if: steps.cache-jasper.outputs.cache-hit != 'true' + run: | + set -x + pwd + wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null + tar zxf version-2.0.25.tar.gz + cd jasper-version-2.0.25 + mkdir build-jasper && cd build-jasper + cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper + make -j2 + make install + + - name: checkout-nceplibs + run: | + git clone https://github.com/NOAA-EMC/NCEPLIBS.git nceplibs + cd nceplibs + if [[ ${{ matrix.nceplibs_version }} == "1.3.0" ]]; then + git checkout v1.3.0 + fi + + - name: get-git-hash + run: | + cd nceplibs + git rev-parse HEAD > hash.txt + + - name: cache-nceplibs + id: cache-nceplibs + uses: actions/cache@v2 + with: + path: ~/nceplibs + key: nceplibs-${{ matrix.nceplibs_version }}-${{ runner.os }}-${{ matrix.mpi_type }}-${{ hashFiles('nceplibs/hash.txt') }} + + - name: build-nceplibs + if: steps.cache-nceplibs.outputs.cache-hit != 'true' + run: | + set -x + export ESMFMKFILE=~/esmf/lib/esmf.mk + cd nceplibs + mkdir build && cd build + cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON + make -j2 + + - name: checkout-ufs-utils + uses: actions/checkout@v2 + with: + path: ufs_utils + + - name: build + run: | + export ESMFMKFILE=~/esmf/lib/esmf.mk + cd ufs_utils + mkdir build && cd build + export CC=mpicc + export CXX=mpicxx + export FC=mpifort + cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' + make -j2 + + - name: test + run: | + cd ufs_utils/build + # Oversubscribe for OpenMPI to run more processes than CPUs + export OMPI_MCA_rmaps_base_oversubscribe=1 + ctest --rerun-failed --output-on-failure diff --git a/.github/workflows/netcdf-versions.yml b/.github/workflows/netcdf-versions.yml new file mode 100644 index 000000000..72b392b85 --- /dev/null +++ b/.github/workflows/netcdf-versions.yml @@ -0,0 +1,155 @@ +name: netcdf-versions +on: [push, pull_request] + +defaults: + run: + shell: bash -exo pipefail {0} + +jobs: + netcdf-build-and-test: + runs-on: ubuntu-latest + + strategy: + matrix: + os: [ubuntu-latest] + netcdf_version: [4.8.0] + + steps: + - name: install-dependencies + run: | + sudo apt-get update + sudo apt-get install libmpich-dev + sudo apt-get install doxygen + sudo apt-get install libpng-dev + sudo apt-get install libjpeg-dev + + - name: cache-netcdf + id: cache-netcdf + uses: actions/cache@v2 + with: + path: ~/netcdf + key: netcdf-c-${{ matrix.netcdf_version }}-${{ runner.os }} + + - name: build-hdf5 + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + export CC=mpicc + wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null + tar -xzf hdf5-1.10.7.tar.gz + pushd hdf5-1.10.7 + ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests + make -j2 + make install + + - name: build-netcdf-c + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + export CC=mpicc + export CPPFLAGS=-I${HOME}/netcdf/include + export LDFLAGS=-L${HOME}/netcdf/lib + wget https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-c-${{ matrix.netcdf_version }}.tar.gz &> /dev/null + tar -xzf netcdf-c-${{ matrix.netcdf_version }}.tar.gz + cd netcdf-c-${{ matrix.netcdf_version }} + ./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities + make -j2 + make install + + - name: build-netcdf-fortran + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + set -x + export PATH="${HOME}/netcdf/bin:$PATH" + export CC=mpicc + export FC=mpifort + export CPPFLAGS=-I${HOME}/netcdf/include + export LDFLAGS=-L${HOME}/netcdf/lib + wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null + tar -xzf v4.5.3.tar.gz + pushd netcdf-fortran-4.5.3 + ./configure --prefix=${HOME}/netcdf + make -j2 + make install + + - name: cache-esmf + id: cache-esmf + uses: actions/cache@v2 + with: + path: ~/esmf + key: esmf-8.0.1-${{ runner.os }}-netcdf-${{ matrix.netcdf_version }} + + - name: build-esmf + if: steps.cache-esmf.outputs.cache-hit != 'true' + run: | + pushd ~ + export ESMF_DIR=~/esmf-ESMF_8_0_1 + wget https://github.com/esmf-org/esmf/archive/ESMF_8_0_1.tar.gz &> /dev/null + tar zxf ESMF_8_0_1.tar.gz + cd esmf-ESMF_8_0_1 + export ESMF_COMM=mpich3 + export ESMF_INSTALL_BINDIR=bin + export ESMF_INSTALL_LIBDIR=lib + export ESMF_INSTALL_MODDIR=mod + export ESMF_COMPILER=gfortran + export ESMF_INSTALL_PREFIX=~/esmf + export ESMF_NETCDF=split + export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include + export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib + make -j2 + make install + + - name: cache-jasper + id: cache-jasper + uses: actions/cache@v2 + with: + path: ~/jasper + key: jasper-2.0.25-${{ runner.os }} + + - name: build-jasper + if: steps.cache-jasper.outputs.cache-hit != 'true' + run: | + wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null + tar zxf version-2.0.25.tar.gz + cd jasper-version-2.0.25 + mkdir build-jasper && cd build-jasper + cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper + make -j2 + make install + + - name: cache-nceplibs + id: cache-nceplibs + uses: actions/cache@v2 + with: + path: ~/nceplibs + key: nceplibs-1.3.0-${{ runner.os }}-netcdf-${{ matrix.netcdf_version }} + + - name: build-nceplibs + if: steps.cache-nceplibs.outputs.cache-hit != 'true' + run: | + wget https://github.com/NOAA-EMC/NCEPLIBS/archive/v1.3.0.tar.gz &> /dev/null + tar zxf v1.3.0.tar.gz + cd NCEPLIBS-1.3.0 + export ESMFMKFILE=~/esmf/lib/esmf.mk + mkdir build && cd build + cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON + make -j2 + + - name: checkout-ufs-utils + uses: actions/checkout@v2 + with: + path: ufs_utils + + - name: build + run: | + export ESMFMKFILE=~/esmf/lib/esmf.mk + cd ufs_utils + mkdir build && cd build + export CC=mpicc + export CXX=mpicxx + export FC=mpifort + cmake .. -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' -DCMAKE_BUILD_TYPE=Debug + make -j2 + + - name: test + run: | + cd ufs_utils/build + ctest --rerun-failed --output-on-failure \ No newline at end of file