[mpas-developers] Building MPAS with external libraries

Hoffman, Matthew J mhoffman at lanl.gov
Tue May 1 09:06:00 MDT 2012


Hi Everyone,

As you may have noticed, the land ice core is being actively developed in a branch, and we will be thinking about merging our branch into the trunk relatively soon (weeks to months).  The land ice core includes options to use external libraries to solve higher-order approximations of the ice sheet momentum balance.  These libraries are part of the LifeV project (http://www.lifev.org/) and are written in C++ by researchers at Florida State University, University of South Carolina, and the Chinese Academy of Sciences (primarily Mauro Perego and Wei Leng).

Leveraging the work of these other groups has allowed us to make rapid progress on developing the land ice core. However, including the external libraries will require modifying the build system of MPAS, and I am writing to propose a modification to the existing build system to allow this.  We recognize that the modification cannot be core-specific and should be extensible to other situations.  

The external libraries need to be linked when the land_ice_model.exe executable is built in src/Makefile on line 6:
 6         $(FC) $(LDFLAGS) -o $(CORE)_model.exe driver/*.o -L. -ldycore -lops -lframework $(LIBS) -I./external/esmf_time_f90 -L./external/esmf_time_f90 -lesmf_time
Therefore, the specification of the needed external libraries cannot be confined to the Makefile in src/core_land_ice.

My proposal (with some consultation from Doug) is to allow the root Makefile to accept an optional command-line argument (or environment variable) called MPAS_EXTERNAL_LIBS.  If this variable is specified, then those external libraries will be provided for linking (recursively to src/Makefile); if the variable is absent, the build process remains unchanged.  Specifically, this would be implemented by adding the following code in the root Makefile (e.g. after the check for NetCDF 4 occurs and before the definition of 'all' at line 273):

####################################################
# Section for adding external libraries and includes
####################################################
ifdef MPAS_EXTERNAL_LIBS
   LIBS += $(MPAS_EXTERNAL_LIBS)
endif
ifdef MPAS_EXTERNAL_INCLUDES
   CPPINCLUDES += $(MPAS_EXTERNAL_INCLUDES)
   FCINCLUDES += $(MPAS_EXTERNAL_INCLUDES)
endif
####################################################


In our situation we do not need external includes, but I have added that for completeness.  I have implemented this in the root Makefile in our branch, and it suits our needs.  This approach is extensible - for example, LifeV requires Trilinos, and we provide libraries for both with this method.

I'd like to open a discussion on this topic, and to put a time limit on it, I propose we come to a consensus by the end of the week (Friday, May 4), at which point I would commit the change to the trunk.    

Thanks!

Matt Hoffman


> 



More information about the mpas-developers mailing list