ESMF Code Generation with Cupid Update and Demo October 2009 Rocky Dunlap Spencer Rugaber Leo Mark...
-
Upload
donald-fitzgerald -
Category
Documents
-
view
213 -
download
0
Transcript of ESMF Code Generation with Cupid Update and Demo October 2009 Rocky Dunlap Spencer Rugaber Leo Mark...
ESMF Code Generationwith CupidUpdate and DemoOctober 2009
Rocky DunlapSpencer RugaberLeo MarkGeorgia Tech College of Computing
Goals•Cupid supports programmers of
numerical Earth System Models by:▫Raising the level of abstraction so that
modelers can think and code in terms of ESM vocabulary—not in terms of low or intermediate level programming constructs
▫Validating coupling configurations at compile time; providing error messages
▫Automatically generating FORTRAN code for coupling Earth System Modeling Framework (ESMF) components
Process Overview – Inputs & Outputs•You have:
▫Fortran source code for two (or more) ESMF Gridded Components
•You put in:▫A description of those components▫A description of a coupling configuration: composition, schedule, and deployment
•You get out:▫Fortran source code for an ESMF driver
and an ESMF coupler component
Cupid Architecture
ESMF Conceptual Model (ECM)
ECM Modeling GUI
ESMF Conceptual Modeling
ESMF Configuration InstanceESMF Configuration InstanceESMF Configuration Instances (ECIs)
ESMF Driver Generator
ESMF Code Generation
ESMF Coupler Generator
Java Fortran Object Model (JFOM)
FORTRAN Code Generation
JFOM InstancesJFOM InstancesJFOM Instances
StringTemplate Eclipse Modeling Framework (EMF)
Textual syntax and text editor (based on Xtext)
Cupid Architecture
ESMF Conceptual Model (ECM)
ECM Modeling GUI
ESMF Conceptual Modeling
ESMF Configuration Instances (ECIs)
ESMF Driver Generator
ESMF Code Generation
ESMF Coupler Generator
Java Fortran Object Model (JFOM)
FORTRAN Code Generation
JFOM Instances
StringTemplate Eclipse Modeling Framework (EMF)
Textual syntax and text editor (based on Xtext)
Cupid Architecture
ESMF Conceptual Modeling
ESMF Configuration Instances (ECIs)
ESMF Driver Generator
ESMF Code Generation
ESMF Coupler Generator
Java Fortran Object Model (JFOM)
FORTRAN Code Generation
JFOM Instances
StringTemplate Eclipse Modeling Framework (EMF)
Textual syntax and text editor (based on Xtext)
ESMF Conceptual Model (ECM)
ECM Modeling GUI
The ESMF Conceptual Model (ECM)• A conceptual model of ESMF API:
▫Gridded and Coupler Component, Import/Export State
▫Virtual Machine, PETs, DELayout▫DistGrid, Array▫Field, Grid (partial)▫Not included (yet): Clock, Calendar
• Also includes new structures for describing coupling configurations:▫Composition – how the components are connected▫Schedule – order of execution of components▫Deployment – map components to physical
resources
Graphical Modeling
Cupid Architecture
ESMF Conceptual Model (ECM)
ECM Modeling GUI
ESMF Conceptual Modeling
ESMF Configuration Instances (ECIs)
ESMF Driver Generator
ESMF Code Generation
ESMF Coupler Generator
Java Fortran Object Model (JFOM)
FORTRAN Code Generation
JFOM Instances
StringTemplate Eclipse Modeling Framework (EMF)
Textual syntax and text editor (based on Xtext)
Textual Syntax
Cupid Architecture
ESMF Conceptual Model (ECM)
ECM Modeling GUI
ESMF Conceptual Modeling
ESMF Configuration Instances (ECIs)
ESMF Code Generation
Java Fortran Object Model (JFOM)
FORTRAN Code Generation
JFOM Instances
StringTemplate Eclipse Modeling Framework (EMF)
Textual syntax and text editor (based on Xtext)
ESMF Driver Generator
ESMF Coupler Generator
System Architecture
ESMF Conceptual Model (ECM)
ECM Modeling GUI
ESMF Conceptual Modeling
ESMF Configuration Instances (ECIs)
ESMF Code Generation
FORTRAN Code Generation
StringTemplate Eclipse Modeling Framework (EMF)
Textual syntax and text editor (based on Xtext)
ESMF Driver Generator
ESMF Coupler Generator
Java Fortran Object Model (JFOM)
JFOM InstancesJFOM InstancesJFOM Instances
System Architecture
ESMF Conceptual Model (ECM)
ECM Modeling GUI
ESMF Conceptual Modeling
ESMF Configuration Instances (ECIs)
ESMF Code Generation
FORTRAN Code Generation
StringTemplate Eclipse Modeling Framework (EMF)
Textual syntax and text editor (based on Xtext)
ESMF Driver Generator
ESMF Coupler Generator
Java Fortran Object Model (JFOM)
JFOM Instances
Building a Coupling Configuration•There are two ways to create a coupling
configuration (ESMF Configuration Instance):▫Graphically using a tree-based model
editor▫Using a textual syntax and Eclipse-based
editor•At the end of the day, both are
represented as instances of the ESMF Conceptual Model.▫The two formats are interchangeable
Case Studies•ESMF_ArrayRedistSTest
▫Two components, one-way coupling▫user_model1 populates 100x150 global array▫user_model2 verifies array data▫user_model1 runs on 4 processors (PETs) with a
4x1 DELayout (i.e., four 25x150 local arrays)▫user_model2 runs on 2 PETs with a 1x2
DELayout (i.e., two 100x75 local arrays)•ESMF_FieldSparseMatMulSTest
▫Similar to above except data is packaged in Fields and redistribution is done via ESMF_ArraySMM
Demo
Models and Instances
ESMF Conceptual Model (ECM)
ESMF Configuration Instance (ECI)
Java Fortran Object Model
(JFOM)
JFOM Instance
FORTRAN 90ISO Standard
FORTRANsource code
Model level
Instance level
transform transform
conform
Current Status
•ECM is partially complete (~70%)▫missing some elements from the ESMF API
• JFOM is partially complete (~33%)▫missing FORTRAN constructs
•Code generator is “rigid”▫geared toward the two system test cases▫needs to be stretched with real world
models•Hurdles
▫How to best represent interpolation weights for Sparse Matrix Multiply.
Future Work
•Examples, examples, examples▫Need to generate couplers for more
realistic models•Discussions with modelers/scientists
▫How can code generation increase productivity, simplify coding, and enhance model understanding?
•Coupling in general▫What are the hard parts of coupling
models? How can this system address them?
Thanks!Questions?
code generationSpringtime has finally come
a happy climate
Additional slides
Existing Infrastructure Pieces• Eclipse Modeling Framework
▫http://www.eclipse.org/emf/▫“…a modeling framework and code generation
facility for building tools and other applications based on a structured data model”
▫Models are built using a UML-like, object-oriented metamodel called Ecore
• StringTemplate▫http://www.stringtemplate.org/▫a Java-based template engine for generating
formatted text output▫templates are strings with “holes” that can be
populated programmatically and then output
JFOM: Fortran Conceptual Model•ECIs are input to the code generation
phase. We need an API for manipulating Fortran programs.
•Java Fortran Object Model (JFOM)▫built with the Eclipse Modeling Framework▫a set of Java classes that represent the
syntactic structures of Fortran programs▫based on the Fortran 90 grammar▫allows programmatic manipulation of
Fortran programs•JFOM instances are serialized with
StringTemplate
JFOM Classes
JFOM classes represent the syntactic structures of Fortran 90
Generated Code Examples
•Examples of generated code can be found here:
•http://swiki.cc.gatech.edu:8080/Curator/49