Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions src/MAIN_NEMS.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ PROGRAM MAIN_NEMS
USE module_NEMS_Rusage,ONLY: NEMS_Rusage
!
!-----------------------------------------------------------------------
!*** This module contains PIO initialization related routines.
!-----------------------------------------------------------------------
!
#if defined PIO
Comment thread
BinLiu-NOAA marked this conversation as resolved.
USE shr_pio_mod, ONLY: shr_pio_init1
#endif
!
!-----------------------------------------------------------------------
!
IMPLICIT NONE
!
Expand Down Expand Up @@ -118,6 +126,7 @@ PROGRAM MAIN_NEMS
!
CHARACTER(LEN=MPI_MAX_PROCESSOR_NAME) :: PROCNAME !<-- The processor(host) name
INTEGER :: PROCNAME_LEN !<-- Actual PROCRNAME string length
INTEGER :: COMM_WORLD !<-- Copy of MPI_COMM_WORLD
!
!-----------------------------------------------------------------------
!***********************************************************************
Expand Down Expand Up @@ -191,6 +200,15 @@ PROGRAM MAIN_NEMS
! the start succeeded.
!
!-----------------------------------------------------------------------
!*** Initialize PIO. 8 is the maximum number of component models
!-----------------------------------------------------------------------
!
COMM_WORLD = MPI_COMM_WORLD
#if defined PIO
call shr_pio_init1(8, "pio_in", COMM_WORLD)
#endif
!
!-----------------------------------------------------------------------
!*** Set up the default log.
!-----------------------------------------------------------------------
!
Expand Down
93 changes: 93 additions & 0 deletions src/incmake/component_CDEPS.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Location of the ESMF makefile fragment for this component:
Comment thread
BinLiu-NOAA marked this conversation as resolved.
cdeps_mk = $(ROOTDIR)/CDEPS/CDEPS_INSTALL/cdeps.mk
all_component_mk_files+=$(cdeps_mk)

# Need this because cmeps_mk is not available at this level
cmeps_mk = $(ROOTDIR)/CMEPS/CMEPS_INSTALL/cmeps.mk

# Location of source code and installation
CDEPS_SRCDIR?=$(ROOTDIR)/CDEPS
CDEPS_BLDDIR?=$(ROOTDIR)/CDEPS/CDEPS_BUILD
CDEPS_BINDIR?=$(ROOTDIR)/CDEPS/CDEPS_INSTALL

# Make sure the expected directories exist and are non-empty:
$(call require_dir,$(CDEPS_SRCDIR),CDEPS source directory)

ifndef CONFIGURE_NEMS_FILE
$(error CONFIGURE_NEMS_FILE not set.)
endif

include $(CONFIGURE_NEMS_FILE)

# Rule for building this component:
build_CDEPS: $(cdeps_mk)

CDEPS_ALL_OPTS=\
COMP_SRCDIR="$(CDEPS_SRCDIR)" \
COMP_BINDIR="$(CDEPS_BINDIR)" \
MACHINE_ID="$(MACHINE_ID)" \
FC="$(FC)" \
CC="$(CC)" \
CXX="$(CXX)"

# Rule for building CDEPS using cmake build system
$(cdeps_mk): $(cmeps_mk) configure
$(MODULE_LOGIC); export $(CDEPS_ALL_OPTS); \
set -e; $(MODULE_LOGIC); mkdir -p $(CDEPS_BLDDIR); \
cd $(CDEPS_BLDDIR); \
exec cmake -DCMAKE_BUILD_TYPE=Release \
-DBLD_STANDALONE=ON \
-DCMAKE_INSTALL_PREFIX=$(CDEPS_BINDIR) \
-DCMAKE_Fortran_COMPILER=$(FC) \
-DCMAKE_C_COMPILER=$(CC) \
-DCMAKE_CXX_COMPILER=$(CXX) \
-DPIO=$(PIO_ROOT) \
-DPIO_Fortran_LIBRARY=$(PIO_LIBDIR) \
-DPIO_Fortran_INCLUDE_DIR=$(PIO_INC) \
-DPIO_C_LIBRARY=$(PIO_LIBDIR) \
-DPIO_C_INCLUDE_DIR=$(PIO_INC) ../

$(MODULE_LOGIC); export $(CDEPS_ALL_OPTS); \
set -e; $(MODULE_LOGIC) ; cd $(CDEPS_BLDDIR); \
exec $(MAKE) -j 1 $(CDEPS_ALL_OPTS) install VERBOSE=1

$(MODULE_LOGIC); export $(CDEPS_ALL_OPTS); \
set -e; $(MODULE_LOGIC) ; cd $(CDEPS_BLDDIR); \
exec find ./d??? -name "*.a" -exec cp {} ../CDEPS_INSTALL/lib/ \;

