Title: Turning ESMF Components into CCA Components
1Turning ESMF Components into CCA Components
- Arlindo da Silva, NASA/GSFC Data Assimilation
Office - Shujia Zhou, TASC NASA ESTO CT
- Data Assimilation Office, NASA/GSFC
Components Workshop, GFDL, 14 May 2003
2Acknowledgements
- Portions adapted from CCA Forum Tutorial of 15
Jan 2003 available from - http//www.cca-forum.org/tutorials/
- CCA Forum Tutorial WG
- Rob Armstrong, David Bernholdt, Wael Elwasif,
Lori Freitag, Dan Katz, Jim Kohl, Gary Kumfert,
Lois Curfman McInnes, Boyana Norris, Craig
Rasmussen, Jaideep Ray, Torsten Wilde - ANL, JPL, LANL, LLNL, ORNL, SNL
3Outline
- Goals of the project
- What is Common Component Architecture (CCA)?
- Overview of key CCA concepts
- ESMF components in a nutshell
- Language interoperability issues
- Prototype simple ocean/atmosphere coupled
system - Next step Cane-Zebiak model
4Goals of the Project
- Given Earth system models developed under Earth
System Modeling Framework (ESMF), explore
interoperability with alternative architectures,
in particular - Common Component Architecture (CCA)
- Use CCA-compliant framework such as Ccaffeine to
assemble climate applications based on ESMF
components, carrying out sample simulations - Document process of turning ESMF components into
CCA components
5 Component Architectures
- Existing component architecture standards such as
CORBA, COM/DCOM, and JavaBeans/EJB, are widely
used in commercial industry. - They do not support efficient parallel
communication channels between components - Existing high-performance frameworks such as
POOMA and Overture are object-oriented, but are
not based on peer components - Rather, components are viewed as elements in an
inheritance hierarchy
6What is the CCA?
- A component model specifically designed for
high-performance computing - Support HPC languages (Babel)
- Support parallel as well as distributed execution
models - Minimize performance overhead
- Minimalist approach makes it easier to
componentize existing software - Component interactions are not merely dataflow
- Components are peers
- No particular component assumes it is in
charge of the others. - Allows the application developer to decide what
is important.
7CCA Concepts Ports
FunctionPort
FunctionPort
IntegratorPort
NonlinearFunction
MidpointIntegrator
- Components interact through well-defined
interfaces, or ports - In OO languages, a port is a class or interface
- In Fortran, a port is a bunch of subroutines or a
module - Components may provide ports implement the
class or subroutines of the port - Components may use ports call methods or
subroutines in the port - Links denote a caller/callee relationship, not
dataflow! - e.g., FunctionPort could contain evaluate(in
Arg, out Result)
8Components and Ports in the Integrator Example
FunctionPort
FunctionPort
IntegratorPort
NonlinearFunction
FunctionPort
MidpointIntegrator
IntegratorPort
GoPort
LinearFunction
FunctionPort
Driver
FunctionPort
IntegratorPort
PiFunction
RandomGeneratorPort
RandomGeneratorPort
MonteCarloIntegrator
RandomGenerator
9An Application Built from the Example Components
FunctionPort
FunctionPort
IntegratorPort
NonlinearFunction
FunctionPort
MidpointIntegrator
IntegratorPort
GoPort
LinearFunction
FunctionPort
Driver
FunctionPort
IntegratorPort
PiFunction
RandomGeneratorPort
RandomGeneratorPort
MonteCarloIntegrator
RandomGenerator
10Another Application
FunctionPort
FunctionPort
IntegratorPort
NonlinearFunction
FunctionPort
MidpointIntegrator
IntegratorPort
GoPort
LinearFunction
FunctionPort
Driver
FunctionPort
IntegratorPort
PiFunction
RandomGeneratorPort
RandomGeneratorPort
MonteCarloIntegrator
RandomGenerator
11And Many More
Dashed lines indicate alternate connections
FunctionPort
FunctionPort
IntegratorPort
NonlinearFunction
FunctionPort
MidpointIntegrator
IntegratorPort
GoPort
LinearFunction
FunctionPort
Driver
FunctionPort
IntegratorPort
PiFunction
RandomGeneratorPort
RandomGeneratorPort
MonteCarloIntegrator
Create different applications in "plug-and-play"
fashion
RandomGenerator
12CCA Frameworks
- The framework provides the means to hold
components and compose them into applications - The framework is often applications main or
program - Frameworks allow exchange of ports among
components without exposing implementation
details - Frameworks provide a small set of standard
services to components - BuilderServices allow programs to compose CCA
apps - Frameworks may make themselves appear as
components in order to connect to components in
other frameworks
13The Lifecycle of a CCA Component
- User instructs framework to load and instantiate
components - User instructs framework to connect uses ports to
provides ports - Code in components uses functions provided by
another component - Ports may be disconnected
- Component may be destroyed
14CCA Concepts Direct Connection
- Components loaded into separate namespaces in the
same address space (process) from shared
libraries - getPort call returns a pointer to the ports
function table - Calls between components equivalent to a C
virtual function call lookup function location,
invoke - Cost equivalent of 2.8 F77 or C function calls
15ESMF Components
- ESMF Gidded Components are most likely
implemented in F90, e.g. - Module ATM_GridComp
- Public
- ATM_SetServices()
- Private
- ATM_Initialize()
- ATM_Run()
- ATM_Finalize()
These are saved In function pointer Table by
ATM_SetServices()
16ESMF F90 Application
- User code is called via ESMF routines of similar
name - Type(ESMF_GridComp) gcATM
- gcATM ESMF_GridCompCreate()
- Call ESMF_GridCompSetServices(gcATM,)
- Call ESMF_GridCompInitialize(gcATM,)
- Call ESMF_GridCompRun(gcATM,)
- Call ESMF_GridCompFinalize(gcATM,)
- C bindings exist for each ESMF_ rountine
- Therefore, a C interface automatically exists
for any user written F90 component
17ESMF on CCA Approach
- Use ESMF language interoperability feature to
interface to CCA in C - No need to instrument user code with complex
BABEL machinery (F90 not yet supported), or CHASM - For a typical ocean-atmosphere coupled system one
needs to write CCA wrappers for 4 components - Gridded Components OCN, ATM
- Couplers OCNxATM, ATMxOCN
18Wrapping an ESMF Component for CCA
CCA_Comp
ESMC_Comp
FTable
CCA_Driver
ESMC_CompInitialize ESMC_CompRun ESMC_CompFinalize
ATM-gtRun()
ATM is the instance of CCA_ESMF_Comp CCA_Comp
is assembled with ESMF utilities and is
compiled as .so
User_ATM
User_ATMInitialize User_ATMRun User_ATMFinalize
19Component Relationship via CCA Wiring
ATM
OCN
Port link
Data flow