[mpas-developers] COMMIT CHECK: Branch Merge

Michael Duda duda at ucar.edu
Tue Dec 4 15:03:25 MST 2012


Hi, Doug.

Attached is an example of what I had in mind.  The Makefile and
Makefile.in.CESM_OCN files contain very little overlap, which should
relieve most of the burden of applying changes in multiple places.  
In general, I'm not sure we can ever escape the need for updating other
files when one changes; for example, when changing the interfaces in a
module, one necessarily has to update all other code that depends on
that module interface.  However, I do appreciate that it would be much
more difficult for developers to ensure that changes to the Makefile
won't break the CESM build of MPAS-O.  We can also hope that at least
one person will catch such problems at the time the changes are proposed
for inclusion in the trunk.

I think having Makefiles that are as transparent as possible (without
multiple layers of "ifeq" statements to mentally apply) should reduce
the chances of mistakes overall, especially when adding in changes for
MPAS-A and CAM.

Sticking with CESM, rather than COUPLED, would be fine for us,
especially with include files used as in the attached makefiles.

Of course, I'm open to other suggestions for dealing with different
builds of MPAS-O and MPAS-A (stand-alone and coupled) from the same
source.

Regards,
Michael


On Tue, Dec 04, 2012 at 12:23:41PM -0700, Doug Jacobsen wrote:
> Hey Michael,
> 
> Just to clarify. Do you want to have a copy of the entire makefile in
> Makefile.in.CESM_OCN, just without the ifeq's for CESM?
> 
> The only problem I would have with this is the amount of effort to maintain
> all of the makefile we would need. Even with two, I think it's going to be
> difficult for developers to remember to updated both Makefile and
> Makefile.in.CESM_OCN when they make some change to Makefile.
> 
> Other than that issue, I don't see a reason that it couldn't happen like
> that. I don't really have a strong preference either way.
> 
> With regards to working with CAM, would you guys prefer to have the flag be
> COUPLED rather than CESM?
> 
> Thanks for the comments,
> Doug
> 
> 
> On Tue, Dec 4, 2012 at 12:04 PM, Michael Duda <duda at ucar.edu> wrote:
> 
> > Hi, Doug.
> >
> > Since this will affect everyone, including our work here to implement
> > MPAS-A as a dynamical core in CAM, I thought I'd bring this up with the
> > larger group.  The Makefile in the src directory (i.e., src/Makefile) of
> > the branch is looking a bit tangled to me with all of the "ifeq"
> > statements.  As a potential solution, I'm wondering whether we could
> > make use of include files, so src/Makefile looks something like:
> >
> >
> > ifeq "$(CESM)" "true"
> >
> > include Makefile.in.CESM_OCN
> >
> > else
> >
> >    #
> >    # Current contents of the Makefile
> >    #
> >
> > endif
> >
> >
> > This would allow us the flexibility to do whatever we need to for MPAS-O
> > and MPAS-A, while still keeping the Makefile for a stand-alone build
> > looking clean. I'd imagined that, when building the MPAS-A dycore within
> > CAM, we could add a little extra logic:
> >
> >
> > ifeq "$(CESM)" "true"
> >
> > ifeq "$(CORE)" "ocean"
> > include Makefile.in.CESM_OCN
> > endif
> >
> > ifeq "$(CORE)" "nhyd_atmos"
> > include Makefile.in.CESM_ATM
> > endif
> >
> > else
> >
> >    #
> >    # Current contents of the Makefile
> >    #
> >
> > endif
> >
> >
> > Does this sound like a potentially viable approach? I think that
> > splitting out the specifics for CESM and CAM builds could make it easier
> > for other developers (and future users, potentially) to follow the build
> > sequence and dependencies.
> >
> > Regards,
> > Michael
> >
> >
> > On Mon, Dec 03, 2012 at 01:25:19PM -0700, Doug Jacobsen wrote:
> > > Hello All,
> > >
> > > I have been working recently on coupling MPAS-O to CESM. I currently have
> > > it setup to where MPAS build's in a suitable method for CESM, and the
> > Ocean
> > > model can run within CESM (without being forced).
> > >
> > > Several changes were made that were needed to be able to have MPAS build
> > > properly for inclusion in to CESM. I want to merge the branch I have been
> > > working under to the trunk before putting more work on the forcing side.
> > > This way, we have a checkpoint on the trunk of a working version of MPAS
> > > with the CESM.
> > >
> > > Also, I think I won't need to make any more changes to the shared areas
> > of
> > > MPAS after this commit.
> > >
> > > The branch in question is branches/ocean_projects/cesm_coupling. I'll
> > > commit it on Wednesday if I don't hear anything about it, but any
> > questions
> > > or comments are welcome.
> > >
> > > Thanks!
> > > Doug
> >
> > > _______________________________________________
> > > mpas-developers mailing list
> > > mpas-developers at mailman.ucar.edu
> > > http://mailman.ucar.edu/mailman/listinfo/mpas-developers
> >
> >
-------------- next part --------------
.SUFFIXES: .F .c .o