$(MODULE_LOGIC); export $(CDEPS_ALL_OPTS); \
set -e; $(MODULE_LOGIC) ; cd $(CDEPS_BLDDIR); \
exec find ./fox/lib -name "*.a" -exec cp {} ../CDEPS_INSTALL/lib/ \;

$(MODULE_LOGIC); export $(CDEPS_ALL_OPTS); \
set -e; $(MODULE_LOGIC) ; cd $(CDEPS_BLDDIR); \
exec find share/ -name "*.a" -exec cp {} ../CDEPS_INSTALL/lib/ \;

$(MODULE_LOGIC); export $(CDEPS_ALL_OPTS); \
set -e; $(MODULE_LOGIC) ; cd $(CDEPS_BLDDIR); \
exec find ./d??? -name "*_comp_nuopc.mod" -exec cp {} ../CDEPS_INSTALL/include/ \;

rm -f $(CDEPS_BINDIR)/cdeps.mk
@echo "# ESMF self-describing build dependency makefile fragment" > $(CDEPS_BINDIR)/cdeps.mk
@echo "# src location: $(CDEPS_SRCDIR)" >> $(CDEPS_BINDIR)/cdeps.mk
@echo >> $(CDEPS_BINDIR)/cdeps.mk
@echo "ESMF_DEP_FRONT = " >> $(CDEPS_BINDIR)/cdeps.mk
@echo "ESMF_DEP_INCPATH = $(CDEPS_BINDIR)/include" >> $(CDEPS_BINDIR)/cdeps.mk
@echo "ESMF_DEP_CMPL_OBJS = " >> $(CDEPS_BINDIR)/cdeps.mk
@echo "ESMF_DEP_LINK_OBJS = -L$(CDEPS_BINDIR)/lib -ldshr -lstreams -lcdeps_share -lFoX_dom -lFoX_sax -lFoX_common -lFoX_utils -lFoX_fsys -L$(PIO_LIBDIR) -lpiof -lpioc" >> $(CDEPS_BINDIR)/cdeps.mk

test -d "$(CDEPS_BINDIR)"
test -s "$(cdeps_mk)"

# Rule for cleaning the SRCDIR and BINDIR:
clean_CDEPS:
cp -n $(MODULE_DIR)/$(CHOSEN_MODULE) $(CONFDIR)/modules.nems ; \
$(MODULE_LOGIC); export $(CDEPS_ALL_OPTS); \
set -e; \
if [ -d "~/Dropbox" ]; then cd $(CDEPS_BLDDIR); \
exec $(MAKE) clean; fi

distclean_CDEPS: clean_CDEPS
rm -rf $(CDEPS_BINDIR)
rm -rf $(CDEPS_BLDDIR)
rm -f $(cdeps_mk)
43 changes: 43 additions & 0 deletions src/incmake/component_CDEPS_DATM.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Location of the ESMF makefile fragment for this component:
cdeps_datm_mk = $(ROOTDIR)/CDEPS/DATM_INSTALL/cdeps_datm.mk
all_component_mk_files+=$(cdeps_datm_mk)

# Need this because cmeps_mk is not available at this level
cdeps_mk = $(ROOTDIR)/CDEPS/CDEPS_INSTALL/cdeps.mk

# Location of source code and installation
CDEPS_DATM_BINDIR?=$(ROOTDIR)/CDEPS/DATM_INSTALL
CDEPS_BINDIR?=$(ROOTDIR)/CDEPS/CDEPS_INSTALL

# Make sure we're setting CDEPS=Y if DATM is enabled:
ifeq (,$(findstring CDEPS,$(COMPONENTS)))
$(error DATM requires CDEPS)
endif

# Rule for building this component:
build_CDEPS_DATM: $(cdeps_datm_mk)

DATM_ALL_FLAGS=\
COMP_BINDIR="$(CDEPS_DATM_BINDIR)"

$(cdeps_datm_mk): $(cdeps_mk) configure
mkdir -p $(CDEPS_DATM_BINDIR)
rm -f $(cdeps_datm_mk)
@echo "# ESMF self-describing build dependency makefile fragment" > $(cdeps_datm_mk)
@echo "# src location: $(ROOTDIR)/CDEPS" >> $(cdeps_datm_mk)
@echo >> $(cdeps_datm_mk)
@echo "ESMF_DEP_FRONT = atm_comp_nuopc" >> $(cdeps_datm_mk)
@echo "ESMF_DEP_INCPATH = " >> $(cdeps_datm_mk)
@echo "ESMF_DEP_CMPL_OBJS = " >> $(cdeps_datm_mk)
@echo "ESMF_DEP_LINK_OBJS = -L$(CDEPS_BINDIR)/lib -ldatm -ldshr -lstreams -lcdeps_share -lFoX_dom -lFoX_sax -lFoX_common -lFoX_utils -lFoX_fsys -L$(PIO_LIBDIR) -lpiof -lpioc" >> $(cdeps_datm_mk)

test -d "$(CDEPS_DATM_BINDIR)"
test -s "$(cdeps_datm_mk)"

