Tamara Dahlgren, Tom Epperly, Scott Kohn, & Gary Kumfert Center for Applied Scientific Computing.

Slides:



Advertisements
Similar presentations
COM vs. CORBA.
Advertisements

CCA Common Component Architecture CCA Forum Tutorial Working Group Language Interoperable.
Tammy Dahlgren, Tom Epperly, Scott Kohn, and Gary Kumfert Center for Applied Scientific Computing Common Component Architecture Working Group October 3,
Divorcing Language Dependencies from a Scientific Software Library Gary Kumfert, with Scott Kohn, Jeff Painter, & Cal Ribbens LLNLVaTech.
1 JBus, A Platform Independent Publish/Subscribe Bus for CWave 2000 M.S. Thesis Defense Joseph W. Longson March 30, 2000.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Introduction to Java Programming, 4E
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
Principles of Object-Oriented Software Development The language Java.
Advanced Object-Oriented Programming Features
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
II. Middleware for Distributed Systems
TerascaleSimulation Tools and Technologies Tutorial: Presenter Institution.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Programming Languages and Paradigms Object-Oriented Programming.
Common Object Request Broker Architecture (CORBA) CS-328.
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
Java and C++, The Difference An introduction Unit - 00.
Oracle8 JDBC Drivers Section 2. Common Features of Oracle JDBC Drivers The server-side and client-side Oracle JDBC drivers provide the same basic functionality.
GKK 1 CASC Recommended Viewing: Since this is a pictorial presentation, I’ve gone through the effort to type up what I normally say in the “notes” section.
Gary Kumfert with Bill Bosl, Tammy Dahlgren, Tom Epperly, Scott Kohn, & Steve Smith Achieving Language Interoperability with.
CCA Port, Component & Application Build Skeleton Templates “A new script toolkit for generating CCA build skeletons” Torsten Wilde and James Kohl Oak Ridge.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
CCA Common Component Architecture CCA Forum Tutorial Working Group Language Interoperable.
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
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.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Java Introduction to JNI Prepared by Humaira Siddiqui.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
CCA Common Component Architecture CCA Forum Tutorial Working Group Contributors: Language Interoperability Using Gary.
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
Tammy Dahlgren with Tom Epperly, Scott Kohn, and Gary Kumfert Center for Applied Scientific Computing Common Component Architecture Working Group October.
Introduction to Java Programming with Forte Y. Daniel Liang.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
SCIRun and SPA integration status Steven G. Parker Ayla Khan Oscar Barney.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Tammy Dahlgren, Tom Epperly, Scott Kohn, & Gary Kumfert.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Scott Kohn with Tammy Dahlgren, Tom Epperly, and Gary Kumfert Center for Applied Scientific Computing Lawrence Livermore National Laboratory October 2,
Update on CORBA Support for Babel RMI Nanbor Wang and Roopa Pundaleeka Tech-X Corporation Boulder, CO Funded by DOE OASCR SBIR.
 Common Object Request Broker Architecture  An industry standard developed by OMG to help in distributed programming.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
ASP.NET Web Services.  A unit of managed code installed under IIS that can be remotely invoked using HTTP.
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.
Ch 1. A Python Q&A Session. Why do people use Python? Software Quality Developer productivity Program portability Support Libraries Component integration.
Tammy Dahlgren, Tom Epperly, Scott Kohn, & Gary Kumfert.
Classes, Interfaces and Packages
Programming in java Packages Access Protection Importing packages Java program structure Interfaces Why interface Defining interface Accessing impln thru.
Gary Kumfert & Scott Kohn Tammy Dahlgren, Tom Epperly, Steve Smith, and Bill Bosl Introducing...
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Common Object Request Broker Architecture (CORBA)
Inheritance and Polymorphism
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
CMPE419 Mobile Application Development
Java Programming Language
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
CMPE419 Mobile Application Development
Presentation transcript:

Tamara Dahlgren, Tom Epperly, Scott Kohn, & Gary Kumfert Center for Applied Scientific Computing

