Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cupid A Domain Specific Language for Coupled ESMs Rocky Dunlap Coupling Workshop 2013 1 Second Workshop on Coupling Technologies for Earth System Modeling.

Similar presentations


Presentation on theme: "Cupid A Domain Specific Language for Coupled ESMs Rocky Dunlap Coupling Workshop 2013 1 Second Workshop on Coupling Technologies for Earth System Modeling."— Presentation transcript:

1 Cupid A Domain Specific Language for Coupled ESMs Rocky Dunlap Coupling Workshop 2013 1 Second Workshop on Coupling Technologies for Earth System Modeling NCAR, Boulder, Colorado, February 20-22, 2013

2 Outline Motivation and Goals of Cupid Overview and Current Status Example Application Evaluation and Challenges Future Work 2

3 Motivation and Goals Earth System Modeling software is highly complex Much effort is spent dealing with accidental details of parallel programming, array manipulations, etc. Goal of Cupid: 3 Provide significant increases in modeler productivity by raising the level of abstraction of the coupling aspects of ESMs.

4 Different Kinds of Performance 4 # of nodes days simulated per hour papers published hours of effort model scalability modeler productivity

5 Form of ReuseProgramming TasksExample Technologies Software Libraries Instantiate library types; call library subroutines MCT, PSMILe (OASIS), OASIS-MCT Component Technologies Write explicit interfaces; implementation via traditional programming; composition via interface “wiring” CCA Frameworks Same as library + implement fine- grained, pre-defined interfaces (due to inversion of control) ESMF, CSDMS, OpenPALM Generative/ Domain- specific languages Programs written in a custom language with domain-specific concepts; textual or visual notations BFG XML, PrePALM (OpenPALM), Cupid How does the form of code reuse affect developer productivity? 5

6 6 General Purpose Language (Fortran 90) program module if, then, else, endif do, do while call integer, real, double precision dimension open, read continue, stop Domain Specific Language gridded component coupler component driver state decomposition grid, mesh field redist, regrid clock

7 Cupid Overview 7 Coupling Specification (Cupid DSL) Black box Generated Application (Fortran 90) Executable Cupid Compiler Fortran Compiler White box Maintenance ESMF link Black box

8 Domain Model and Constraints 8 self.fieldConnection->forAll( srcField.scope = self.srcComponent and dstField.scope = self.dstComponent)

