CCA Common Component Architecture CCA Forum Tutorial Working Group Language Interoperable.

Slides:



Advertisements
Similar presentations
Institute of Computer Science AGH Towards Multilanguage and Multiprotocol Interoperability: Experiments with Babel and RMIX Maciej Malawski, Daniel Harężlak,
Advertisements

Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
CCA Common Component Architecture CCA Forum Tutorial Working Group Language Interoperable.
Gary Kumfert Center for Applied Scientific Computing is not a framework… but it makes frameworks better This work was performed under the auspices of the.
Tammy Dahlgren, Tom Epperly, Scott Kohn, and Gary Kumfert Center for Applied Scientific Computing Common Component Architecture Working Group October 3,
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Divorcing Language Dependencies from a Scientific Software Library Gary Kumfert, with Scott Kohn, Jeff Painter, & Cal Ribbens LLNLVaTech.
II. Middleware for Distributed Systems
TerascaleSimulation Tools and Technologies Tutorial: Presenter Institution.
Abstract Data Types and Encapsulation Concepts
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
Center for Component Technology for Terascale Simulation Software 122 June 2002Workshop on Performance Optimization via High Level Languages and Libraries.
1 Namespaces and Assemblies © University of Linz, Institute for System Software, 2004 published under the Microsoft Curriculum License.
Gary Kumfert with Bill Bosl, Tammy Dahlgren, Tom Epperly, Scott Kohn, & Steve Smith Achieving Language Interoperability with.
Bacon A Penetration and Auditing Framework Hernan Gips
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
A Hybrid Decomposition Scheme for Building Scientific Workflows Wei Lu Indiana University.
Tamara Dahlgren, Tom Epperly, Scott Kohn, & Gary Kumfert Center for Applied Scientific Computing.
CCA Common Component Architecture 1**1** Components for High Performance Computing: Common Component Architecture Rob Armstrong & CCA Working.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
CCA Common Component Architecture CCA Forum Tutorial Working Group 1 Welcome to the Common.
Java Introduction to JNI Prepared by Humaira Siddiqui.
CCA Common Component Architecture CCA Forum Tutorial Working Group Contributors: Language Interoperability Using Gary.
Writing Perl Extensions: There’s more than one way to do it.
Tammy Dahlgren with Tom Epperly, Scott Kohn, and Gary Kumfert Center for Applied Scientific Computing Common Component Architecture Working Group October.
CCA Common Component Architecture CCA Forum Tutorial Working Group Introduction to Components.
Grid Computing Research Lab SUNY Binghamton 1 Plans for Babelizing XCAT-C++ Madhu Govindaraju Kenneth Chiu.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.
Advanced BioPSE NCRR Dynamic Compilation Joint Session #1: Advanced BioPSE/SCIRun.
Grid Computing Research Lab SUNY Binghamton 1 XCAT-C++: A High Performance Distributed CCA Framework Madhu Govindaraju.
JCMP: Linking Architecture with Component Building Guoqing Xu, Zongyuan Yang and Haitao Huang Software Engineering Lab, East China Normal University SACT-01,
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Center for Component Technology for Terascale Simulation Software CCA is about: Enhancing Programmer Productivity without sacrificing performance. Supporting.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Tammy Dahlgren, Tom Epperly, Scott Kohn, & Gary Kumfert.
Scott Kohn with Tammy Dahlgren, Tom Epperly, and Gary Kumfert Center for Applied Scientific Computing Lawrence Livermore National Laboratory October 2,
Programming in Java CSCI-2220 Object Oriented Programming.
Update on CORBA Support for Babel RMI Nanbor Wang and Roopa Pundaleeka Tech-X Corporation Boulder, CO Funded by DOE OASCR SBIR.
CCA Common Component Architecture CCA Forum Tutorial Working Group This work is licensed.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
CCA Common Component Architecture CCA Forum Tutorial Working Group CCA Status and Plans.
CCA Common Component Architecture CCA Forum Tutorial Working Group 1 Welcome to the Common.
BioPSE NCRR SCIRun2 -THE PROJECT -OBJECTIVES -DEVELOPMENTS -TODAY -THE FUTURE.
Getting Started with SIDL using the ANL SIDL Environment (ASE) ANL SIDL Team MCS Division, ANL April 2003 The ANL SIDL compilers are based on the Scientific.
Tammy Dahlgren, Tom Epperly, Scott Kohn, & Gary Kumfert.
Duke CPS From C++ to Java l Java history: Oak, toaster-ovens, internet language, panacea l What it is ä O-O language, not a hybrid (cf. C++)
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
CCA Common Component Architecture CCA Forum Tutorial Working Group Common Component Architecture.
.NET Mobile Application Development XML Web Services.
Gary Kumfert & Scott Kohn Tammy Dahlgren, Tom Epperly, Steve Smith, and Bill Bosl Introducing...
CCA Common Component Architecture CCA Forum Tutorial Working Group Writing Components.
CCA Common Component Architecture CCA Forum Tutorial Working Group A Simple CCA Component Application.
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
CCA Common Component Architecture CCA Forum Tutorial Working Group Contributors: Introduction to the Ccaffeine Framework.
CCA Common Component Architecture CCA Forum Tutorial Working Group Writing Components.
CCA Common Component Architecture CCA Forum Tutorial Working Group Writing Components.
CCA Distributed Framework Interoperability. Goals Assume you have two (or more) framework instances. –Assume it contains a network of component instances.
CCA Common Component Architecture CCA Forum Tutorial Working Group Common Component Architecture.
CCA Common Component Architecture CCA Forum Tutorial Working Group A Simple CCA Component.
Chapter 3: Using Methods, Classes, and Objects
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
Programming Language Concepts (CIS 635)
Introduction to C# AKEEL AHMED.
Java Programming Language
Common Component Architecture (CCA)
Presentation transcript:

CCA Common Component Architecture CCA Forum Tutorial Working Group Language Interoperable CCA Components via

CCA Common Component Architecture Babel 2 Goal of This Module Legacy codes  Babelized CCA Components Introduction To: –Babel –SIDL See Babel in use –“Hello World” example –Legacy Code (Babel-wrapped MPI) –CCA Tutorial Example (Numerical Integration) Relationship between Babel & CCA

CCA Common Component Architecture Babel 3 What I mean by “Language Interoperability” Simulation Framework (C) Solver Library (C++) Numerical Routines (f77) Scripting Driver (Python) Visualization System (Java) Callback Handlers (Python) Callback Handlers (Python)

CCA Common Component Architecture Babel 4 One reason why mixing languages is hard Native cfortran.h SWIG JNI Siloon Chasm Platform Dependent C C++ f77 f90 Python Java

CCA Common Component Architecture Babel 5 Babel makes all supported languages peers C C++ f77 f90 Python Java Once a library has been “Babelized” it is equally accessable from all supported languages This is not a Lowest Common Denominator Solution!

CCA Common Component Architecture Babel 6 Babel Module’s Outline Introduction Babel Basics –How to use Babel in a “Hello World” Example –SIDL Grammar –Example: Babel & Legacy Code Babel & CCA –Relationship between them –How to write a Babelized CCA Component

CCA Common Component Architecture Babel 7 Babel’s Two Parts: Code Generator + Runtime Library SIDL interface description Babel Compiler C++ F77 F90 Python C XML Matlab? Java Babel Runtime Application

CCA Common Component Architecture Babel 8 greetings.sidl: A Sample SIDL File package greetings version 1.0 { interface Hello { void setName( in string name ); string sayIt ( ); } class English implements-all Hello { } } package greetings version 1.0 { interface Hello { void setName( in string name ); string sayIt ( ); } class English implements-all Hello { } }

CCA Common Component Architecture Babel 9 Library Developer Does This... 1.`babel --server=C++ greetings.sidl` 2.Add implementation details 3.Compile & Link into Library/DLL SIDL interface description Babel Compiler C++ Skels C++ Impls IORs C++ Stubs libgreetings.so