GKK 2 CASC Audience Calibration  What is a component?  Who writes code?  Who uses code?  What languages used?  What platforms used?  # 3 rd party libraries your code uses?  # apps uses your libraries?

GKK 3 CASC Outline  Problem Motivation  Babel Solution Strategy  SIDL  Using Babel  Outstanding Problems  Future R&D

GKK 4 CASC Problem Motivation  Code Reuse is Hard.  Scientific Code Reuse is Harder!  Barriers to Reuse... Language Interoperability Semantics Software Portability Lack of Standards More...

GKK 5 CASC What I mean by “Language Interoperability” Simulation Framework (C) Solver Library (C++) Numerical Routines (f77) Scripting Driver (Python) Visualization System (Java) Callback Handlers (Python)

GKK 6 CASC Current Language Interoperability Native cfortran.h SWIG JNI Siloon Chasm Platform Dependent C C++ f77 f90 Python Java

GKK 7 CASC C C++ f77 f90 Python Java Babel Enabled Language Interoperability

GKK 8 CASC C C++ f77 f90 Python Java Babel Enabled Language Interoperability What’s in version 0.6?

GKK 9 CASC Outline  Problem Motivation  Babel Solution Strategy  SIDL  Using Babel  Outstanding Problems  Future R&D

GKK 10 CASC Developer Writes Interface  SIDL: Scientific Interface Definition Language  Similar to CORBA/COM IDLs... Language/Platform Independent ...but tuned for scientific apps complex numbers dynamic, multidimensional arrays SIDL interface description