9 Cupid Compiler 9 [template public genESMFInitMethod(c : ESMFGriddedComponent)] subroutine init_(comp, istate, ostate, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: istate type(ESMF_State) :: ostate type(ESMF_Clock) :: clock integer, intent(out) :: rc... [for (field : ESMFField | c.item->filter(ESMFField))] [field.name/] = ESMF_FieldCreate(grid=[field.grid.name/], arrayspec=[field.arraySpec.name/], & indexflag=[field.index/], & totalLWidth=[toFortranArrayConstructor(field.totalLWidth)/], & totalUWidth=[toFortranArrayConstructor(field.totalUWidth)/], & name="[field.name/]", rc=rc) [/for]... [/template] MOF Model to Text Transformation Language (OMG) http://www.omg.org/spec/MOFM2T/1.0/

10 Eclipse-based Implementation 10 Eclipse Modeling Framework Ecore Metamodel Acceleo Model to Text Photran Editor

11 Current Status 11 ESMF TypePublic API MethodsDSL Generated Calls ESMF_Array222 ESMF_ArraySpec41 ESMF_Clock202 ESMF_CplComp245 ESMF_DistGrid101 ESMF_Field279 ESMF_Grid183 ESMF_GridComp246 ESMF_State184 ESMF_Time161 ESMF_TimeInterval182 (Framework level)252 (12 Unsupported types) 1610 38738 Calls can be generated to ~10% of API methods. 11 of 23 ESMF types represented in DSL.

12 12 Case Study: ESMF Coupled Flow Demo

13 Caution: Some coding required! 13 Inserted Code reading namelists, setting parameters set up initial conditions and boundary conditions field updates for each timestep calls to halo operations Generated Code static superstructure instantiation of components, states, and fields populating import and export states calls to child components coupler component (redist or regrid) freeing memory Modified Code grid coordinates grid inheritance

14 Challenge: DSL Integration How to integrate with scientific code? Possible solutions: – Skeleton approach Developer fills in science implementation – Model interface approach A set of Fortran subroutines with model fields as subroutine arguments (à la BFG) Define interfaces using Scientific Interface Description Language (SIDL) Self-describing models (à la CSDMS BMI) 14

15 Challenge: Representing Behavior Static structural aspects are fairly easy to model – Parent-child relationship of components Behavioral (dynamic) aspects are more difficult – Populating an ESMF State object with different fields during different points of model execution Possible solutions – make behaviors implicit (e.g., all fields added during init, remain unchanged during run, removed during finalize) – introduce a behavioral modeling language (adds complexity!) 15

16 Conclusion 16 Superstructure Components and their composition; driving Science Field updates based on discrete form of PDEs Infrastructure Building blocks: grids, distributed fields, clocks, regrid, redistribution, I/O, configuration, etc. Different approaches and different tools are required to raise the abstraction level of each of these parts. DSL approach is viable for specifying some parts of the coupling infrastructure.

17 Future Work Cupid: An IDE for Model Development and Modeler Training NASA Computational Modeling Algorithms and Cyberinfrastructure (CMAC) Program Team –Georgia Institute of Technology (Dunlap/Mark/Rugaber) –University of Colorado/CIRES (DeLuca) –NASA Software Systems Support Office (Clune) –NASA GISS (Schmidt) Extend and harden existing DSL+generator into a student training environment for rapidly developing ESMF-based applications Incorporate more IDE features, including linking with an execution environment Modularize Model E and demonstrate in IDE 17

18 Thanks! 18

19 19

20 Domain Specific Languages Increase Productivity Nokia [1] mobile phone app development – 1000% increase in productivity – “shift focus from code to design” – “In many cases, we can generate 100% of the required code.” US Air Force Military Command and Control Systems [2] – 300% increase in productivity Lucent Product Family development [3] – initial productivity factor 3x-5x; 10x productivity increase for experts – graphical DSLs more successful than textual 20

21 Reuse Techniques 21 System Specification Generator Compositional (library, components, frameworks) Generative (domain-specific languages)

22 22 Coupling Specification Generator Hybrid Approach

23 Challenge: Domain Model There is no universal domain model for coupling – SQL came about after a formal definition of relational databases – Common Information Model (CIM)  currently defined as retrospective metadata – Jay Larson’s theory of coupling [4] 23

24 Domain Model Analysis 24 Strembeck, Mark, and Uwe Zdun. "An approach for the systematic development of domain‐specific languages." Software: Practice and Experience 39.15 (2009): 1253-1292. Earth System Modeling Framework (ESMF) Core Language Model Language Model Constraints Behavioral Model Approach: Extract DSL from an existing system

25 You Have Already Used DSLs DSLUse SQLQuery and manipulate relational databases Make, AntBuilding software systems MatlabScientific data analysis HTMLMarkup for web pages YACC, ANTLRParser generators LATEXTypesetting LabVIEWDesign of measurement and control systems 25

26 What kinds of domains benefit from DSLs? 26 Sprinkle, Jonathan, et al. "Guest Editors' Introduction: What Kinds of Nails Need a Domain-Specific Hammer?." IEEE Software 26.4 (2009): 15-18. The domain is well-defined40+ years of building coupled models The domain has repetitive elements or patterns, such as multiple products, features, or targets Emergence of reusable coupling software evidences common coupling requirements, designs, implementations Accuracy; expert involvement; and flexibility of the specification, verification, and validation of design are important Correct and verifiable coupling infrastructure is essential for scientific validity of model output The implementation or specification must serve as documentation Many ESMs are under-documented and often the code itself is the documentation. Amortization of effort justifies investment in DSL creation. Payoffs in terms of productivity increases when implementing new couplings Domain characteristicEvidence in ESM domain

27 Core Language Model 27

28 Core Language Model 28

29 Object Constraint Language 29 self.fieldConnection->forAll( srcField.scope = self.srcComponent and dstField.scope = self.dstComponent)

30 Implementation – Language Model Language model using Eclipse-based tools – classes, generalization/ specialization, abstract classes – type system – object references, containment – OCL constraints via annotations – automatic generation of model editor GUI 30

31 References 31 1.Kelly, Steven, and Juha-Pekka Tolvanen. "Visual domain-specific modeling: Benefits and experiences of using metaCASE tools." International workshop on Model Engineering, European Conference on Object-Oriented Programming (ECOOP) ed. J. Bezivin, J. Ernst. 2000. 2.Kieburtz, Richard B., et al. "A software engineering experiment in software component generation." Proceedings of the 18th international conference on Software engineering. IEEE Computer Society, 1996. 3.Weiss, D. M., and C. T. R. Lai. "Software product line engineering: a family based software engineering process." (1999). 4.J. Walter Larson, "Ten organising principles for coupling in multiphysics and multiscale models," ANZIAM J., 48, C1090-C1111 (2009).


Download ppt "Cupid A Domain Specific Language for Coupled ESMs Rocky Dunlap Coupling Workshop 2013 1 Second Workshop on Coupling Technologies for Earth System Modeling."

Similar presentations


Ads by Google