# Presentation: 262511

## SCIRun and SPA integration status

- Steven G. Parker
- Ayla Khan
- Oscar Barney

## SCIRun with PtolemyII

## SCIRun with PtolemyII

- SCIRunJNIActor declares native methods implemented in SCIRun Ptolemy package using JNI interface
- Actor accepts ObjectToken encapsulating SCIRunData class: contains type information and raw data
- Actor calls native functions that access data object in Java

## SCIRun with PtolemyII

- SCIRun contains modules that:
- Convert multi-dimensional arrays from Java object to nrrd (nearly raw raster data) format (Ptolemy package)
- Convert nrrd data to SCIRun types (Teem package)

- Example of data stored in a nrrd

- Arrow points to the module that reads data from Java

## Nearly Raw Raster Data (NRRD) Format

- Library and file format that supports image processing involving N-dimensional raster data and supports a large range of data types
- Distributed with Gordon Kindlmann’s Teem library
- Teem is used for manipulation of structured scientific data
- Can be thought of as wrappers for raw data and are easier to create than SCIRun data objects for simple datatypes
- SCIRun’s Teem interface has modules that convert nrrds to SCIRun data types

**Notes:**
B1- defn of nrrd from GK’s site

## Current Status

- Simple initial test case
- randomly generated mesh converted to SCIRun mesh via Teem nrrd to field converter
- requires pre-existing SCIRun network file containing instance of Ptolemy converter module (name and path of saved network set by SCIRunJNIActor)

**Notes:**
Only data type supported at this time is a mesh containing doubles.  This will change soon.

## Current Caveats

- SCIRun thread library vs. native threads used by JNI:  interface is currently somewhat unstable
- Data from other actors must be encapsulated in SCIRun data object
- Teem package converters may limit access to full range of SCIRun datatypes

**Notes:**
Current threading bugs: Vergil arbitrarily crashes when SCIRun package library is loaded by SCIRunJNIActor, but actor is not instantiated in workspace, closing Vergil after instantiating SCIRunJNIActor and running model causes crash/seg. violation, general issues synchronizing SCIRun threads with JNI-spawned native threads

## Next Steps

- Insert SCIRun into SPA workflow
- Target specific workflows
- Expand support for SCIRun data types
- Improve SCIRun synchronization with Java
- Add ability to send data from SCIRun to Java actors
- Increase efficiency of reading large data sets from Java
- Allow processing of multiple data sets in one iteration or over multiple iterations

## What are Components?

- No universally accepted definition in computer science research ...yet
- A unit of software development/deployment/reuse
- i.e. has interesting functionality
- Ideally, functionality someone else might be able to (re)use
- Can be developed independently of other components
- Interacts with the outside world only through well-defined interfaces
- Implementation is opaque to the outside world
- Can be composed with other components
- “Plug and play” model to build applications
- Composition based on interfaces

## What is a Component Architecture?

- A set of standards that allows:
- Multiple groups to write units of software (components)...
- And have confidence that their components will work with other components written in the same architecture
- These standards define...
- The rights and responsibilities of a component
- How components express their interfaces
- The degree to which components are protected from each other
- The environment in which are composed to form an application and executed (framework)
- The rights and responsibilities of the framework

**Notes:**
One really shouldn’t think of components alone, it is the complete environment/architecture
Unix pipes are an example of a component architecture (loosely)

## What is the CCA?

- CCA is a *specification* of a component environment designed for high performance scientific computing
- Specification is decided by the CCA Forum
- CCA Forum membership open to all
- “CCA-compliant” just means conforming to the specification
- Doesn’t require using any of our code!
- A *tool* to enhance the productivity of scientific programmers
- Make the hard things easier, make some intractable things tractable
- Support & promote reuse & interoperability
- Not a magic bullet

## CCA Philosophy and Objectives

- Local and remote components
- Support local, HPC parallel, and distributed computing
- High Performance
- Design should support high-performance mechanisms wherever possible (i.e. minimize copies, extra communications, extra synchronization)
- Support SPMD and MPMD parallelism
- Allow user to choose parallel programming models
- Heterogeneity
- Multiple architectures, languages, run-time systems used simultaneously in an application
- Integration
- Components should be easy to make and easy to use
- Openness and simplicity
- CCA spec should be open & usable with open software

## CCA Concepts: Language Interoperability

- Existing language interoperability approaches are “point-to-point” solutions

- Babel provides a unified approach in which all languages are considered peers
- Babel used primarily at interfaces

*Few other component models support all languages and data types important for scientific computing*

## CCA Implementations

- Caffeine  (SCMD parallel, Babel or C++)
- SCIRun2 (Distributed, MCMD parallel, Babel or C++, incomplete)
- XCAT (Grid-based, C++)
- LegionCCA (Grid-based, uses Legion)
- Decaf (Single process, Babel)

## CCA myths (debunked)

- CCA is too complicated
- No, code integration is complicated
- Producing quality reusable code is complicated
- CCA makes both easier
- Some implementations are more complicated than they should be
- CCA is buggy
- No, but some (all) of the implementations are
- Some are better than others
- CCA has high overheads
- No, this has been measured to be about the cost of a C++ virtual function call for most cases
- CCA is a data model
- No, but you could use CCA to build one
- CCA is a workflow engine
- No, but you could use CCA to build one
- CCA is perfect
- No, but it is an open forum

## Should I use CCA?

- Of course!
- If you care about interoperable software for high-performance computing
- It won’t solve all of your problems
- If you are trying to build a complex system involving multiple languages
- If you don’t, you might end up creating something just like it
- Please participate in CCA forum and help us improve the specification

## Slide 17