Skip to content

Commit

Permalink
Merge pull request #60 from NOAA-GFDL/dev/gfdl
Browse files Browse the repository at this point in the history
Sync with MOM6 dev/gfdl
  • Loading branch information
wrongkindofdoctor authored Jul 7, 2020
2 parents cea55fe + 5aae165 commit ff34126
Show file tree
Hide file tree
Showing 100 changed files with 1,444 additions and 4,701 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ gnu:ocean-only-nolibs:
- time tar zxf $CACHE_DIR/tests_$CI_PIPELINE_ID.tgz && cd tests
- make -f MRS/Makefile.build build/gnu/env && cd build/gnu
# mkdir -p build/gnu/repro/symmetric_dynamic/ocean_only && cd build/gnu/repro/symmetric_dynamic/ocean_only
- ../../MOM6-examples/src/mkmf/bin/list_paths -l ../../../config_src/{solo_driver,dynamic_symmetric} ../../../src ../../MOM6-examples/src/FMS
- ../../MOM6-examples/src/mkmf/bin/list_paths -l ../../../config_src/{solo_driver,dynamic_symmetric,ext*} ../../../src ../../MOM6-examples/src/FMS
- sed -i '/FMS\/.*\/test_/d' path_names
- ../../MOM6-examples/src/mkmf/bin/mkmf -t ../../MOM6-examples/src/mkmf/templates/ncrc-gnu.mk -p MOM6 -c"-Duse_libMPI -Duse_netCDF" path_names
- time (source ./env ; make NETCDF=3 REPRO=1 MOM6 -s -j)
Expand All @@ -73,7 +73,7 @@ gnu:ice-ocean-nolibs:
- time tar zxf $CACHE_DIR/tests_$CI_PIPELINE_ID.tgz && cd tests
- make -f MRS/Makefile.build build/gnu/env && cd build/gnu
# mkdir -p build/gnu/repro/symmetric_dynamic/ocean_only && cd build/gnu/repro/symmetric_dynamic/ocean_only
- ../../MOM6-examples/src/mkmf/bin/list_paths -l ../../../config_src/{coupled_driver,dynamic} ../../../src ../../MOM6-examples/src/{FMS,coupler,SIS2,icebergs,ice_param,land_null,atmos_null}
- ../../MOM6-examples/src/mkmf/bin/list_paths -l ../../../config_src/{coupled_driver,dynamic,ext*} ../../../src ../../MOM6-examples/src/{FMS,coupler,SIS2,icebergs,ice_param,land_null,atmos_null}
- sed -i '/FMS\/.*\/test_/d' path_names
- ../../MOM6-examples/src/mkmf/bin/mkmf -t ../../MOM6-examples/src/mkmf/templates/ncrc-gnu.mk -p MOM6 -c"-Duse_libMPI -Duse_netCDF -D_USE_LEGACY_LAND_ -Duse_AM3_physics" path_names
- time (source ./env ; make NETCDF=3 REPRO=1 MOM6 -s -j)
Expand Down Expand Up @@ -116,7 +116,7 @@ run:
- time tar zxf $CACHE_DIR/build-intel-repro-$CI_PIPELINE_ID.tgz
- time tar zxf $CACHE_DIR/build-pgi-repro-$CI_PIPELINE_ID.tgz
# time tar zxf $CACHE_DIR/build-gnu-debug-$CI_PIPELINE_ID.tgz
- (echo '#!/bin/tcsh';echo 'make -f MRS/Makefile.tests all -B') > job.sh
- (echo '#!/bin/tcsh';echo 'make -f MRS/Makefile.tests all') > job.sh
- sbatch --clusters=c3,c4 --nodes=29 --time=0:34:00 --account=gfdl_o --qos=debug --job-name=mom6_regressions --output=log.$CI_PIPELINE_ID --wait job.sh
- cat log.$CI_PIPELINE_ID
- test -f restart_results_gnu.tar.gz
Expand Down
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@
[submodule "pkg/GSW-Fortran"]
path = pkg/GSW-Fortran
url = https://github.com/TEOS-10/GSW-Fortran.git
[submodule "pkg/MOM6_DA_hooks"]
path = pkg/MOM6_DA_hooks
url = https://github.com/MJHarrison-GFDL/MOM6_DA_hooks.git
[submodule "pkg/geoKdTree"]
path = pkg/geoKdTree
url = https://github.com/travissluka/geoKdTree.git
54 changes: 22 additions & 32 deletions .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MKMF := $(abspath $(DEPS)/mkmf/bin/mkmf)

# FMS framework
FMS_URL ?= https://github.com/NOAA-GFDL/FMS.git
FMS_COMMIT ?= 2019.01.01
FMS_COMMIT ?= 2019.01.02
FMS := $(DEPS)/fms

