Skip to content

Commit

Permalink
Merge MPAS-Dev::develop into release-stable (#8)
Browse files Browse the repository at this point in the history
Merge latest changes from upstream repository.  Works with mpas-jedi branch of the same name.  See that corresponding PR for more information on mpas-bundle behavior.

There are a lot of commits in this PR due to it having been a long time since such a merge was conducted.  The conflicts between the two branches are dealt with in commits 5beb733 and after.  Some small code changes from the early days of MPAS-JEDI development is removed, because it no longer serves a purpose.

After this PR is merged, `release-stable` will be nearly up to date with MPAS-Dev::develop with the following exceptions for code that is only in the JCSDA-internal fork:
- convective/cloud diagnostics for PANDA-C
- 2-stream I/O with a static file shared across all dates
- adjoint of some halo communications used for static B
- bug fixes in core_init_atmosphere for initializing `rho_zz` and `xice`
- optional cmake build process and dependence on the `jedi-cmake` repository

Closes #7
  • Loading branch information
JJ Guerrette authored Jan 11, 2021
1 parent aa2dcd4 commit 31ca214
Show file tree
Hide file tree
Showing 68 changed files with 7,435 additions and 1,511 deletions.
176 changes: 155 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
MODEL_FORMULATION =
MODEL_FORMULATION =

ifneq "${MPAS_SHELL}" ""
SHELL = ${MPAS_SHELL}
endif

dummy:
( $(MAKE) error )
Expand Down Expand Up @@ -30,7 +33,37 @@ xlf:
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )


xlf-summit-omp-offload:
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpiCC" \
"FC_SERIAL = xlf90_r" \
"CC_SERIAL = xlc_r" \
"CXX_SERIAL = xlc++_r" \
"FFLAGS_PROMOTION = -qrealsize=8" \
"FFLAGS_OPT = -g -qfullpath -qmaxmem=-1 -qphsinfo -qzerosize -qfree=f90 -qxlf2003=polymorphic -qspillsize=2500 -qextname=flush -O2 -qstrict -Q" \
"CFLAGS_OPT = -g -qfullpath -qmaxmem=-1 -qphsinfo -O3" \
"CXXFLAGS_OPT = -g -qfullpath -qmaxmem=-1 -qphsinfo -O3" \
"LDFLAGS_OPT = -Wl,--relax -Wl,--allow-multiple-definition -qsmp -qoffload -lcudart -L$(CUDA_DIR)/lib64" \
"FFLAGS_GPU = -qsmp -qoffload" \
"LDFLAGS_GPU = -qsmp -qoffload -lcudart -L$(CUDA_DIR)/lib64" \
"FFLAGS_DEBUG = -O0 -g -qinitauto=7FF7FFFF -qflttrap=ov:zero:inv:en" \
"CFLAGS_DEBUG = -O0 -g" \
"CXXFLAGS_DEBUG = -O0 -g" \
"LDFLAGS_DEBUG = -O0 -g" \
"FFLAGS_OMP = -qsmp=omp" \
"CFLAGS_OMP = -qsmp=omp" \
"PICFLAG = -qpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENMP_OFFLOAD = $(OPENMP_OFFLOAD)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DFORTRAN_SAME -DCPRIBM -DLINUX" )