ifeq "$(CESM)" "true"

ifeq "$(CORE)" "ocean"
include Makefile.in.CESM_OCN
endif

else

#
# Rules specific to stand-alone builds of MPAS
#

all: mpas

mpas: reg_includes externals frame ops dycore drver
	$(LINKER) $(LDFLAGS) -o $(CORE)_model.exe driver/*.o -L. -ldycore -lops -lframework $(LIBS) -I./external/esmf_time_f90 -L./external/esmf_time_f90 -lesmf_time

externals: reg_includes
	( cd external; $(MAKE) FC="$(FC)" SFC="$(SFC)" CC="$(CC)" SCC="$(SCC)" FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" NETCDF="$(NETCDF)" CORE="$(CORE)" )

drver:  reg_includes externals frame ops dycore
	( cd driver; $(MAKE) all ) 

endif


#
# Rules common to all builds of MPAS
#

reg_includes: 
	( cd registry; $(MAKE) CC="$(SCC)" )
	( cd inc; $(CPP) ../core_$(CORE)/Registry | ../registry/parse > Registry.processed)

frame: reg_includes externals
	( cd framework; $(MAKE) all ) 
	ln -sf framework/libframework.a libframework.a

ops: reg_includes externals frame
	( cd operators; $(MAKE) all ) 
	ln -sf operators/libops.a libops.a

dycore: reg_includes externals frame ops
	( cd core_$(CORE); $(MAKE) all ) 
	ln -sf core_$(CORE)/libdycore.a libdycore.a

clean:
	$(RM) $(CORE)_model.exe libframework.a libops.a libdycore.a lib$(CORE).a *.o
	( cd registry; $(MAKE) clean )
	( cd external; $(MAKE) clean )
	( cd framework; $(MAKE) clean )
	( cd operators; $(MAKE) clean )
	( cd inc; rm -f *.inc Registry.processed )
	if [ -d core_$(CORE) ] ; then \
	   ( cd core_$(CORE); $(MAKE) clean ) \
	fi;
	( cd driver; $(MAKE) clean )
-------------- next part --------------
include $(CASEROOT)/Macros
RM = rm -f
CPP = cpp -C -P -traditional
FC=$(MPIFC)
CC=$(MPICC)
NETCDF=$(NETCDF_PATH)
PNETCDF=$(PNETCDF_PATH)
PIO=$(EXEROOT)/pio
FILE_OFFSET = -DOFFSET64BIT
CPPFLAGS += $(MODEL_FORMULATION) $(FILE_OFFSET) $(ZOLTAN_DEFINE) -DMPAS_CESM -D_MPI# -DUNDERSCORE
CPPINCLUDES += -I$(EXEROOT)/ocn/source/inc -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
FCINCLUDES += -I$(EXEROOT)/ocn/source/inc -I$(EXEROOT)/csm_share -I$(EXEROOT)/gptl -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
LIBS += -L$(PIO) -L$(PNETCDF)/lib -L$(NETCDF)/lib -lpio -lpnetcdf -lnetcdf

all:
	@echo $(CPPINCLUDES)
	@echo $(FCINCLUDES)
	( $(MAKE) mpas RM="$(RM)" CPP="$(CPP)" NETCDF="$(NETCDF)" PNETCDF="$(PNETCDF)" \
	  PIO="$(PIO)" FC="$(FC)" CC="$(CC)" SFC="$(SFC)" SCC="$(SCC)" \
	  CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" FCINCLUDES="$(FCINCLUDES)" )

mpas: reg_includes externals frame ops dycore drver
	ar ru lib$(CORE).a framework/*.o
	ar ru lib$(CORE).a operators/*.o
	ar ru lib$(CORE).a core_$(CORE)/*.o
	ar ru lib$(CORE).a $(CORE)_cesm_driver/*.o

externals: 



More information about the mpas-developers mailing list