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 Oct 15, 2024
2 parents c24810f + f03f544 commit 39d8b39
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 291 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
env:
FC: gfortran
CC: gcc
LD_LIBRARY_PATH: "/home/runner/jasper/lib/"

permissions:
id-token: write
Expand All @@ -31,31 +32,31 @@ jobs:
- name: install
run: |
sudo apt-get update
sudo apt-get install libnetcdf-dev libnetcdff-dev netcdf-bin pkg-config
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 }}-1.900.1
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-1.900.1
ref: version-4.0.0

- name: build-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
run: |
cd jasper
./configure --prefix=$HOME/jasper
make
make install
cmake -B build_dir -DCMAKE_INSTALL_PREFIX=~/jasper
cmake --build build_dir
cmake --install build_dir
- name: checkout-ip
uses: actions/checkout@v4
Expand All @@ -71,7 +72,23 @@ jobs:
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/ip -DCMAKE_PREFIX_PATH=~
make -j2
make install
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
- name: checkout
uses: actions/checkout@v4
Expand All @@ -90,10 +107,10 @@ jobs:
cd wgrib2
mkdir build
cd build
export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
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" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON
export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -I/home/runner/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
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 All @@ -115,4 +132,4 @@ jobs:
- name: Upload built documentation
uses: actions/upload-pages-artifact@v1
with:
path: wgrib2/build/docs/html # Path to the built site files
path: wgrib2/build/docs/html # Path to the built site files
18 changes: 7 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.15)
file(STRINGS "VERSION" pVersion)

# Set up project with version number from VERSION file.
project(wgrib2 VERSION ${pVersion} LANGUAGES Fortran C)
project(wgrib2 VERSION ${pVersion} LANGUAGES C)

# Handle user build options.
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)
Expand Down Expand Up @@ -39,6 +39,10 @@ option(BUILD_LIB "Build wgrib2 library?" on)
option(BUILD_SHARED_LIB "Build shared library?" off)
option(BUILD_WGRIB "Build wgrib code?" off)

if (MAKE_FTN_API OR USE_IPOLATES)
enable_language(Fortran)
endif()

# Developers can use this option to specify a local directory which
# holds the test files. They will be copied instead of fetching the
# files via FTP.
Expand Down Expand Up @@ -78,10 +82,6 @@ if(USE_G2CLIB)
if(USE_PNG)
message(FATAL_ERROR "If USE_G2CLIB is on, USE_PNG must be off")
endif()

if(USE_JASPER)
message(FATAL_ERROR "If USE_G2CLIB is on, USE_JASPER must be off")
endif()
endif()

# If user wants to use NCEPLIBS-ip, find it and the sp library.
Expand All @@ -103,17 +103,13 @@ endif()

message(STATUS "Checking if the user wants to use Jasper...")
if(USE_JASPER)
list(APPEND definitions_list -DUSE_JASPER)
find_package(Jasper REQUIRED)
if(JASPER_VERSION_STRING VERSION_GREATER_EQUAL "1.900.25")
list(APPEND definitions_list -DJAS_VERSION_MAJOR=2)
endif()
find_package(g2c 1.9.0 CONFIG REQUIRED)
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(OpenJPEG REQUIRED)
endif()

message(STATUS "Checking if the user want to use OpenMP...")
Expand Down
5 changes: 4 additions & 1 deletion spack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,15 @@ def url_for_version(self, version):
conflicts("+openmp", when="%apple-clang")

depends_on("[email protected]:", when="@develop +ipolates")
depends_on("lapack", when="@develop +ipolates")
depends_on("[email protected]:", when="@3.2: +aec")
depends_on("netcdf-c", when="@3.2: +netcdf4")
depends_on("jasper@:2", when="@3.2: +jasper")
depends_on("jasper@:2", when="@3.2:3.4 +jasper")
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")


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

Expand Down
10 changes: 5 additions & 5 deletions tests/run_jpeg_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ echo ""
echo "*** Running wgrib2 jpeg tests"