CCA Common Component Architecture Babel 10 Adding the Implementation string greetings::English_impl::sayIt() throw () { // DO-NOT-DELETE splicer.begin(greetings.English.sayIt) string msg(“Hello “); return msg + d_name + “!”; // DO-NOT-DELETE splicer.end(greetings.English.sayIt) } string greetings::English_impl::sayIt() throw () { // DO-NOT-DELETE splicer.begin(greetings.English.sayIt) string msg(“Hello “); return msg + d_name + “!”; // DO-NOT-DELETE splicer.end(greetings.English.sayIt) } namespace greetings { class English_impl { private: // DO-NOT-DELETE splicer.begin(greetings.English._impl) string d_name; // DO-NOT-DELETE splicer.end(greetings.English._impl) namespace greetings { class English_impl { private: // DO-NOT-DELETE splicer.begin(greetings.English._impl) string d_name; // DO-NOT-DELETE splicer.end(greetings.English._impl)

CCA Common Component Architecture Babel 11 Library User Does This... 1.`babel --client=F90 greetings.sidl` 2.Compile & Link generated Code & Runtime 3.Place DLL in suitable location SIDL interface description Babel Compiler IOR Headers F90 Stubs libgreetings.so Babel Runtime Application

CCA Common Component Architecture Babel 12 F90/Babel “Hello World” Application program helloclient use greetings_English implicit none type(greetings_English_t) :: obj character (len=80) :: msg character (len=20) :: name name=’World’ call new( obj ) call setName( obj, name ) call sayIt( obj, msg ) call deleteRef( obj ) print *, msg end program helloclient program helloclient use greetings_English implicit none type(greetings_English_t) :: obj character (len=80) :: msg character (len=20) :: name name=’World’ call new( obj ) call setName( obj, name ) call sayIt( obj, msg ) call deleteRef( obj ) print *, msg end program helloclient These subroutines come from directly from the SIDL These subroutines come from directly from the SIDL Some other subroutines are “built in” to every SIDL class/interface Some other subroutines are “built in” to every SIDL class/interface

CCA Common Component Architecture Babel 13 SIDL Grammar (1/3): Packages and Versions Packages can be nested Versioned Packages –defined as packages with explicit version number OR packages enclosed by a versioned package –Reentrant by default, but can be declared final –May contain interfaces, classes, or enums Unversioned Packages –Can only enclose more packages, not types –Must be re-entrant. Cannot be declared final package foo version 0.1 { package bar {... } }

CCA Common Component Architecture Babel 14 SIDL Grammar (2/3): Classes & Interfaces SIDL has 3 user-defined objects –Interfaces – APIs only, no implementation –Abstract Classes – 1 or more methods unimplemented –Concrete Classes – All methods are implemented Inheritance (like Java/Objective C) –Interfaces may extend Interfaces –Classes extend no more than one Class –Classes can implement multiple Interfaces Only concrete classes can be instantiated

CCA Common Component Architecture Babel 15 SIDL Grammar (3/3): Methods and Arguments Methods are public virtual by default –static methods are not associated with an object instance –final methods can not be overridden Arguments have 3 parts –Mode: can be in, out, or inout (like CORBA, but semantically different than F90) –Type: one of (bool, char, int, long, float, double, fcomplex, dcomplex, array, enum, interface, class ) –Name

CCA Common Component Architecture Babel 16 Babelizing Legacy Code 1.Write your SIDL interface 2.Generate server side in your native langauge 3.Edit Implementation (Impls) to dispatch to your code (Do NOT modify the legacy library itself!) 4.Compile & Link into Library/DLL mycode.sidl Babel Compiler Skels Impls IORs Stubs libmycode.so legacy_library.so

CCA Common Component Architecture Babel 17 Known Projects Using Babel (see for more) I implemented a Babel-based interface for the hypre library of linear equation solvers. The Babel interface was straightforward to write and gave us interfaces to several languages for less effort than it would take to interface to a single language. --Jeff Painter, LLNL. research.cs.vt.edu/lacsa

CCA Common Component Architecture Babel 18 Babel & Legacy Code (e.g. MPI) package mpi version 2.0 { class Comm { int send[Int]( in array data, in int dest, in int tag );... } package mpi version 2.0 { class Comm { int send[Int]( in array data, in int dest, in int tag );... } mpi.sidl

CCA Common Component Architecture Babel 19 Babel & Legacy Code (e.g. MPI) struct mpi_Comm__data { /* DO-NOT-DELETE splicer.begin(mpi.Comm._data) */ MPI_Comm com; /* DO-NOT-DELETE splicer.end(mpi.Comm._data) */ }; struct mpi_Comm__data { /* DO-NOT-DELETE splicer.begin(mpi.Comm._data) */ MPI_Comm com; /* DO-NOT-DELETE splicer.end(mpi.Comm._data) */ }; mpi_comm_Impl.h int32_t impl_mpi_Comm_sendInt( mpi_Comm self, SIDL_int__array data, int32_t dest, int32_t tag ) { /* DO-NOT-DELETE splicer.begin(mpi.Comm.sendInt) */ struct mpi_Comm__data *dptr = mpi_Comm__get_data( self ); void * buff = (void*) SIDL_int__array_first(data); int count = length(data); return mpi_send( buff, count, MPI_INT, dest, tag, dptr->comm); /* DO-NOT-DELETE splicer.end(mpi.Comm.sendInt) */ } int32_t impl_mpi_Comm_sendInt( mpi_Comm self, SIDL_int__array data, int32_t dest, int32_t tag ) { /* DO-NOT-DELETE splicer.begin(mpi.Comm.sendInt) */ struct mpi_Comm__data *dptr = mpi_Comm__get_data( self ); void * buff = (void*) SIDL_int__array_first(data); int count = length(data); return mpi_send( buff, count, MPI_INT, dest, tag, dptr->comm); /* DO-NOT-DELETE splicer.end(mpi.Comm.sendInt) */ } mpi_comm_Impl.c

CCA Common Component Architecture Babel 20 Investing in Babelization can improve the interface to the code. “When Babelizing LEOS [an equation of state library at LLNL], I completely ignored the legacy interface and wrote the SIDL the way I thought the interface should be. After running Babel to generate the code, I found all the hooks I needed to connect LEOS without changing any of it. Now I’ve got a clean, new, object-oriented python interface to legacy code. Babel is doing much more than just wrapping here.” -- Charlie Crabb, LLNL (conversation)

CCA Common Component Architecture Babel 21 Babel Module’s Outline Introduction Babel Basics –How to use Babel in a “Hello World” Example –SIDL Grammar –Example: Babel & Legacy Code Babel & CCA –Relationship between them –How to write a Babelized CCA Component

CCA Common Component Architecture Babel 22 SCIRun2 History of Babel & CCA XCAT (Indiana) SciRUN (Utah) Ccaffeine (SNL) Babel (LLNL) Tutorial Frameworks Language Interoperability Applications Data MxN Decaf Babelized Frameworks t Ccaffeine

CCA Common Component Architecture Babel 23 The CCA Spec is a SIDL File package gov { package cca version { interface Port { } interface Component { void setServices( in Services svcs ); } interface Services { Port getPort( in string portName ); registerUsesPort( /*etc*/ ); addProvidesPort( /*etc*/ ); /*etc*/ package gov { package cca version { interface Port { } interface Component { void setServices( in Services svcs ); } interface Services { Port getPort( in string portName ); registerUsesPort( /*etc*/ ); addProvidesPort( /*etc*/ ); /*etc*/

CCA Common Component Architecture Babel 24 The CCA from Babel’s POV

CCA Common Component Architecture Babel 25 Decaf: Details & Disclaimers Babel is a hardened tool Decaf is an example, not a product –Distributed in “examples” subdirectory of Babel –Decaf has no GUI Decaf is CCA compliant –Babelized CCA Components can be loaded into Decaf, CCAFFEINE, and SCIRun2 “Understanding the CCA Specification Using Decaf” cs/decaf.pdf cs/decaf.pdf

CCA Common Component Architecture Babel 26 How I Implemented Decaf 1.wrote decaf.sidl file 2.`babel --server=C++ cca.sidl decaf.sidl` 3.Add implementation details 4.Compile & Link into Library/DLL cca.sidl & decaf.sidl Babel Compiler C++ Skels C++ Impls IORs C++ Stubs libdecaf.so

CCA Common Component Architecture Babel 27 How to Write and Use Babelized CCA Components 1.Define “Ports” in SIDL 2.Define “Components” that implement those Ports, again in SIDL 3.Use Babel to generate the glue-code 4.Write the guts of your component(s)

CCA Common Component Architecture Babel 28 How to Write A Babelized CCA Component (1/3) 1.Define “Ports” in SIDL –CCA Port = a SIDL Interface extends gov.cca.Port package functions version 1.0 { interface Function extends gov.cca.Port { double evaluate( in double x ); } package functions version 1.0 { interface Function extends gov.cca.Port { double evaluate( in double x ); }

CCA Common Component Architecture Babel 29 How to Write A Babelized CCA Component (2/3) 2.Define “Components” that implement those Ports –CCA Component = SIDL Class implements gov.cca.Component (& any provided ports) class LinearFunction implements functions.Function, gov.cca.Component { double evaluate( in double x ); void setServices( in cca.Services svcs ); } class LinearFunction implements functions.Function, gov.cca.Component { double evaluate( in double x ); void setServices( in cca.Services svcs ); } class LinearFunction implements-all functions.Function, gov.cca.Component { }

CCA Common Component Architecture Babel 30 Tip: Use Babel’s XML output like precompiled headers in C++ 1.precompile SIDL into XML --text=xml 2.store XML in a directory 3.Use Babel’s –R option to specify search directories cca.sidl Babel Compiler XML Type Repository functions.sidl Babel Compiler Skels Impls IORs Stubs

CCA Common Component Architecture Babel 31 How to Write A Babelized CCA Component (3/3) 3.Use Babel to generate the glue code –`babel --server=C –Rrepo function.sidl` 4.Add implementation details SIDL interface description Babel Compiler C Skels C Impls IORs C Stubs libfunction.so Repo (XML)

CCA Common Component Architecture Babel 32 To Use the Decaf Framework 1.`babel --client=Java –Rrepo function.sidl` 2.Compile & Link generated Code & Runtime 3.Place DLLs in suitable location SIDL files Babel Compiler IOR Headers Java Stubs Babel Runtime Application Repo (XML) component1.so libdecaf.so

CCA Common Component Architecture Babel 33 Limitations of Babel’s Approach to Language Interoperabilty Babel is a code generator –Do obscure tricks no one would do by hand –Don’t go beyond published language standards Customized compilers / linkers / loaders beyond our scope –E.g. icc and gcc currently don’t mix on Linux –E.g. No C++-style templates in SIDL. (Would require special linkers/loaders to generate code for template instantiation, like C++ does.) Babel makes language interoperability feasible, but not trivial –Build tools severely underpowered for portable multi- language codes

CCA Common Component Architecture Babel 34 What’s the Hardest Part of this Process? Properly building libraries for multi-language use Dynamically loadable.so files are especially error prone –Not a lot of understanding or expertise in community –Causality chain between improperly constructed DLLs and observed bugs is often inscrutable and misleading SIDL interface description Babel Compiler C Skels C Impls IORs C Stubs libfunction.so

CCA Common Component Architecture Babel 35 Summary Legacy codes  Babelized CCA Components Reclassify your objects in your legacy code –Things customers create  CCA components –Logical groups of a component’s functionality  CCA Port –Low level objects in your implementation  not exposed Generate SIDL File –CCA port  Babel Interface that extends the Babel interface called “gov.cca.Port” –CCA component  Babel Class that implements the Babel interface called “gov.cca.Component” (and possibly its “provides ports”) Run Babel (choose server-language for your code) Articulate Impl files to dispatch to legacy code

CCA Common Component Architecture Babel 36 Contact Info Project: –Babel: language interoperability tool –Alexandria: component repository –Quorum: web-based parliamentary system –Gauntlet (coming soon): testing framework Bug Tracking: Project Team Mailing Lists: subscribe babel-users [ address] subscribe babel-announce [ address]

CCA Common Component Architecture Babel 37 This work was performed under the auspices of the U.S. Department of Energy by the University of California, Lawrence Livermore National Laboratory under contract No. W-7405-Eng-48 UCRL-PRES , July 2002