Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c6c7eef
changes to compile all unit tests via cmake and add in cmake test-lib…
Apr 17, 2025
b985446
add mpp unit test scripts
Apr 22, 2025
10d3f5d
mixed precision updates and fixes to use test-lib for both build systems
Apr 29, 2025
2c7869a
Merge branch 'main' of github.com:noaa-gfdl/fms into cmake-updates
May 1, 2025
10ac33b
update debug flags
May 1, 2025
436d708
revert changes to mosaic2 helper module
May 8, 2025
64d120a
Merge branch 'NOAA-GFDL:main' into cmake-updates
rem1776 May 15, 2025
a3ae512
remove real size flag
rem1776 May 15, 2025
c088182
fix test_fms directory/executable overlap by adding build directory t…
rem1776 May 15, 2025
a377d46
take out the lame executable test
rem1776 May 15, 2025
db7f16e
add labels and fix for mpp ascii read test
May 19, 2025
e9e04c3
Merge branch 'cmake-updates' of github.com:rem1776/FMS into cmake-upd…
May 19, 2025
1772c6b
fix for mpp ascii test, remove unused test-lib.sh.in
May 19, 2025
502d97b
unify precision macro names
May 28, 2025
810f343
fixed the DO tests
May 28, 2025
94bea35
Data override test fix
Jun 3, 2025
c68092e
Apply suggestions from code review
rem1776 Jun 4, 2025
ca15c94
Merge branch 'main' into cmake-updates
rem1776 Jun 5, 2025
1eeeddc
remove 64bit flag
rem1776 Jun 9, 2025
a209999
CPPFLAGS fix for test_axis r4 and r8
Jun 17, 2025
3bd3248
Merge remote-tracking branch 'vs/singlemacro' into cmake-updates
Jul 3, 2025
f12f78b
Merge branch 'main' into cmake-updates
rem1776 Jul 10, 2025
b957dd3
Merge branch 'main' of github.com:noaa-gfdl/fms into cmake-updates
Aug 5, 2025
d83abe7
list test src explicitly and fix any lingering precision issues
Aug 6, 2025
7e325c1
update flags to match mkmf templates and multiple test fixes
Aug 19, 2025
5d2a8d4
Merge branch 'cmake-updates' of github.com:rem1776/fms into cmake-upd…
Aug 20, 2025
8050e20
changes for autotools and add a missed new helper file for mosaic
Aug 20, 2025
cecc9e4
fix C flags for yaml builds
Aug 20, 2025
0badd96
clean up env variables in test scripts for parser build option
Aug 20, 2025
99d181b
fix conditional for field manager
Aug 20, 2025
4b63446
fixes for tridiagonal and column diagnostic tests
Aug 20, 2025
12ccd0b
add new output file location to cleanfiles for coupler tests
Aug 20, 2025
a12970d
missed some output files
Aug 21, 2025
06d81cc
revert change to default off for quad precision to line up with autot…
Aug 21, 2025
8a69d09
simplify build type options and compiler flags
Aug 21, 2025
b034f50
missed the fortran max line length flag for GNU
Aug 21, 2025
b904727
linter
Aug 21, 2025
842ddc5
Merge remote-tracking branch 'upstream/main' into cmake-updates
Aug 21, 2025
f7e21b2
rename skip variable used in added diag manager test
Aug 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions .github/workflows/github_cmake_gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,14 @@ jobs:
container:
image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0
env:
CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }} -D64BIT=on"
CMAKE_FLAGS: "${{ matrix.build-type }} ${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }}"
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Generate makefiles with CMake
run: cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view
- name: Build the library
run: make
- name: Link with basic executable
run: |
echo "program test" > test.F90
echo " use fms_mod" >> test.F90
echo " call fms_init" >> test.F90
echo " call fms_end" >> test.F90
echo "end program" >> test.F90
mpifort -L/opt/view/lib -fopenmp `nf-config --flibs` -Iinclude_r4 -Iinclude_r8 test.F90 libfms_r4.a libfms_r8.a -o test.x
touch input.nml
- name: Run executable
run: ./test.x
mkdir build
cd build
cmake $CMAKE_FLAGS -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view ..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using spack containers, nice!

- name: Build the library
run: make -C build
295 changes: 282 additions & 13 deletions CMakeLists.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmake/compiler_flags_Clang_C.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Clang C
set( CMAKE_C_FLAGS_RELEASE "-O3" )

set( CMAKE_C_FLAGS_DEBUG "-O0 -g" )
set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g" )

set( CMAKE_C_LINK_FLAGS "" )
2 changes: 1 addition & 1 deletion cmake/compiler_flags_GNU_C.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GNU C
set(CMAKE_C_FLAGS_RELEASE "-O3")

set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_DEBUGUFS "-O0 -g")

set(CMAKE_C_LINK_FLAGS "")
4 changes: 2 additions & 2 deletions cmake/compiler_flags_GNU_Fortran.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Precision-based Fortran compiler flags
set(r8_flags "-fdefault-real-8 -fdefault-double-8") # Fortran flags for 64BIT precision