#---
Expand Down Expand Up @@ -85,9 +85,11 @@ endif
SOURCE = \
$(foreach ext,F90 inc c h,$(wildcard $(1)/*/*.$(ext) $(1)/*/*/*.$(ext)))

MOM_SOURCE = $(call SOURCE,../src) $(wildcard ../config_src/solo_driver/*.F90)
MOM_SOURCE = $(call SOURCE,../src) $(wildcard ../config_src/solo_driver/*.F90) \
$(wildcard ../config_src/ext*/*/*.F90)
TARGET_SOURCE = $(call SOURCE,build/target_codebase/src) \
$(wildcard build/target_codebase/config_src/solo_driver/*.F90)
$(wildcard build/target_codebase/config_src/solo_driver/*.F90) \
$(wildcard build/target_codebase/config_src/ext*/*.F90)
FMS_SOURCE = $(call SOURCE,$(DEPS)/fms/src)

#---
Expand All @@ -114,7 +116,7 @@ build/asymmetric/path_names: GRID_SRC=config_src/dynamic
build/%/path_names: GRID_SRC=config_src/dynamic_symmetric

build/%/MOM6: build/%/Makefile $(FMS)/lib/libfms.a
make -C $(@D) $(MOMFLAGS) $(@F)
$(MAKE) -C $(@D) $(MOMFLAGS) $(@F)

build/%/Makefile: build/%/path_names
cp $(MKMF_TEMPLATE) $(@D)
Expand All @@ -133,13 +135,15 @@ build/target/path_names: $(LIST_PATHS) $(TARGET_CODEBASE) $(TARGET_SOURCE)
cd $(@D) && $(LIST_PATHS) -l \
../../$(TARGET_CODEBASE)/src \
../../$(TARGET_CODEBASE)/config_src/solo_driver \
../../$(TARGET_CODEBASE)/config_src/ext* \
../../$(TARGET_CODEBASE)/$(GRID_SRC)

build/%/path_names: $(LIST_PATHS) $(MOM_SOURCE)
mkdir -p $(@D)
cd $(@D) && $(LIST_PATHS) -l \
../../../src \
../../../config_src/solo_driver \
../../../config_src/ext* \
../../../$(GRID_SRC)

# Target repository for regression tests
Expand All @@ -153,7 +157,7 @@ $(TARGET_CODEBASE):

$(FMS)/lib/libfms.a: $(FMS)/build/Makefile
mkdir -p $(FMS)/lib
cd $(FMS)/build && make NETCDF=3 DEBUG=1 ../lib/libfms.a
cd $(FMS)/build && $(MAKE) NETCDF=3 DEBUG=1 ../lib/libfms.a

$(FMS)/build/Makefile: $(FMS)/build/path_names
cp $(MKMF_TEMPLATE) $(@D)
Expand Down Expand Up @@ -250,8 +254,6 @@ $(eval $(call CMP_RULE,regression,symmetric target))
# Restart tests only compare the final stat record
.PRECIOUS: $(foreach b,symmetric restart target,work/%/$(b)/ocean.stats)
%.restart: $(foreach b,symmetric restart,work/%/$(b)/ocean.stats)
#cmp $(foreach f,$^,<(tr -s ' ' < $(f) | cut -d ' ' -f3- | tail -n 1)) \
# || diff $^
@cmp $(foreach f,$^,<(tr -s ' ' < $(f) | cut -d ' ' -f3- | tail -n 1)) \
|| !( \
mkdir -p results/$*; \
Expand All @@ -266,18 +268,6 @@ $(eval $(call CMP_RULE,regression,symmetric target))
#---
# Test run output files

# Generalized MPI environment variable support
# XXX: Using `-env` in the MPICH test can erroneously producing an `nv` file.
# $(1): Environment variables
ifeq ($(shell $(MPIRUN) -x tmp=1 true 2> /dev/null ; echo $$?), 0)
MPIRUN_CMD=$(MPIRUN) $(if $(1),-x $(1),)
else ifeq ($(shell $(MPIRUN) -env tmp=1 true 2> /dev/null ; echo $$?), 0)
MPIRUN_CMD=$(MPIRUN) $(if $(1),-env $(1),)
else
MPIRUN_CMD=$(1) $(MPIRUN)
endif


# Rule to build work/<tc>/{ocean.stats,chksum_diag}.<tag>
# $(1): Test configuration name <tag>
# $(2): Executable type
Expand All @@ -291,24 +281,24 @@ work/%/$(1)/ocean.stats work/%/$(1)/chksum_diag: build/$(2)/MOM6
if [ $(3) ]; then find build/$(2) -name *.gcda -exec rm -f '{}' \; ; fi
mkdir -p $$(@D)
cp -rL $$*/* $$(@D)
cd $$(@D) && if [ -f Makefile ]; then make; fi
cd $$(@D) && if [ -f Makefile ]; then $(MAKE); fi
mkdir -p $$(@D)/RESTART
echo -e "$(4)" > $$(@D)/MOM_override
cd $$(@D) \
&& $$(call MPIRUN_CMD,$(5)) -n $(6) ../../../$$< 2> std.err > std.out \
&& $(5) $(MPIRUN) -n $(6) ../../../$$< 2> std.err > std.out \
|| !( \
mkdir -p ../../../results/$$*/ ; \
cat std.out | tee ../../../results/$$*/std.$(1).out | tail ; \
cat std.err | tee ../../../results/$$*/std.$(1).err | tail ; \
rm ocean.stats chksum_diag ; \
echo -e "${FAIL}: $$*.$(1) failed at runtime." \
cat std.out | tee ../../../results/$$*/std.$(1).out | tail -20 ; \
cat std.err | tee ../../../results/$$*/std.$(1).err | tail -20 ; \
rm ocean.stats chksum_diag ; \
echo -e "${FAIL}: $$*.$(1) failed at runtime." \
)
@echo -e "${DONE}: $$*.$(1); no runtime errors."
if [ $(3) ]; then \
mkdir -p results/$$* ; \
bash <(curl -s https://codecov.io/bash) -n $$@ \
> work/$$*/codecov.$(1).out \
2> work/$$*/codecov.$(1).err ; \
2> work/$$*/codecov.$(1).err ; \
fi
endef

Expand All @@ -320,7 +310,7 @@ $(eval $(call STAT_RULE,symmetric,symmetric,$(REPORT_COVERAGE),,,1))
$(eval $(call STAT_RULE,asymmetric,asymmetric,,,,1))
$(eval $(call STAT_RULE,target,target,,,,1))
$(eval $(call STAT_RULE,repro,repro,,,,1))
$(eval $(call STAT_RULE,openmp,openmp,,,,1))
$(eval $(call STAT_RULE,openmp,openmp,,,GOMP_CPU_AFFINITY=0,1))
$(eval $(call STAT_RULE,layout,symmetric,,LAYOUT=2$(,)1,,2))
$(eval $(call STAT_RULE,rotate,symmetric,,ROTATE_INDEX=True\nINDEX_TURNS=1,,1))
$(eval $(call STAT_RULE,nan,symmetric,,,MALLOC_PERTURB_=256,1))
Expand All @@ -337,7 +327,7 @@ work/%/restart/ocean.stats: build/symmetric/MOM6
rm -rf $(@D)
mkdir -p $(@D)
cp -rL $*/* $(@D)
cd work/$*/restart && if [ -f Makefile ]; then make; fi
cd work/$*/restart && if [ -f Makefile ]; then $(MAKE); fi
mkdir -p $(@D)/RESTART
# Generate the half-period input namelist
# TODO: Assumes that runtime set by DAYMAX, will fail if set by input.nml
Expand All @@ -352,8 +342,8 @@ work/%/restart/ocean.stats: build/symmetric/MOM6
cd $(@D) && $(MPIRUN) -n 1 ../../../$< 2> std1.err > std1.out \
|| !( \
cat std1.out | tee ../../../results/$*/std.restart1.out | tail ; \
cat std1.err | tee ../../../results/$*/std.restart1.err | tail ; \
echo -e "${FAIL}: $*.restart failed at runtime." \
cat std1.err | tee ../../../results/$*/std.restart1.err | tail ; \
echo -e "${FAIL}: $*.restart failed at runtime." \
)
# Setup the next inputs
cd $(@D) && rm -rf INPUT && mv RESTART INPUT
Expand All @@ -363,8 +353,8 @@ work/%/restart/ocean.stats: build/symmetric/MOM6
cd $(@D) && $(MPIRUN) -n 1 ../../../$< 2> std2.err > std2.out \
|| !( \
cat std2.out | tee ../../../results/$*/std.restart2.out | tail ; \
cat std2.err | tee ../../../results/$*/std.restart2.err | tail ; \
echo -e "${FAIL}: $*.restart failed at runtime." \
cat std2.err | tee ../../../results/$*/std.restart2.err | tail ; \
echo -e "${FAIL}: $*.restart failed at runtime." \
)

# TODO: Restart checksum diagnostics
Expand Down
7 changes: 7 additions & 0 deletions .testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,10 @@ use `srun` (such as on GFDL's gaea HPC):
```
make MPIRUN=srun test
```

For convenience you can provide some macro in the file `config.mk`. For example, on
gaea, to be able to run `make test -s -j` you will find putting the line
```
MPIRUN = srun -mblock --exclusive
```
in `config.mk` very useful.
2 changes: 1 addition & 1 deletion .testing/tc4/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
all:
ocean_hgrid.nc topog.nc temp_salt_ic.nc sponge.nc:
python build_grid.py
python build_data.py
39 changes: 27 additions & 12 deletions config_src/coupled_driver/MOM_surface_forcing_gfdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module MOM_surface_forcing_gfdl
use MOM_domains, only : AGRID, BGRID_NE, CGRID_NE, To_All
use MOM_domains, only : To_North, To_East, Omit_Corners
use MOM_error_handler, only : MOM_error, WARNING, FATAL, is_root_pe, MOM_mesg
use MOM_file_parser, only : get_param, log_version, param_file_type
use MOM_file_parser, only : get_param, log_param, log_version, param_file_type
use MOM_forcing_type, only : forcing, mech_forcing
use MOM_forcing_type, only : forcing_diags, mech_forcing_diags, register_forcing_type_diags
use MOM_forcing_type, only : allocate_forcing_type, deallocate_forcing_type
Expand Down Expand Up @@ -1231,7 +1231,7 @@ subroutine forcing_save_restart(CS, G, Time, directory, time_stamped, &
end subroutine forcing_save_restart

!> Initialize the surface forcing, including setting parameters and allocating permanent memory.
subroutine surface_forcing_init(Time, G, US, param_file, diag, CS)
subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
type(time_type), intent(in) :: Time !< The current model time
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
Expand All @@ -1240,6 +1240,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS)
!! diagnostic output
type(surface_forcing_CS), pointer :: CS !< A pointer that is set to point to the control
!! structure for this module
integer, optional, intent(in) :: wind_stagger !< If present, the staggering of the winds that are
!! being provided in calls to update_ocean_model

! Local variables
real :: utide ! The RMS tidal velocity [Z T-1 ~> m s-1].
Expand Down Expand Up @@ -1272,7 +1274,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS)

call write_version_number(version)
! Read all relevant parameters and write them to the model log.
call log_version(param_file, mdl, version, "")
call log_version(param_file, mdl, version, "", log_to_all=.true., debugging=.true.)

call get_param(param_file, mdl, "INPUTDIR", CS%inputdir, &
"The directory in which all input files are found.", &
Expand Down Expand Up @@ -1347,15 +1349,28 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS)
"the ocean dynamics. The actual net mass source may differ "//&
"due to internal corrections.", default=.false.)

call get_param(param_file, mdl, "WIND_STAGGER", stagger, &
"A case-insensitive character string to indicate the "//&
"staggering of the input wind stress field. Valid "//&
"values are 'A', 'B', or 'C'.", default="C")
if (uppercase(stagger(1:1)) == 'A') then ; CS%wind_stagger = AGRID
elseif (uppercase(stagger(1:1)) == 'B') then ; CS%wind_stagger = BGRID_NE
elseif (uppercase(stagger(1:1)) == 'C') then ; CS%wind_stagger = CGRID_NE
else ; call MOM_error(FATAL,"surface_forcing_init: WIND_STAGGER = "// &
trim(stagger)//" is invalid.") ; endif
if (present(wind_stagger)) then
if (wind_stagger == AGRID) then ; stagger = 'AGRID'
elseif (wind_stagger == BGRID_NE) then ; stagger = 'BGRID_NE'
elseif (wind_stagger == CGRID_NE) then ; stagger = 'CGRID_NE'
else ; stagger = 'UNKNOWN' ; call MOM_error(FATAL,"surface_forcing_init: WIND_STAGGER = "// &
trim(stagger)// "is invalid."); endif
call log_param(param_file, mdl, "WIND_STAGGER", stagger, &
"The staggering of the input wind stress field "//&
"from the coupler that is actually used.")
CS%wind_stagger = wind_stagger
else
call get_param(param_file, mdl, "WIND_STAGGER", stagger, &
"A case-insensitive character string to indicate the "//&
"staggering of the input wind stress field. Valid "//&
"values are 'A', 'B', or 'C'.", default="C")
if (uppercase(stagger(1:1)) == 'A') then ; CS%wind_stagger = AGRID
elseif (uppercase(stagger(1:1)) == 'B') then ; CS%wind_stagger = BGRID_NE
elseif (uppercase(stagger(1:1)) == 'C') then ; CS%wind_stagger = CGRID_NE
else ; call MOM_error(FATAL,"surface_forcing_init: WIND_STAGGER = "// &
trim(stagger)//" is invalid.") ; endif
endif

call get_param(param_file, mdl, "WIND_STRESS_MULTIPLIER", CS%wind_stress_multiplier, &
"A factor multiplying the wind-stress given to the ocean by the "//&
"coupler. This is used for testing and should be =1.0 for any "//&
Expand Down
Loading

0 comments on commit ff34126

Please sign in to comment.