ftn:
( $(MAKE) all \
"FC_PARALLEL = ftn" \
Expand Down Expand Up @@ -97,7 +130,37 @@ pgi:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DCPRPGI" )

pgi-summit:
( $(MAKE) all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = pgf90" \
"CC_SERIAL = pgcc" \
"CXX_SERIAL = pgc++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -g -O3 -byteswapio -Mfree" \
"CFLAGS_OPT = -O3 " \
"CXXFLAGS_OPT = -O3 " \
"LDFLAGS_OPT = -O3 " \
"FFLAGS_ACC = -acc -Minfo=accel -ta=tesla:cc70,cc60,deepcopy,nollvm " \
"CFLAGS_ACC = -acc -Minfo=accel -ta=tesla:cc70,cc60,deepcopy,nollvm " \
"FFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -byteswapio -Mfree -Ktrap=divz,fp,inv,ovf -traceback" \
"CFLAGS_DEBUG = -O0 -g -traceback" \
"CXXFLAGS_DEBUG = -O0 -g -traceback" \
"LDFLAGS_DEBUG = -O0 -g -Mbounds -Mchkptr -Ktrap=divz,fp,inv,ovf -traceback" \
"FFLAGS_OMP = -mp" \
"CFLAGS_OMP = -mp" \
"PICFLAG = -fpic" \
"BUILD_TARGET = $(@)" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"OPENACC = $(OPENACC)" \
"CPPFLAGS = -DpgiFortran -D_MPI -DUNDERSCORE" )

pgi-nersc:
( $(MAKE) all \
Expand All @@ -119,7 +182,7 @@ pgi-nersc:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DCPRPGI" )

pgi-llnl:
( $(MAKE) all \
Expand All @@ -141,7 +204,7 @@ pgi-llnl:
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DCPRPGI" )

ifort:
( $(MAKE) all \
Expand Down Expand Up @@ -444,9 +507,34 @@ llvm:
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI" )

CPPINCLUDES =
FCINCLUDES =
LIBS =
nag:
( $(MAKE) all \
"FC_PARALLEL = mpifort" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpic++" \
"FC_SERIAL = nagfor" \
"CC_SERIAL = gcc" \
"CXX_SERIAL = g++" \
"FFLAGS_PROMOTION = -r8" \
"FFLAGS_OPT = -free -mismatch -O3 -convert=big_ieee" \
"CFLAGS_OPT = -O3" \
"CXXFLAGS_OPT = -O3" \
"LDFLAGS_OPT = -O3" \
"FFLAGS_DEBUG = -free -mismatch -O0 -g -C -convert=big_ieee" \
"CFLAGS_DEBUG = -O0 -g -Wall -pedantic" \
"CXXFLAGS_DEBUG = -O0 -g -Wall -pedantic" \
"LDFLAGS_DEBUG = -O0 -g -C" \
"FFLAGS_OMP = -qsmp=omp" \
"CFLAGS_OMP = -qsmp=omp" \
"CORE = $(CORE)" \
"DEBUG = $(DEBUG)" \
"USE_PAPI = $(USE_PAPI)" \
"OPENMP = $(OPENMP)" \
"CPPFLAGS = $(MODEL_FORMULATION) -D_MPI -DUNDERSCORE -DNAG_COMPILER" )

CPPINCLUDES =
FCINCLUDES =
LIBS =

#
# If user has indicated a PIO2 library, define USE_PIO2 pre-processor macro
Expand Down Expand Up @@ -481,9 +569,15 @@ endif
# Depending on PIO version, libraries may be libpio.a, or libpiof.a and libpioc.a
# Keep open the possibility of shared libraries in future with, e.g., .so suffix
#
# Check if libpio.* exists and link -lpio if so, but we make an exception for
# libpio.settings (a file added in PIO2), which is not a library to link
ifneq ($(wildcard $(PIO_LIB)/libpio\.*), )
LIBS += -lpio
# Makefiles don't support "and" operators so we have nested "if" instead
ifneq "$(wildcard $(PIO_LIB)/libpio\.*)" "$(PIO_LIB)/libpio.settings"
LIBS += -lpio
endif
endif

ifneq ($(wildcard $(PIO_LIB)/libpiof\.*), )
LIBS += -lpiof
endif
Expand All @@ -495,27 +589,45 @@ ifneq ($(wildcard $(PIO_LIB)/libgptl\.*), )
endif

ifneq "$(NETCDF)" ""
ifneq ($(wildcard $(NETCDF)/lib), )
NETCDFLIBLOC = lib
endif
ifneq ($(wildcard $(NETCDF)/lib64), )
NETCDFLIBLOC = lib64
endif
CPPINCLUDES += -I$(NETCDF)/include
FCINCLUDES += -I$(NETCDF)/include
LIBS += -L$(NETCDF)/lib
LIBS += -L$(NETCDF)/$(NETCDFLIBLOC)
NCLIB = -lnetcdf
NCLIBF = -lnetcdff
ifneq ($(wildcard $(NETCDF)/lib/libnetcdff.*), ) # CHECK FOR NETCDF4
ifneq ($(wildcard $(NETCDF)/$(NETCDFLIBLOC)/libnetcdff.*), ) # CHECK FOR NETCDF4
LIBS += $(NCLIBF)
endif # CHECK FOR NETCDF4
ifneq "$(NETCDFF)" ""
FCINCLUDES += -I$(NETCDFF)/include
LIBS += -L$(NETCDFF)/lib
LIBS += -L$(NETCDFF)/$(NETCDFLIBLOC)
LIBS += $(NCLIBF)
endif
LIBS += $(NCLIB)
endif


ifneq "$(PNETCDF)" ""
ifneq ($(wildcard $(PNETCDF)/lib), )
PNETCDFLIBLOC = lib
endif
ifneq ($(wildcard $(PNETCDF)/lib64), )
PNETCDFLIBLOC = lib64
endif
CPPINCLUDES += -I$(PNETCDF)/include
FCINCLUDES += -I$(PNETCDF)/include
LIBS += -L$(PNETCDF)/lib -lpnetcdf
LIBS += -L$(PNETCDF)/$(PNETCDFLIBLOC) -lpnetcdf
endif

ifneq "$(LAPACK)" ""
LIBS += -L$(LAPACK)
LIBS += -llapack
LIBS += -lblas
endif

RM = rm -f
Expand Down Expand Up @@ -582,6 +694,22 @@ ifeq "$(OPENMP)" "true"
LDFLAGS += $(FFLAGS_OMP)
endif #OPENMP IF

ifeq "$(OPENACC)" "true"
FFLAGS += $(FFLAGS_ACC)
CFLAGS += $(CFLAGS_ACC)
CXXFLAGS += $(CFLAGS_ACC)
override CPPFLAGS += "-DMPAS_OPENACC"
LDFLAGS += $(FFLAGS_ACC)
endif #OPENACC IF

ifeq "$(OPENMP_OFFLOAD)" "true"
FFLAGS += $(FFLAGS_GPU)
CFLAGS += $(FFLAGS_GPU)
CXXFLAGS += $(FFLAGS_GPU)
override CPPFLAGS += "-DMPAS_OPENMP_OFFLOAD"
LDFLAGS += $(LDFLAGS_GPU)
endif #OPENMP_OFFLOAD IF

ifeq "$(PRECISION)" "single"
CFLAGS += "-DSINGLE_PRECISION"
CXXFLAGS += "-DSINGLE_PRECISION"
Expand Down Expand Up @@ -672,6 +800,18 @@ else
OPENMP_MESSAGE="MPAS was built without OpenMP support."
endif

ifeq "$(OPENMP_OFFLOAD)" "true"
OPENMP_OFFLOAD_MESSAGE="MPAS was built with OpenMP-offload GPU support enabled."
else
OPENMP_OFFLOAD_MESSAGE="MPAS was built without OpenMP-offload GPU support."
endif

ifeq "$(OPENACC)" "true"
OPENACC_MESSAGE="MPAS was built with OpenACC accelerator support enabled."
else
OPENACC_MESSAGE="MPAS was built without OpenACC accelerator support."
endif

ifneq ($(wildcard .mpas_core_*), ) # CHECK FOR BUILT CORE

ifneq ($(wildcard .mpas_core_$(CORE)), ) # CHECK FOR SAME CORE AS ATTEMPTED BUILD.
Expand All @@ -695,14 +835,6 @@ else
CONTINUE=true
endif # END IF BUILT CORE CHECK

ifeq "$(SHARELIB)" "true"
FFLAGS += -fPIC
CFLAGS += -fPIC
CXXFLAGS += -fPIC
override CPPFLAGS += -fPIC
LDFLAGS += -fPIC
endif #SHARELIB IF

ifneq ($(wildcard namelist.$(NAMELIST_SUFFIX)), ) # Check for generated namelist file.
NAMELIST_MESSAGE="A default namelist file (namelist.$(NAMELIST_SUFFIX).defaults) has been generated, but namelist.$(NAMELIST_SUFFIX) has not been modified."
else
Expand Down Expand Up @@ -857,6 +989,8 @@ endif
@echo $(PAPI_MESSAGE)
@echo $(TAU_MESSAGE)
@echo $(OPENMP_MESSAGE)
@echo $(OPENMP_OFFLOAD_MESSAGE)
@echo $(OPENACC_MESSAGE)
@echo $(SHAREDLIB_MESSAGE)
ifeq "$(AUTOCLEAN)" "true"
@echo $(AUTOCLEAN_MESSAGE)
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ only described below the src directory.

MPAS-Model
├── src
│   ├── registry -- Code for building Registry.xml parser (Shared)
│   ├── driver -- Main driver for MPAS in stand-alone mode (Shared)
│   ├── external -- External software for MPAS (Shared)
│   ├── framework -- MPAS Framework (Includes DDT Descriptions, and shared routines. Shared)
│   ├── operators -- MPAS Opeartors (Includes Operators for MPAS meshes. Shared)
│   ├── inc -- Empty directory for include files that Registry generates (Shared)
│   ├── tools -- Empty directory for include files that Registry generates (Shared)
│   │  ├── registry -- Code for building Registry.xml parser (Shared)
│  │  └── input_gen -- Code for generating streams and namelist files (Shared)
│   └── core_* -- Individual model cores.
└────── testing_and_setup -- tools for setting up configurations and tests cases (Shared)
│   └── inc -- Empty directory for include files that Registry generates
├── testing_and_setup -- Tools for setting up configurations and test cases (Shared)
└── default_inputs -- Copies of default stream and namelists files (Shared)

Model cores are typically developed independently. For information about
building and running a particular core, please refer to that core's user's
Expand Down
Loading

0 comments on commit 31ca214

Please sign in to comment.