# GNU Fortan
# GNU Fortran
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fconvert=big-endian -ffree-line-length-none -fno-range-check -fbacktrace")

set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-all-loops -finline-functions")

set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" )
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" )

set(CMAKE_Fortran_LINK_FLAGS "" )
2 changes: 1 addition & 1 deletion cmake/compiler_flags_IntelLLVM_C.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -traceback")

set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal")

set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapuv")
set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapv")

set( CMAKE_C_LINK_FLAGS "")
2 changes: 1 addition & 1 deletion cmake/compiler_flags_IntelLLVM_Fortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray

set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -nowarn -qoverride-limits -qno-opt-dynamic-align")

set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")

set(CMAKE_Fortran_LINK_FLAGS "")
2 changes: 1 addition & 1 deletion cmake/compiler_flags_Intel_C.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -sox -traceback")

set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal -fp-model source")

set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapuv")
set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapuv")

set( CMAKE_C_LINK_FLAGS "")
2 changes: 1 addition & 1 deletion cmake/compiler_flags_Intel_Fortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray

set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -fp-model source -nowarn -qoverride-limits -qno-opt-dynamic-align -qopt-prefetch=3")

set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")

set(CMAKE_Fortran_LINK_FLAGS "")
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ AC_SUBST([NOUNDEFINED])
# Used in Makefiles.
AC_SUBST([MODDIR],[\$\(top_builddir\)/.mods])

# Define CMake variables used in test-lib.sh.in as empty strings
AC_SUBST([CMAKE_CURRENT_SOURCE_DIR], [])
AC_SUBST([USING_CMAKE],[])