# Rule for cleaning the SRCDIR and BINDIR:
clean_CDEPS_DATM:
@echo "there is nothing to clean for CDEPS provided DATM"

distclean_CDEPS_DATM: clean_CDEPS_DATM
rm -rf $(CDEPS_DATM_BINDIR) $(cdeps_datm_mk)

43 changes: 43 additions & 0 deletions src/incmake/component_CDEPS_DOCN.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Location of the ESMF makefile fragment for this component:
cdeps_docn_mk = $(ROOTDIR)/CDEPS/DOCN_INSTALL/cdeps_docn.mk
all_component_mk_files+=$(cdeps_docn_mk)

# Need this because cmeps_mk is not available at this level
cdeps_mk = $(ROOTDIR)/CDEPS/CDEPS_INSTALL/cdeps.mk

# Location of source code and installation
CDEPS_DOCN_BINDIR?=$(ROOTDIR)/CDEPS/DOCN_INSTALL
CDEPS_BINDIR?=$(ROOTDIR)/CDEPS/CDEPS_INSTALL

# Make sure we're setting CDEPS=Y if DOCN is enabled:
ifeq (,$(findstring CDEPS,$(COMPONENTS)))
$(error DOCN requires CDEPS)
endif

# Rule for building this component:
build_CDEPS_DOCN: $(cdeps_docn_mk)

DOCN_ALL_FLAGS=\
COMP_BINDIR="$(CDEPS_DOCN_BINDIR)"

$(cdeps_docn_mk): $(cdeps_mk) configure
mkdir -p $(CDEPS_DOCN_BINDIR)
rm -f $(cdeps_docn_mk)
@echo "# ESMF self-describing build dependency makefile fragment" > $(cdeps_docn_mk)
@echo "# src location: $(ROOTDIR)/CDEPS" >> $(cdeps_docn_mk)
@echo >> $(cdeps_docn_mk)
@echo "ESMF_DEP_FRONT = ocn_comp_nuopc" >> $(cdeps_docn_mk)
@echo "ESMF_DEP_INCPATH = " >> $(cdeps_docn_mk)
@echo "ESMF_DEP_CMPL_OBJS = " >> $(cdeps_docn_mk)
@echo "ESMF_DEP_LINK_OBJS = -L$(CDEPS_BINDIR)/lib -ldocn -ldshr -lstreams -lcdeps_share -lFoX_dom -lFoX_sax -lFoX_common -lFoX_utils -lFoX_fsys -L$(PIO_LIBDIR) -lpiof -lpioc" >> $(cdeps_docn_mk)

test -d "$(CDEPS_DOCN_BINDIR)"
test -s "$(cdeps_docn_mk)"

# Rule for cleaning the SRCDIR and BINDIR:
clean_CDEPS_DOCN:
@echo "there is nothing to clean for CDEPS provided DOCN"

distclean_CDEPS_DOCN: clean_CDEPS_DOCN
rm -rf $(CDEPS_DOCN_BINDIR) $(cdeps_docn_mk)

7 changes: 5 additions & 2 deletions src/incmake/component_CMEPS.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ all_component_mk_files+=$(cmeps_mk)

# Location of source code and installation
CMEPS_SRCDIR?=$(ROOTDIR)/CMEPS
CMEPS_BINDIR?=$(ROOTDIR)/CMEPS_INSTALL
CMEPS_BINDIR?=$(ROOTDIR)/CMEPS/CMEPS_INSTALL

# Make sure the expected directories exist and are non-empty:
$(call require_dir,$(CMEPS_SRCDIR),CMEPS source directory)
Expand All @@ -24,7 +24,10 @@ CMEPS_ALL_OPTS=\
MACHINE_ID="$(MACHINE_ID)" \
FC="$(FC)" \
CC="$(CC)" \
CXX="$(CXX)"
CXX="$(CXX)" \
INTERNAL_PIO_INIT=0

$(info "CMEPS_ALL_OPTS = $(CMEPS_ALL_OPTS)")

$(cmeps_mk): configure
$(MODULE_LOGIC) ; export $(CMEPS_ALL_OPTS) ; \
Expand Down
3 changes: 3 additions & 0 deletions src/incmake/component_HYCOM.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ HYCOM_ALL_OPTS=\
# Rules for building this component:

$(hycom_mk): configure
+$(MODULE_LOGIC) ; cd "$(HYCOM_SRCDIR)" ; exec $(MAKE) \
ARCH="$(HYCOM_ARCH)" TYPE="$(HYCOM_TYPE)" CPP_EXTRAS="$(HYCOM_OPTS)" \
esmf
+$(MODULE_LOGIC) ; cd "$(HYCOM_SRCDIR)/NUOPC" ; exec $(MAKE) \
ARCH="$(HYCOM_ARCH)" TYPE="$(HYCOM_TYPE)" CPP_EXTRAS="$(HYCOM_OPTS)" \
nuopc
Expand Down
Loading