Skip to content

Commit

Permalink
Merge sp into ip (#210)
Browse files Browse the repository at this point in the history
* ***Merge sp into ip***: main code; tests; spack recipe; update VERSION to 5.0.0

* update cmake option descriptions

* u

* Update docs (incl. incorporate sp docs)

* Doc updates; fix doc build of sp routines

* Update docs/layout

* cmake description tweak

* update docs

* Fix parallel test exe builds

* remove layout.xml

* simplify spack CI

* fix some type mismatches in fftpack.F

* test allowing arg mismatch

* clean up linux CI

* move arg mismatch flag

* update flags from sp

* Revert "fix some type mismatches in fftpack.F"

This reverts commit 7f9f5bf.

* remove layout.xml from docs/CMakeLists.txt

* move bigendian setting to sp tests only

* fix tests/CMakeLists.txt typo

* fix spack CI

* update CI for sp merge

* set -fno-bounds-check

* whitelist TEST_TIME_LIMIT in recipe check CI

* update macos ci

* remove noboundcheck flag

* disable asan for fftpack.F

* Revert "disable asan for fftpack.F"

This reverts commit 64f4a9a.

* disable bounds checks for specific sp files

* remove ip2 references

* rename test coverage artifact

* update license

* update README.md

* Update package.py

* Update Intel.yml
  • Loading branch information
AlexanderRichert-NOAA authored Jan 23, 2024
1 parent e13d63d commit cfbcd25
Show file tree
Hide file tree
Showing 103 changed files with 9,297 additions and 390 deletions.
29 changes: 2 additions & 27 deletions .github/workflows/Intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,8 @@ jobs:
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
sudo apt-get install intel-oneapi-openmp intel-oneapi-compiler-fortran-2023.2.1 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.2.1
echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile
- name: cache-sp
id: cache-sp
uses: actions/cache@v2
with:
path: ~/sp
key: sp-${{ runner.os }}-Intel-${{ matrix.compilers }}-${{ matrix.openmp }}

- name: checkout-sp
if: steps.cache-sp.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: NOAA-EMC/NCEPLIBS-sp
path: sp
ref: develop

- name: build-sp
if: steps.cache-sp.outputs.cache-hit != 'true'
run: |
cd sp
mkdir build
cd build
${{ matrix.compilers }} cmake -DCMAKE_INSTALL_PREFIX=~/sp -DOPENMP=${{ matrix.openmp}} -DBUILD_8=ON ..
make -j2
make install
- name: checkout
uses: actions/checkout@v2
Expand All @@ -75,7 +50,7 @@ jobs:
cd ip
mkdir build
cd build
${{ matrix.compilers }} cmake -DOPENMP=${{ matrix.openmp }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_PREFIX_PATH="~/sp" -DBUILD_8=ON ..
${{ matrix.compilers }} cmake -DOPENMP=${{ matrix.openmp }} -DBUILD_SHARED_LIBS=OFF -DBUILD_8=ON ..
make -j2 VERBOSE=1
- name: test
Expand Down
29 changes: 1 addition & 28 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,20 @@ jobs:

steps:

- name: cache-sp
id: cache-sp
uses: actions/cache@v2
with:
path: ~/sp
key: sp-${{ runner.os }}-Linux-${{ matrix.openmp }}-2.3.3-1

- name: checkout-sp
if: steps.cache-sp.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: NOAA-EMC/NCEPLIBS-sp
path: sp
ref: v2.3.3

- name: build-sp
if: steps.cache-sp.outputs.cache-hit != 'true'
run: |
cd sp
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=~/sp -DOPENMP=${{ matrix.openmp }} ${{ matrix.options }} ..
make -j2
make install
- name: checkout
uses: actions/checkout@v2
with:
path: ip
submodules: true

- name: build
run: |
cd ip
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH="~/" -DOPENMP=${{ matrix.openmp }} ${{ matrix.options }} ..
make -j2
make -j2 VERBOSE=1
- name: test
run: |
cd $GITHUB_WORKSPACE/ip/build
ctest --verbose --output-on-failure --rerun-failed
29 changes: 1 addition & 28 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,6 @@ jobs:

steps:

- name: cache-sp
id: cache-sp
uses: actions/cache@v2
with:
path: ~/sp
key: sp-${{ matrix.openmp }}-MacOS-2.3.3-1

- name: checkout-sp
if: steps.cache-sp.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: NOAA-EMC/NCEPLIBS-sp
path: sp
ref: v2.3.3

- name: build-sp
if: steps.cache-sp.outputs.cache-hit != 'true'
run: |
cd sp
mkdir build
cd build
cmake -DOPENMP=${{ matrix.openmp }} -DCMAKE_INSTALL_PREFIX=~/sp -DBUILD_SHARED_LIBS=${{ matrix.sharedlibs }} -DBUILD_8=ON ..
make -j2
make install
ls -l ~/sp
ls -l ~/sp/lib
- name: checkout
uses: actions/checkout@v2
with:
Expand All @@ -62,7 +35,7 @@ jobs:
cd ip
mkdir build
cd build
cmake -DOPENMP=${{ matrix.openmp }} -DCMAKE_PREFIX_PATH="~/sp" -DBUILD_SHARED_LIBS=${{ matrix.sharedlibs }} -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_8=ON ..
cmake -DOPENMP=${{ matrix.openmp }} -DBUILD_SHARED_LIBS=${{ matrix.sharedlibs }} -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_8=ON ..
make -j2 VERBOSE=2
make install
ls -l ~/install
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/Spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest"]
openmp: ["+openmp", "~openmp"]
sharedlibs: ["+shared", "~shared"]
pic: ["+pic", "~pic"]
precision: ["d", "4", "8"]
variants: ["+openmp +shared +pic precision=d", "+openmp ~shared ~pic precision=4", "~openmp ~shared +pic precision=8"]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -42,16 +39,18 @@ jobs:
spack env activate ip-env
cp $GITHUB_WORKSPACE/ip/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/ip/package.py
spack develop --no-clone --path $GITHUB_WORKSPACE/ip ip@develop
spack add ip@develop%gcc@11 ${{ matrix.openmp }} ${{ matrix.sharedlibs }} ${{ matrix.pic }} precision=${{ matrix.precision }} target=x86_64
if [ ${{ matrix.precision }} == "d" ]; then spack add grib-util@develop ; fi
spack add ip@develop%gcc@11 ${{ matrix.variants }} target=x86_64
precision=$(echo ${{ matrix.variants }} | grep -oP " precision=\K[4d8]")
if [ "$precision" == "d" ]; then spack add grib-util@develop ; fi
spack external find cmake gmake
spack concretize
# Run installation and run CTest suite
spack install --verbose --fail-fast --test root
# Run 'spack load' and check that key build options were respected
spack load ip
if [ ${{ matrix.sharedlibs }} == "+shared" ]; then suffix="so" ; else suffix="a"; fi
ls ${IP_LIB${{ matrix.precision }}} | grep -cE '/libip_${{ matrix.precision }}\.'$suffix'$'
if [[ "${{ matrix.variants }}" =~ "+shared" ]]; then suffix="so" ; else suffix="a"; fi
libvar=IP_LIB${precision}
ls ${!libvar} | grep -cE "/libip_${precision}\."$suffix'$'
# This job validates the Spack recipe by making sure each cmake build option is represented
recipe-check:
Expand All @@ -67,7 +66,7 @@ jobs:
- 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(?!(ENABLE_DOCS))[^ ]+' $GITHUB_WORKSPACE/ip/CMakeLists.txt) ; do
for opt in $(grep -ioP '^option\(\K(?!(ENABLE_DOCS|TEST_TIME_LIMIT))[^ ]+' $GITHUB_WORKSPACE/ip/CMakeLists.txt) ; do
echo "Checking for presence of '$opt' CMake option in package.py"
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/ip/spack/package.py
done
19 changes: 2 additions & 17 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,6 @@ jobs:
sudo apt-get install doxygen
python3 -m pip install gcovr
- name: checkout-sp
uses: actions/checkout@v2
with:
repository: NOAA-EMC/NCEPLIBS-sp
path: sp

- name: build-sp
run: |
cd sp
mkdir build
cd build
cmake -DOPENMP=ON -DCMAKE_INSTALL_PREFIX=~/sp -DBUILD_8=ON ..
make -j2
make install
- name: checkout
uses: actions/checkout@v2
with:
Expand All @@ -53,7 +38,7 @@ jobs:
cd ip
mkdir build
cd build
cmake -DENABLE_DOCS=YES -DCMAKE_PREFIX_PATH="~/" -DOPENMP=ON -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DBUILD_8=ON ..
cmake -DENABLE_DOCS=YES -DOPENMP=ON -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DBUILD_8=ON ..
make -j2 VERBOSE=1
- name: test
Expand All @@ -69,7 +54,7 @@ jobs:
- name: upload-test-coverage
uses: actions/upload-artifact@v2
with:
name: test-coverage
name: ip-test-coverage
path: |
ip/build/*.html
ip/build/*.css
Expand Down
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ project(ip VERSION ${pVersion} LANGUAGES C Fortran)
include(GNUInstallDirs)

# Handle user options.
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)
option(ENABLE_DOCS "Enable generation of Doxygen-based documentation" OFF)
option(OPENMP "Use OpenMP threading" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(BUILD_4 "Build the 4-byte real version of the library, libip_4.a" ON)
option(BUILD_D "Build the 8-byte real version of the library, libip_d.a" ON)
option(BUILD_8 "Build the 8-byte integer version of the library, libsp_8.a" OFF)
option(BUILD_4 "Build the 4-byte real version of the library, libip_4.{a,so}" ON)
option(BUILD_D "Build the 8-byte real version of the library, libip_d.{a,so}" ON)
option(BUILD_8 "Build the 8-byte integer & real version of the library, libip_8.{a,so}" OFF)
option(BUILD_DEPRECATED "Build deprecated spectral processing functions" OFF)
option(TEST_TIME_LIMIT "Set timeout for tests" OFF)

# Figure whether user wants a _4, a _d, and/or _8.
if(BUILD_4)
Expand Down Expand Up @@ -47,9 +49,6 @@ if(OPENMP)
find_package(OpenMP REQUIRED COMPONENTS Fortran)
endif()

# We need the NCEPLIBS-sp library.
find_package(sp 2.3.0 REQUIRED)

# Set compiler flags.
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -traceback -assume byterecl -fp-model strict -fpp -auto ${CMAKE_Fortran_FLAGS}")
Expand All @@ -61,10 +60,13 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(fortran_d_flags "-r8")
set(fortran_8_flags "-i8 -r8")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "-g -fbacktrace -cpp -fimplicit-none ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS "-g -fbacktrace -cpp ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -Wall -Wno-unused-dummy-argument -Wsurprising -Wextra -fcheck=all")
set(fortran_d_flags "-fdefault-real-8")
set(fortran_8_flags "-fdefault-integer-8 -fdefault-real-8")
if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "-w -fallow-argument-mismatch -fallow-invalid-boz ${CMAKE_Fortran_FLAGS}")
endif()
endif()

# This is the source code directiroy.
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Copyright 2020 National Oceanic and Atmospheric Administration (by assignment from I. M. Systems Group)
Copyright 2020 National Oceanic and Atmospheric Administration

The [NCEPLIBS-ip2] code incorporated in the Unified Forecast System (UFS) was jointly developed by the National Oceanic and Atmospheric Administration and the I. M. Systems Group. The gold standard copy of the Code will be maintained by NOAA at [https://github.com/NOAA-EMC/NCEPLIBS-ip2].
The [NCEPLIBS-ip] repository is maintained by NOAA at [https://github.com/NOAA-EMC/NCEPLIBS-ip].

The National Oceanic and Atmospheric Administration is releasing this code under the GNU Lesser General Public License v3.0 (the "License"); you may not use this code except in compliance with the License.

Expand Down
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

# Interpolation Library

The NCEP general interpolation library contains Fortran 90
subprograms to be used for interpolating between nearly all grids used
at NCEP. The library is particularly efficient when interpolating many
fields at one time.
The NCEP general interpolation library contains Fortran 90 subprograms to be
used for interpolating between nearly all grids used at NCEP. The library is
particularly efficient when interpolating many fields at one time. It also
contains routines for spectral transforms and other processing, including those
previously contained in the NCEPLIBS-sp library.

This is part of the [NCEPLIBS](https://github.com/NOAA-EMC/NCEPLIBS)
project.

There are currently six interpolation methods available in the
library:
There are currently six interpolation methods available in the library:
- bilinear
- bicubic
- neighbor
Expand All @@ -27,40 +27,42 @@ To submit bug reports, feature requests, or other code-related issues including

* NCEP/EMC Developers

Code Manager: [George Gayno](mailto:george.gayno@noaa.gov)
Code Manager: [Alex Richert](mailto:alexander.richert@noaa.gov)

### Prerequisites

This package requires the [NCEPLIBS-sp](https://github.com/NOAA-EMC/NCEPLIBS-sp) library.
This package does not link to any other libraries, but requires CMake (version
3.15+) to build.

### Installing

```
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/NCEPLIBS-ip2
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/NCEPLIBS-ip
make -j2
make test (or ctest --verbose)
make test # (or ctest --verbose)
make install
```

### Usage

To use the ip library add `use ip_mod` to your Fortran code. It contains all the necessary public interfaces.
Most routines and any public interfaces required can be accessed by adding `use
ip_mod` to your Fortran code. Most spectral transform and processing subroutines
can be accessed by calling them in your code (no `use` statement) and linking
to the ip library at build time.

## Disclaimer

The United States Department of Commerce (DOC) GitHub project code is
provided on an "as is" basis and the user assumes responsibility for
its use. DOC has relinquished control of the information and no longer
has responsibility to protect the integrity, confidentiality, or
availability of the information. Any claims against the Department of
Commerce stemming from the use of its GitHub project will be governed
by all applicable Federal law. Any reference to specific commercial
products, processes, or services by service mark, trademark,
manufacturer, or otherwise, does not constitute or imply their
endorsement, recommendation or favoring by the Department of
Commerce. The Department of Commerce seal and logo, or the seal and
logo of a DOC bureau, shall not be used in any manner to imply
endorsement of any commercial product or activity by DOC or the United
States Government.
The United States Department of Commerce (DOC) GitHub project code is provided
on an "as is" basis and the user assumes responsibility for its use. DOC has
relinquished control of the information and no longer has responsibility to
protect the integrity, confidentiality, or availability of the information. Any
claims against the Department of Commerce stemming from the use of its GitHub
project will be governed by all applicable Federal law. Any reference to
specific commercial products, processes, or services by service mark, trademark,
manufacturer, or otherwise, does not constitute or imply their endorsement,
recommendation or favoring by the Department of Commerce. The Department of
Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used
in any manner to imply endorsement of any commercial product or activity by DOC
or the United States Government.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.0
5.0.0
2 changes: 0 additions & 2 deletions cmake/PackageConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

include(CMakeFindDependencyMacro)

find_dependency(sp CONFIG)

if(@OPENMP@)
find_dependency(OpenMP COMPONENTS Fortran)
endif()
Expand Down
6 changes: 4 additions & 2 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.

LAYOUT_FILE =
LAYOUT_FILE =

# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
Expand Down Expand Up @@ -886,6 +886,8 @@ INPUT_ENCODING = UTF-8

FILE_PATTERNS = *.f90 \
*.F90 \
*.f \
*.F \
*.c \
*.h

Expand Down Expand Up @@ -1011,7 +1013,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.

USE_MDFILE_AS_MAINPAGE = @abs_top_srcdir@/docs/sp_user_guide.md
USE_MDFILE_AS_MAINPAGE = @abs_top_srcdir@/docs/user_guide.md

#---------------------------------------------------------------------------
# Configuration options related to source browsing
Expand Down
Loading

0 comments on commit cfbcd25

Please sign in to comment.