smalltalk numbercrunching

22
Smalltalk Number Crunching Daniel Poon

Transcript of smalltalk numbercrunching

Smalltalk Number Crunching

Daniel Poon

● Conventional perception of technical computing is fast becoming out of date

● Take a look at our business● Take a look at our technology● Take a look at our processes

What does Smalltalk have to do with Numerically Intensive Tasks?

Romax Technology Ltd. & RomaxDesigner

● Our value proposition– RomaxDesigner enables

us to predict the system wide behavior of transmission systems beyond what was previously possible

Our Customers

What can Romax model?

Perpendicular Shaft Arrangement

Planetary Shaft Arrangement

Parallel Shaft Arrangement

F = kx● Given

– Stiffness● Produced from the stiffnesses of all the components

– Forces● Produced by the engine and

transmitted by the gearbox● Solve for

– Deflection● How the design will distort in use● Large distortions reduce component life

VPD (Virtual Product Development)

ConceptDesign

DetailedDesign

AnalysisFeedbackFeedback

Prototype/Physical testing Feedback

– Analysis tells you how your design performs – Development of a Complete transmission

system takes 3-4 years – We can reduce that to 1 to 1.5 years

The Challenge

● Customers want ever more complex simulation● Greater complexity puts greater demands on

performance ● The market demands ever shorter lead times and

shorter development cycles● How does Smalltalk help?

Why not C#/Java? – Speed of Compilation and Late

Binding

● Smalltalk's simple syntax is designed to compile like lightning

● With late binding you can run a test even when the system is broken

● Step change in programming style

● Use double dispatch wherever you want ● Bounce gui and test behaviour directly off the

model● Matlab like extensions for Domain Experts

– To plot a graph#((1 0) (2 0.5) (3 1.3)) asPoints plot

– To draw an HTML table 'x' || 'y' || 'theta'

Why not C#/Java? – Class extensions

Smalltalk

FortranFortran signals Smalltalk exception

Smalltalk catches exception

Fortran resumes

Smalltalk calls Fortran numerical routine

End of call out

Why not C#/Java? - Resumable exceptions

● No need for multiple callbacks ● We register a single general purpose callback

that throws a Smalltalk exception● Exception hierarchy and scoping rules take care

of the rest

Opportunity for Smalltalk in the technical computing market

● The technical computing market is huge ● Designed for analysts' own use. Does not address

product development cycle● Smalltalk is fundamentally good for technical

computing – Arbitrary length integers and fractions– BlockClosures that serve as a great way of passing

equations to solvers– 'doIt' immediate mode

Obsticles for Smalltalk in the technical computing market

● Smalltalk has many quirks. You will need a Smalltalk coach – Syntax

● Operator precedence● Array syntax

– Lack of native solvers/libraries– Floating Point performance– Mixed language support

Smalltalk is 70 times slower than Fortran for Floating Point ops

● Conventional wisdom – Layered Architecture– Product model in Smalltalk– All engineering calcs in Fortran

● Now profile it – We spend 60% of time transferring data back and forth between Smalltalk and Fortran

● Layered Architecture= barrier = difficult to optimize

Smalltalk is 70 times slower than Fortran for Floating Point ops

● Smalltalk is just about fast enough (but only just) – It can do almost everything we need

● First build it in Smalltalk Then profile itThen optimize the SmalltalkThen use Fortran for the true bottlenecks

● Use a single language = No barriers= Easy to optimize

The Chassis/Body System Metaphor

● Two requirements– Torsional Rigidity– Passenger space

● Two solutions– The Chassis provides

torsional rigidity– The Body provides

passenger space

Local Optima

Global Optimum

The Monocoque System Metaphor

● Two requirements– Torsional Rigidity– Passenger space

● One solution– Single structure

integrates torsional rigidity with passenger space

FortranCalculation Engine

SmalltalkProduct Model

ProgrammingTeam

EngineeringAnalysis

Team

It is not a Technical Challenge

● A traditional team structure will always produce a Layered Architecture with local optima

● To produce a global optimum, both layers have to be designed Simultaneously by the same team

Solution – Pair Programming between Fortran Guys and Smalltalk Guys

● Produce a globally optimized design● Right First Time

– All skills (coding best practices, domain knowledge) immediately at hand

● Zero Lead Time for:– Newbie Programmer with

no domain knowledge– Newbie Domain Expert with

no development skills

NumericProduct ModelVisualization

System interfacing

Smalltalk

C++Fortran

Commercial Drivers for Shift Towards Monocoque Architecture

● Customers want ever more complex analysis● The market demands shorter lead times and

shorter development cycles

Conclusion

● Why did we want to use Smalltalk in our organization?

● What were the challenges to using Smalltalk in our organization?

● What could the Smalltalk community do to support us?

Thank You

Any Questions?

Enjoy the rest of the conference

[email protected]