echo "*** Converting from jpeg to simple packing"
../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -set_grib_type simple -grib_out jpeg2simple.grb
../wgrib2/wgrib2 jpeg2simple.grb -v2 -s > jpeg2simple.txt
touch jpeg2simple.txt
diff -w jpeg2simple.txt data/ref_jpeg2simple.txt
../wgrib2/wgrib2 data/gdaswave.t00z.wcoast.0p16.f000.grib2 -set_grib_type simple -grib_out junk_jpeg2simple.grb
../wgrib2/wgrib2 junk_jpeg2simple.grb -v2 -s > junk_jpeg2simple.txt
touch junk_jpeg2simple.txt
diff -w junk_jpeg2simple.txt data/ref_jpeg2simple.txt

echo "*** SUCCESS!"
exit 0
exit 0
16 changes: 6 additions & 10 deletions wgrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Check_pdt_size.c Checksum.c Cluster.c cname.c codetable_4_230.c
CodeTable.c Code_Values.c Code_Values_JMA.c complex_pk.c Config.c
copy.c crc32.c Cress_lola.c Csv.c Csv_long.c cubed_sphere2ll.c
CubeFace2global.c Cyclic.c Data.c decenc_openjpeg.c dec_png_clone.c
Dump.c Earth.c Else.c enc_jpeg2000_clone.c End.c Endif.c Ensemble.c
Dump.c Earth.c Else.c End.c Endif.c Ensemble.c
Ens_processing.c Ens_qc.c EOF.c Export_lonlat.c ExtName.c
fatal_error.c Fcst_ave.c ffopen.c Fi.c File.c Fix_CFSv2_fcst.c
Fix_ncep_2.c Fix_ncep_3.c Fix_ncep_4.c Fix_ncep.c Fix_undef.c
Expand Down Expand Up @@ -88,12 +88,6 @@ if(USE_NETCDF)
target_link_libraries(obj_lib PUBLIC NetCDF::NetCDF_C)
endif()

if(USE_JASPER)
include_directories(${JASPER_INCLUDE_DIR})
target_include_directories(obj_lib PUBLIC ${JASPER_INCLUDE_DIR})
target_link_libraries(obj_lib PUBLIC ${JASPER_LIBRARIES})
endif()

if(USE_PNG)
target_link_libraries(obj_lib PUBLIC PNG::PNG)
endif()
Expand All @@ -102,9 +96,6 @@ if(OpenMP_C_FOUND)
target_link_libraries(obj_lib PUBLIC OpenMP::OpenMP_C)
endif()

if(USE_G2CLIB)
endif()

if(USE_IPOLATES)
target_link_libraries(obj_lib PUBLIC ip::ip_d)

Expand All @@ -128,6 +119,11 @@ if(USE_AEC)
target_link_libraries(wgrib2_exe PRIVATE aec)
endif()

if(USE_JASPER)
target_link_libraries(obj_lib PUBLIC g2c::g2c)
target_link_libraries(wgrib2_exe PRIVATE g2c::g2c)
endif()

if(USE_OPENJPEG)
include_directories(${OPENJPEG_INCLUDE_DIRS})
target_link_libraries(wgrib2_exe PRIVATE ${OPENJPEG_LIBRARIES})
Expand Down
8 changes: 1 addition & 7 deletions wgrib2/Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#include <ctype.h>
#include <limits.h>
#include "wgrib2.h"
#ifdef USE_JASPER
#include <jasper/jasper.h>
#endif
#include "grb2.h"
#include "fnlist.h"

Expand Down Expand Up @@ -50,11 +47,8 @@ int f_config(ARG0) {
strcat(inv_out, USE_AEC " is installed\n" );
#endif
#ifdef USE_JASPER
strcat(inv_out, "Jasper ");
strcat(inv_out, jas_getversion());
strcat(inv_out, " is installed\n");
strcat(inv_out,USE_JASPER " is installed\n");
inv_out += strlen(inv_out);
// sprintf(inv_out,"JAS_VERSION_MAJOR=%d\n", JAS_VERSION_MAJOR);
#endif
#ifdef USE_OPENJPEG
strcat(inv_out,USE_OPENJPEG " is installed\n");
Expand Down
Loading

0 comments on commit 39d8b39

Please sign in to comment.