GKK 11 CASC version MySolverLib 0.1.0; import ESI; package MySolverLib { interface MatrixGenerator {... } class OptionDatabase { void getOption( in string name, out string val ); } class Vector implements-all ESI.Vector { void setOptions( in OptionDatabase db ); } abstract class Bizarre implements MatrixGenerator { abstract int foo(); void setData( in array a ); }

GKK 12 CASC Babel Generates Glue Code SIDL interface description parseranalyzerbackend C++ F77 F90 Python machine configuration database XML repository interface description C XML Matlab? Java

GKK 13 CASC C C++ f77 f90 Python Java Babel Provides Uniform Object Model  Universal Base Classes  Virtual Method Dispatch  Exception Handling  Reference Counting...It all happens here!

GKK 14 CASC Babel Provides a Firewall Between Use and Implementation Application Impls Stubs Skels IORs SIDL interface description

GKK 15 CASC Outline  Problem Motivation  Babel Solution Strategy  SIDL  Using Babel  Outstanding Problems  Future R&D

GKK 16 CASC SIDL as a text-based design tool  Express only the public API  Prevents discussion drift into implementation details  Amenable to debates  Easier to learn than UML

GKK 17 CASC The SIDL Grammar  Packages & Versions  Interfaces & Classes  Inheritance Model  Methods  Polymorphism Modifiers  Intrinsic Data Types  Parameter Modes  Gotchas

GKK 18 CASC Packages  Use SIDL packages to prevent symbol conflicts packages in Java namespaces in C++ prefixes in C / Fortran (e.g. mpi_send() )  must have version number  lowercase symbols recommended  Can be nested  Versioning applies only to outermost package  Currently not reentrant by design version foo 1.0; package foo { //... }; package gov { package llnl { package babel { //... }; }; };

GKK 19 CASC Interfaces and Classes  ObjectiveC and Java Inheritance Model  Interfaces pure abstract base classes in C++ define calling sequence only provide no implementation cannot be instantiated can inherit (“extend”) other interfaces  Classes inherit (“extend”) from at most one class (including its implementation) may inherit (“implement”) multiple interfaces

GKK 20 CASC Interfaces and Classes (Example) version my 1.12; // import their; package my { interface Foo extends their.Foo { }; class CFoo implements Foo { }; class Bar extends CFoo implements their.Bar { }; class Baz extends CFoo implements their.Bar, their.Baz { }; }; version their 1.0; package their { interface Foo {/*.. */}; interface Bar {/*.. */}; interface Baz {/*.. */}; };

GKK 21 CASC Inheritance Model  Interfaces form contracts between implementor and user.  Default Inheritance: reference counting dynamic casting introspection reflection implements SIDL.BaseClass extends (classes) SIDL.BaseInterface extends (interfaces)

GKK 22 CASC Abstract Class– Partially Implemented Class interface Foo { int doThis( in int i ); int doThat( in int i ); } class Bar implements Foo { int doThis( in int i ); }; class Grille implements Foo { int doThis( in int i ); int doThat( in int i ); }; interface Foo { int doThis( in int i ); int doThat( in int i ); } abstract class Bar implements Foo { int doThis( in int i ); }; class Grille implements Foo { int doThis( in int i ); int doThat( in int i ); }; interface Foo { int doThis( in int i ); int doThat( in int i ); } abstract class Bar implements Foo { int doThis( in int i ); }; class Grille implements-all Foo { // int doThis( in int i ); // int doThat( in int i ); };

GKK 23 CASC Methods (a.k.a. “member functions”)  Belong to both Interfaces and Classes  SIDL has no sense of method “access” specifiers (e.g. private, protected, public) All methods in SIDL are public Makes sense for an “Interface Definition Language”  In practice, can make package and private methods.  In classes only, methods can also be static -- independent of an instance final -- not overridden by derived classes  No Method Overloading Yet.

GKK 24 CASC Method Modifiers  static avoid OOP altogether: make one class full of static methods.  final prevent function from being overridden In C++ u methods are final by default u must be declared “virtual” to be overridden class Math { static double sin( in double x ); static double cos( in double x ); };

GKK 25 CASC Intrinsic Data Types  Standard Types bool char int long float double fcomplex dcomplex  Advanced Types string enum object (interface or class) array opaque  NOTES: Mapped to different types in different languages No General Template Mechanism

GKK 26 CASC Parameter Modes  Unique to IDLs  Each parameter in a method call has a mode declared in out inout  Intent: Communication optimization for distributed components Copy minimization when copy is unavoidable  Benefit: Easy to understand intent when reading

GKK 27 CASC Parameter Modes II  “in” pass by value semantics (not const!)  “out” pass by reference semantics no initialization required information returned  “inout” pass by reference semantics initialization required new information returned instance may be destroyed and replaced

GKK 28 CASC Parameter Modes III package util { // SIDL FILE class String { static void reverse( inout string ); }; }; #include #include “util_String.h” int main () { char * hi = “Hello.”; util_String_reverse( &hi ) ; printf(“%s\n”, hi ); } DANGER: “inout” parameters may be destroyed and replaced under the covers. Do you want to risk a “free(hi);” in the stubs??? DANGER: “inout” parameters may be destroyed and replaced under the covers. Do you want to risk a “free(hi);” in the stubs???

GKK 29 CASC Parameter Modes IV package util { // SIDL FILE class String { static void appendReverse(inout string); }; }; #include #include “util_String.h” int main () { char * hi = “Hello.”; util_String_appendReverse( &hi ) ; printf(“%s\n”, hi ); }

GKK 30 CASC Parameter Modes V package util { // SIDL FILE class String { static void appendReverse(inout string); }; }; #include #include #include “util_String.h” int main () { char * hi = strdup( “Hello.” ); util_String_appendReverse( &hi ) ; printf(“%s\n”, hi ); free( hi ); }

GKK 31 CASC Babel Preserves DocComments // This is a comment /* This is a Comment Too */ /** This is a DocComment for the package */ package Hello { /** * This class has one method */ class World { /** result = “hello” + name */ string getMsg( in string name ); }; };

GKK 32 CASC SIDL Gotchas  Case Sensitive SIDL is F77 is not  Reserved Words: union of C, C++, Fortran C++ has 90+ reserved words!  Forbidden Method Names same as class name (reserved in C++)  Built-in method names start with “_” to avoid collisions with user defined names.

GKK 33 CASC Outline  Problem Motivation  Babel Solution Strategy  SIDL  Using Babel  Outstanding Problems  Future R&D

GKK 34 CASC Getting The Software  Grab tarball Current release: babel tar.gz  Typical build/install (using VPATH) gtar zxvf babel tar.gz cd babel build/../babel-0.6.3/configure --prefix=${HOME}/babel gmake all check install  Platforms Tested Nightly: Linux ( GNU, KCC) Solaris ( GNU )

GKK 35 CASC The Babel Compiler – commandline options  Choose exactly one of the following: --help Display more info --version Babel Version --parse-check Parse SIDL, no output --xml Generate XML --client=[lang] User of Babel Object --server=[lang] Developer of Babel Object  Other Options --output-directory=[dir] Default =. --repository-path=[path] Semicolon separated URLs --generate-subdirs

GKK 36 CASC Babel from a developer’s POV Application Impls Stubs Skels IORs SIDL interface description

GKK 37 CASC hello.sidl /** This is a DocComment for the package */ version hello 1.0; package hello { class World { void setName( in string name ); /** result = “Hello ” + name + “!”*/ string getMsg( ); }; };

GKK 38 CASC Adding the Implementation string hello::World_impl::getMsg () throw () { // DO-NOT-DELETE splicer.begin(hello.World.getMsg) // insert implementation here // DO-NOT-DELETE splicer.end(hello.World.getMsg) } namespace hello { class World_impl { private: // DO-NOT-DELETE splicer.begin(hello.World._implementation) // Put additional implementation details here... // DO-NOT-DELETE splicer.end(hello.World._implementation) namespace hello { class World_impl { private: // DO-NOT-DELETE splicer.begin(hello.World._implementation) // Put additional implementation details here... // DO-NOT-DELETE splicer.end(hello.World._implementation)

GKK 39 CASC Adding the Implementation string hello::World_impl::getMsg () throw () { // DO-NOT-DELETE splicer.begin(hello.World.getMsg) string msg(“Hello “); return msg + d_name + “!”; // DO-NOT-DELETE splicer.end(hello.World.getMsg) } namespace hello { class World_impl { private: // DO-NOT-DELETE splicer.begin(hello.World._implementation) string d_name; // DO-NOT-DELETE splicer.end(hello.World._implementation) namespace hello { class World_impl { private: // DO-NOT-DELETE splicer.begin(hello.World._implementation) string d_name; // DO-NOT-DELETE splicer.end(hello.World._implementation)

GKK 40 CASC Babel Generates LOTS of Code!!! hello.sidl9 Hand added Implementation4 Generated C/C++ code (wc –l *)4,107

GKK 41 CASC Methods Beginning with “_”  method names cannot start with “_” in SIDL  Babel uses leading underscores for internal stuff e.g. IOR-level methods “_create()” e.g. binding specific methods “PKG::CLASS::_get_ior()”  Note: Things that look like a double underscore e.g. hello_World__create() is really normal convention with internal method

GKK 42 CASC Babel from a user’s POV Application Stubs libfoo.so SIDL interface description

GKK 43 CASC A driver in C #include #include "hello.h" int main(int argc, char ** argv ) { hello_World hw; char * msg; hw = hello_World__create(); hello_World_setName( hw, argv[1] ); msg = hello_World_getMsg( hw ); fprintf(stdout, "%s", msg ); free( msg ); hello_World_deleteReference( hw ); }

GKK 44 CASC A driver in Python import hello.World if __name__ = ‘__main__’: h = hello.World.World() h.setName( ‘Gary’ ) print h.getMsg()

GKK 45 CASC Outline  Problem Motivation  Babel Solution Strategy  SIDL  Using Babel  Outstanding Problems  Future R&D

GKK 46 CASC Common Problems  $CLASSPATH not set  compilers not found ($CC, $CXX, $F77)  Python or NumPy not installed  Server-side Python requires libpython.so (Not in standard distributions)  LD_LIBRARY_PATH issues with shared libraries  C++ and shared libraries

GKK 47 CASC Achilles’ Heel  Babel Generates Correct Code  It does nothing about correct compilation

GKK 48 CASC  Basic Types bool char int long float double fcomplex dcomplex string opaque  Basic Types bool char int long float double fcomplex dcomplex string opaque  Extended Types Objects enumerations arrays of basic types arrays of objects (arrays are multidimensional, no arrays of arrays)  Extended Types Objects enumerations arrays of basic types arrays of objects (arrays are multidimensional, no arrays of arrays)  Modes in out inout return value  Modes in out inout return value  OO Method Dispatch regular final static interfaces classes  OO Method Dispatch regular final static interfaces classes  Exception Handling  For All Combinations of LanguagesCC++F77Python Java  For All Combinations of LanguagesCC++F77Python Java How Much Language Interoperability Have We Achieved?  test cases per platform u per compiler set

GKK 49 CASC Babel Test History: sun-sparc-solaris2.7-gcc2.95.x

GKK 50 CASC Babel Development Tools  development platforms sun-sparc-solaris2.7 intelx86-redhat-linux cygwin  Compilers Python 2.1 Sun jdk-1.3 gcc 2.95.x sunpro 5.0 KCC  Build Tools make autoconf automake libtool  Testing in-house tool  Bug-Tracking in-house/bugzilla mods

GKK 51 CASC Outline  Problem Motivation  Babel Solution Strategy  SIDL  Using Babel  Outstanding Problems  Future R&D

GKK 52 CASC Platform Independence  Encourage Locality for Maximum Performance  Connect to separate process space to avoid symbol conflicts at link time  Connect to separate machine to utilize special hardware to use platform specific code (Babel doesn’t get Windows apps to run on UNIX!) To distribute work

GKK 53 CASC Same Process Space Components Application Stubs Skels IORs Impls

GKK 54 CASC Out of Process Components Application Stubs IPC IORs Skels IORs Impls IPC

GKK 55 CASC Internet Remote Components Application Stubs Marshaler IORs Line Protocol Unmarshaler Skels IORs Impls

GKK 56 CASC Parallel Components: MxN Communication

GKK 57 CASC Problem Motivation  Code Reuse is Hard.  Scientific Code Reuse is Harder!  Barriers to Reuse... Language Interoperability Semantics Software Portability Lack of Standards More... Tammy Dahlgren’s PhD Thesis

GKK 58 CASC Problem Motivation  Code Reuse is Hard.  Scientific Code Reuse is Harder!  Barriers to Reuse... Language Interoperability Semantics Software Portability Lack of Standards More... Whitepaper

GKK 59 CASC How do I find out more???  Websitehttp://  User’s Guide  Download Code  Reflectors (subscribe via  the team

GKK 60 CASC The End

GKK 61 CASC Business Component Frameworks  CORBA 4Language Independent 4Wide Industry Acceptance 4Primarily Remoting Architecture  COM 4Language Independent 4Most Established 4In Process Optimization 4Network Transparent  Enterprise Java Beans (EJB) 4Platform Independent 4Runs wherever Java does

GKK 62 CASC Business Component Frameworks  CORBA 4Language Independent 4Wide Industry Acceptance 4Primarily Remoting Architecture 8Huge Standard 8No In-Process Optimization  COM 4Language Independent 4Most Established 4In Process Optimization 4Network Transparent 8not Microsoft Transparent 8Relies on sophisticated development tools  Enterprise Java Beans (EJB) 4Platform Independent 4Runs wherever Java does 8Language Specific 8Potentially highest overhead  All The Above 8No Complex Intrinsic Datatype 8No Dynamic Multidimensional Arrays 8No Fortran77/90/95 bindings 8No Parallel Components Science

GKK 63 CASC Key to Babel’s Interoperability... SIDL Scientific Interface Definition Language IOR Intermediate Object Representation XML eXtensible Markup Language Human Compatible Web Compatible Compiler Compatible

GKK 64 CASC 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-VG REV1