Skip to content

Commit

Permalink
Merge branch 'develop' into as_parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA authored Nov 20, 2024
2 parents 39d8b39 + 345da2a commit e1df40d
Show file tree
Hide file tree
Showing 37 changed files with 11,387 additions and 10,615 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/Intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This is the Intel workflow for the wgrib2 project. This
# tests with Intel Classic and oneAPI.
#
# Alex Richert, 22 Oct 2024
name: Intel
on:
push:
branches:
- develop
pull_request:
branches:
- develop

# Cancel in-progress workflows when pushing to a branch
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Linux_options:
runs-on: ubuntu-latest

strategy:
matrix:
compilers: ["oneapi", "classic"]

steps:

- name: install
run: |
sudo apt-get update
sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config \
libpng-dev autotools-dev autoconf libaec-dev libopenblas-serial-dev \
libopenjp2-7 libopenjp2-7-dev
- name: "Install Intel"
uses: NOAA-EMC/ci-install-intel-toolkit@develop
with:
compiler-setup: ${{ matrix.compilers }}

- name: cache-jasper
id: cache-jasper
uses: actions/cache@v4
with:
path: ~/jasper
key: jasper-${{ runner.os }}-${{ matrix.compilers }}-1.900.1

- name: checkout-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: jasper-software/jasper
path: jasper
ref: version-1.900.1

- name: build-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
run: |
cd jasper
CFLAGS="-Wno-implicit-function-declaration -Wno-incompatible-pointer-types" ./configure --prefix=$HOME/jasper
make
make install
- name: cache-ip
id: cache-ip
uses: actions/cache@v4
with:
path: ~/ip
key: ip-${{ runner.os }}-${{ matrix.compilers }}-develop

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

- name: build-ip
if: steps.cache-ip.outputs.cache-hit != 'true'
run: |
cd ip
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~/sp
make -j2
make install
- name: checkout
uses: actions/checkout@v4
with:
path: wgrib2

- name: build
run: |
cd wgrib2
mkdir b
cd b
cmake -DCMAKE_PREFIX_PATH="~/ip" .. -DUSE_OPENMP=OFF
make VERBOSE=1
ctest --verbose --output-on-failure --rerun-failed
57 changes: 9 additions & 48 deletions .github/workflows/Linux_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,53 +57,12 @@ jobs:
echo "CC=gcc-${{ matrix.gcc-version }}" >> $GITHUB_ENV
echo "FC=gfortran-${{ matrix.gcc-version }}" >> $GITHUB_ENV
- name: cache-jasper
id: cache-jasper
uses: actions/cache@v3
- name: "Build dependencies"
uses: NOAA-EMC/ci-build-nceplibs@develop
with:
path: ~/jasper
key: jasper-${{ runner.os }}-gcc${{ matrix.gcc-version }}-1.900.1

- name: checkout-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: jasper-software/jasper
path: jasper
ref: version-1.900.1

- name: build-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
run: |
cd jasper
CFLAGS="-Wno-implicit-function-declaration -Wno-incompatible-pointer-types" ./configure --prefix=$HOME/jasper
make
make install
- name: cache-ip
id: cache-ip
uses: actions/cache@v3
with:
path: ~/ip
key: ip-${{ runner.os }}-gcc${{ matrix.gcc-version }}-develop-2

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

- name: build-ip
if: steps.cache-ip.outputs.cache-hit != 'true'
run: |
cd ip
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~/sp
make -j
make install
ip-version: develop
g2c-version: develop
g2c-cmake-args: -DUSE_OpenJPEG=ON -DUSE_Jasper=OFF

- name: checkout
uses: actions/checkout@v2
Expand All @@ -115,6 +74,8 @@ jobs:
cd wgrib2
mkdir b
cd b
cmake ${{ matrix.config.options }} -DCMAKE_PREFIX_PATH="~/ip" ..
make -j VERBOSE=1
export CFLAGS='-I/home/runner/work/wgrib2/wgrib2/nceplibs/NCEPLIBS-g2c/include'
cmake ${{ matrix.config.options }} -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/nceplibs/NCEPLIBS-ip;$GITHUB_WORKSPACE/nceplibs/NCEPLIBS-g2c" ..
make VERBOSE=1
ctest --verbose --output-on-failure --rerun-failed
64 changes: 8 additions & 56 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
env:
FC: gfortran
CC: gcc
LD_LIBRARY_PATH: "/home/runner/jasper/lib/"
LD_LIBRARY_PATH: "/home/runner/work/wgrib2/wgrib2/nceplibs/jasper/lib/"

permissions:
id-token: write
Expand All @@ -35,60 +35,12 @@ jobs:
sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config libopenblas-dev
sudo apt-get install libpng-dev autotools-dev libaec-dev autoconf gcovr doxygen
- name: cache-jasper
id: cache-jasper
uses: actions/cache@v4
with:
path: ~/jasper
key: jasper-${{ runner.os }}-4.0.0

- name: checkout-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: jasper-software/jasper
path: jasper
ref: version-4.0.0

- name: build-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
run: |
cd jasper
cmake -B build_dir -DCMAKE_INSTALL_PREFIX=~/jasper
cmake --build build_dir
cmake --install build_dir
- name: checkout-ip
uses: actions/checkout@v4
- name: "Build dependencies"
uses: NOAA-EMC/ci-build-nceplibs@develop
with:
repository: NOAA-EMC/NCEPLIBS-ip
path: ip
ref: develop

- name: build-ip
run: |
cd ip
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~
make -j2
make install
- name: checkout-g2c
uses: actions/checkout@v4
with:
repository: NOAA-EMC/NCEPLIBS-g2c
path: g2c
ref: develop