# These files will be created when the configure script is run.
AC_CONFIG_FILES([
Makefile
Expand Down
1 change: 1 addition & 0 deletions test_fms/horiz_interp/test_create_xgrid_order2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ program test_create_xgrid_order2

use horiz_interp_mod
use constants_mod, only: DEG_TO_RAD
use platform_mod
implicit none

integer, parameter :: lkind = HI_TEST_KIND_
Expand Down
2 changes: 1 addition & 1 deletion test_fms/mosaic2/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# uramirez, Ed Hartnett

# Find the needed mod and include files.
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(MODDIR) -I./INPUT -I$(top_srcdir)/mosaic -I./
AM_CPPFLAGS = -I$(abs_top_srcdir)/test_fms/mosaic2 -I$(top_srcdir)/include -I$(MODDIR)

# Link to the FMS library.
LDADD = $(top_builddir)/libFMS/libFMS.la
Expand Down
4 changes: 2 additions & 2 deletions test_fms/mosaic2/test_grid2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
!! with C1 tiles where tiles 1-6 are identical. The tile points are made up with
!! values that result in simple answers. See write_files module for grid details.

#include "write_files.inc" !> including write_files.mod because I don't know how to compile when write_files.mod is
!! in a separate file.
#include "write_files.inc"

program test_mosaic

use mpp_mod, only : mpp_init, mpp_error, FATAL, mpp_npes, mpp_pe, mpp_root_pe
Expand Down
4 changes: 2 additions & 2 deletions test_fms/mosaic2/test_mosaic2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
!! get_mosaic_grid_sizes, get_mosaic_contact. The subroutines are tested with
!! made up C1 grids and exchange grids. See write_files mod for grid details.

#include "write_files.inc" !> including write_files.mod because I don't know how to compile when write_files.mod is
!! in a separate file.
#include "write_files.inc"

program test_mosaic

use mosaic2_mod
Expand Down
8 changes: 4 additions & 4 deletions test_fms/mpp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ check_PROGRAMS = test_mpp \
test_mpp_print_memuse_stats_file \
test_mpp_memutils_begin_2x \
test_mpp_memutils_end_before_begin \
test_read_ascii_file \
test_mpp_read_ascii_file \
test_read_input_nml \
test_stdout \
test_stderr \
Expand Down Expand Up @@ -87,7 +87,7 @@ test_mpp_print_memuse_stats_stderr_SOURCES = test_mpp_print_memuse_stats_stderr.
test_mpp_print_memuse_stats_file_SOURCES = test_mpp_print_memuse_stats_file.F90
test_mpp_memutils_begin_2x_SOURCES = test_mpp_memutils_begin_2x.F90
test_mpp_memutils_end_before_begin_SOURCES = test_mpp_memutils_end_before_begin.F90
test_read_ascii_file_SOURCES = test_read_ascii_file.F90
test_mpp_read_ascii_file_SOURCES = test_mpp_read_ascii_file.F90
test_read_input_nml_SOURCES = test_read_input_nml.F90
test_stdout_SOURCES = test_stdout.F90
test_stderr_SOURCES = test_stderr.F90
Expand Down Expand Up @@ -150,7 +150,7 @@ TESTS = test_mpp_domains2.sh \
test_mpp_memuse.sh \
test_mpp_mem_dump.sh \
test_mpp_memutils_mod.sh \
test_read_ascii_file.sh \
test_mpp_read_ascii_file.sh \
test_read_input_nml2.sh \
test_stdout.sh \
test_stderr.sh \
Expand Down Expand Up @@ -193,7 +193,7 @@ EXTRA_DIST = test_mpp_domains2.sh \
test_mpp_memuse.sh \
test_mpp_mem_dump.sh \
test_mpp_memutils_mod.sh \
test_read_ascii_file.sh \
test_mpp_read_ascii_file.sh \
test_read_input_nml2.sh \
test_stdout.sh \
test_stderr.sh \
Expand Down
2 changes: 0 additions & 2 deletions test_fms/mpp/test_mpp_init_logfile.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
!/bin/sh

#***********************************************************************
# GNU Lesser General Public License
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
!! @author Colin Gladue
!! @email gfdl.climate.model.info@noaa.gov

program test_read_ascii_file
program test_mpp_read_ascii_file

use mpp_mod, only : mpp_init, mpp_init_test_peset_allocated
use mpp_mod, only : mpp_error, FATAL, NOTE
Expand Down Expand Up @@ -111,4 +111,4 @@ program test_read_ascii_file
end if
end if
call MPI_FINALIZE(ierr)
end program test_read_ascii_file
end program test_mpp_read_ascii_file
Original file line number Diff line number Diff line change
Expand Up @@ -47,57 +47,57 @@ echo "/" >> test_numb_base_ascii.nml
# Normal Usage
sed "s/test_numb = [0-9]/test_numb = 1/" test_numb_base_ascii.nml>test_numb_ascii.nml
test_expect_success "normal ascii usage" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'

# Test 2
# get_ascii_file_num_lines not called before, fatal error
sed "s/test_numb = [0-9]/test_numb = 2/" test_numb_base_ascii.nml>test_numb_ascii.nml
test_expect_failure "failure caught if get_ascii_file_num_lines not called before" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'

# Test 3
# File does not exist, fatal error
sed "s/test_numb = [0-9]/test_numb = 3/" test_numb_base_ascii.nml>test_numb_ascii.nml
test_expect_failure "failure caught if file does not exist" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'

# Test 4
# Number of line in file is greater than size(Content(:)), fatal error
sed "s/test_numb = [0-9]/test_numb = 4/" test_numb_base_ascii.nml>test_numb_ascii.nml
echo "" > empty.nml
test_expect_failure "failure caught from too few input lines" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'
# Test 5
# Length of output string is too small, fatal error
sed "s/test_numb = [0-9]/test_numb = 5/" test_numb_base_ascii.nml>test_numb_ascii.nml
test_expect_failure "failure caught from too small output string" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'

# Test 6
# Number of lines in file does not equal to size(Content(:)), fatal error
sed "s/test_numb = [0-9]/test_numb = 6/" test_numb_base_ascii.nml>test_numb_ascii.nml
test_expect_failure "failure caught from mismatching numbers of lines" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'

# Test 7
# Normal usage, with optional PELIST argument passed in
sed "s/test_numb = [0-9]/test_numb = 7/" test_numb_base_ascii.nml>test_numb_ascii.nml
test_expect_success "normal ascii usage with PELIST" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'

# Test 8
# Normal usage, with an empty file passed in
sed "s/test_numb = [0-9]/test_numb = 8/" test_numb_base_ascii.nml>test_numb_ascii.nml
touch empty.nml
test_expect_success "normal ascii usage with empty file" '
mpirun -n 1 ../test_read_ascii_file
mpirun -n 1 ../test_mpp_read_ascii_file
'

test_done
12 changes: 10 additions & 2 deletions test_fms/test-lib.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
# Thank you Junio.

# Useful locations
top_srcdir='@abs_top_srcdir@'
top_buildir='@abs_top_builddir@'
top_srcdir='@abs_top_srcdir@@CMAKE_CURRENT_SOURCE_DIR@'
top_buildir='@abs_top_builddir@@CMAKE_CURRENT_SOURCE_DIR@'

TEST_NAME="$(basename "$0" .sh)"
TEST_NUMBER="${TEST_NAME%%-*}"
Expand Down Expand Up @@ -319,6 +319,14 @@ test_expect_success () {

test_done () {
EXIT_OK=t
cmake="@USING_CMAKE@"
if test $cmake
then
if test $test_failure != 0
then
exit 1
fi
fi
say "1..$test_count"
}
# creates and enters output dir and deletes previous if present
Expand Down
1 change: 1 addition & 0 deletions test_fms/time_interp/test_time_interp_external.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ program test_time_interp_external
use axis_utils2_mod, only : axis_edges
use fms2_io_mod, only : FmsNetcdfFile_t, fms2_io_init, open_file, close_file, write_data, register_axis
use fms2_io_mod, only : register_field, unlimited, register_variable_attribute
use platform_mod

implicit none

Expand Down
Loading