- name: build-g2c
run: |
cd g2c
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/g2c -DCMAKE_PREFIX_PATH="~/jasper"
make -j2
make install
jasper-version: version-4.0.0
ip-version: develop
g2c-version: develop

- name: checkout
uses: actions/checkout@v4
Expand All @@ -107,10 +59,10 @@ jobs:
cd wgrib2
mkdir build
cd build
export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -I/home/runner/g2c/include'
export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -I/home/runner/work/wgrib2/wgrib2/nceplibs/NCEPLIBS-g2c/include'
export FCFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
export FFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/jasper;~/g2c" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON
cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/nceplibs/NCEPLIBS-ip;$GITHUB_WORKSPACE/nceplibs/jasper;$GITHUB_WORKSPACE/nceplibs/NCEPLIBS-g2c" -DTEST_FILE_DIR=/home/runner/data -DMAKE_FTN_API=ON -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON
make VERBOSE=1
ctest --verbose --output-on-failure --rerun-failed
gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null
Expand Down
32 changes: 19 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ project(wgrib2 VERSION ${pVersion} LANGUAGES C)

# Handle user build options.
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)
option(USE_NETCDF "Use NetCDF" on)
option(USE_NETCDF "Use NetCDF" off)
option(USE_REGEX "Use Regex?" on)
option(USE_TIGGE "Use tigge?" on)
option(USE_MYSQL "Use MySQL?" off)
option(USE_IPOLATES "Use Ipolates" off)
option(USE_UDF "Use UDF?" off)
option(USE_OPENMP "Use OpenMP?" on)
option(USE_OPENMP "Use OpenMP?" off)
option(USE_PROJ4 "Use Proj4?" off)
option(USE_WMO_VALIDATION "Use WMO Validation?" off)
option(DISABLE_TIMEZONE "Disable posix Timezone?" off)
Expand All @@ -35,8 +35,13 @@ option(FTP_EXTRA_TEST_FILES "Fetch even more large files from FTP and test them.
option(MAKE_FTN_API "add ftn api?" off)
option(DISABLE_STAT "disable posix feature" off)
set(BUILD_COMMENTS "stock build")

option(BUILD_LIB "Build wgrib2 library?" on)
option(BUILD_SHARED_LIB "Build shared library?" off)
# if BUILD_LIB, then code is compiled as relocatable
option(BUILD_SHARED_LIB "Build shared library?" on)
# To create libwgrib2.so for python, you have to build with BUILD_SHARED_LIB off
# and manually create libwgrib2.so from the needed *.a files

option(BUILD_WGRIB "Build wgrib code?" off)

if (MAKE_FTN_API OR USE_IPOLATES)
Expand All @@ -61,15 +66,18 @@ endif()
include(GNUInstallDirs)

message(STATUS "Setting compiler flags...")
if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$")
if(CMAKE_C_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_C_FLAGS "-g -traceback ${CMAKE_C_FLAGS} -DIFORT")
if(CMAKE_C_COMPILER_ID MATCHES "^(IntelLLVM)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Rno-debug-disables-optimization")
endif()
set(CMAKE_C_FLAGS_DEBUG "-O0")
elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS} -DGFORTRAN")
set(CMAKE_C_FLAGS_DEBUG "-O0")
endif()

if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -traceback ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
Expand All @@ -84,6 +92,10 @@ if(USE_G2CLIB)
endif()
endif()

if (BUILD_SHARED_LIB AND NOT BUILD_LIB)
message(FATAL_ERROR "BUILD_SHARED_LIB is on but BUILD_LIB is off")
endif()

# If user wants to use NCEPLIBS-ip, find it and the sp library.
message(STATUS "Checking if the user want to use NCEPLIBS-ip...")
if(USE_IPOLATES)
Expand All @@ -109,18 +121,12 @@ endif()
# Find required packages to use OpenJPEG
message(STATUS "Checking if the user wants to use OpenJPEG...")
if(USE_OPENJPEG)
find_package(OpenJPEG REQUIRED)
find_package(g2c 1.9.0 CONFIG REQUIRED)
endif()

message(STATUS "Checking if the user want to use OpenMP...")
if(USE_OPENMP)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(MyTarget PUBLIC OpenMP::OpenMP_CXX)
endif()
# if(OpenMP_Fortran_FOUND)
# target_link_libraries(MyTarget PUBLIC OpenMP::OpenMP_Fortran)
# endif()
find_package(OpenMP REQUIRED COMPONENTS C)
endif()

message(STATUS "Checking if the user wants to use PNG...")
Expand Down
4 changes: 1 addition & 3 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Wgrib2 is maintained as a collaboration between [Climate Prediction
Center (CPC)](https://www.cpc.ncep.noaa.gov/) and the [Environmental
Modeling Center (EMC)](https://www.emc.ncep.noaa.gov/emc.php).

## Documentation for Previous Versions of wgrib2

* [wgrib2 Version 3.4.0](ver-3.4.0/index.html)
[Documentation Index](web_docs/index.html)


4 changes: 2 additions & 2 deletions spack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ def url_for_version(self, version):
depends_on("g2c", when="@develop +jasper")
depends_on("zlib-api", when="@3.2: +png")
depends_on("libpng", when="@3.2: +png")
depends_on("openjpeg", when="@3.2: +openjpeg")

depends_on("openjpeg", when="@3.2:3.4 +openjpeg")
depends_on("g2c +openjpeg", when="@develop +openjpeg")

@when("@:2 ^[email protected]:")

Expand Down
Loading

0 comments on commit e1df40d

Please sign in to comment.