25
Parallel Computing Scenarios and the new challenges for the Software Architect Fabrizio Giudici Tidalwave s.a.s. 880 Emmanuele Sordini BloomingStars.com

Parallel Computing Scenarios and the new challenges for the Software Architect

Embed Size (px)

Citation preview

Page 1: Parallel Computing Scenarios  and the new challenges for the Software Architect

Parallel Computing Scenarios

and the new challenges for the Software Architect

Fabrizio GiudiciTidalwave s.a.s.880

Emmanuele SordiniBloomingStars.com

Page 2: Parallel Computing Scenarios  and the new challenges for the Software Architect

2

Goals of this presentation> Parallel/distributed computing has been around for decades

– Mainly in some niches (science, military, finance)– Seti@Home, BOINC, ... paved the way for the rest of the world

> It's going to become important for “general” software architects– Because of recent technology evolution– From (maybe) scared customers to new business opportunities

> Learn how to design WORA parallel applications – Exploiting parallelism in different scenarios– Good design, patterns, technologies

Page 3: Parallel Computing Scenarios  and the new challenges for the Software Architect

3

AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION

Page 4: Parallel Computing Scenarios  and the new challenges for the Software Architect

4

Motivations> User's need grow

– Demand for increased computing power

– Multimedia processing– Also on the desktop

> Technological challenges– Multi-core computers (10s of cores

in a few years, clock stable or decreasing)

> New opportunities– Easy “local mini grids“ (e.g Jini, Rio)– Massive grid computing as a

service (e.g. Sun Grid)

from Computer Architecture,a Quantitative approach:

Patterson & Hennessy, 2006

Page 5: Parallel Computing Scenarios  and the new challenges for the Software Architect

5

Jini, Rio, Sun Grid> Jini

– A Java technology for creating “federations of services“– Spontaneous networking, discovery, mobile code– http://www.jini.org

> Rio– Based on Jini– Adds container / component paradigm, Quality of Service, etc...– http://rio.dev.java.net

> Sun Grid– A massive (1.000s nodes) grid platform accessible as a service – $1 / CPU / hour– Since May 2007 available in 24 countries outside USA– http://www.network.com

Page 6: Parallel Computing Scenarios  and the new challenges for the Software Architect

6

Parallel computing: easy or hard?> Harder than single-thread computing> Largely depends on the context

– Course grain– Fine grain

> Future language enhancements?– Java syntax extensions– New languages– Virtual Machine optimizations (transparent to code?)

> Let's focus on what we have now– Design– Architecture– Patterns

Page 7: Parallel Computing Scenarios  and the new challenges for the Software Architect

7

An important point: ROI> In the past distributed computing required ad-hoc hardware

– Highly expensive– High start-up costs– Strive for high parallelism exploitation to justify costs

50% efficiency with 100.000€ expense means 50.000€ wasted> Today is different

– Local “mini grids” can be easily set up with standard hardware – Large facilities available as a service on a “pay-per-hour” basis

> A different ROI policy– No or negligible start-up costs– Probably you can live with medium efficiency in parallelism exploitation

50% efficiency on the Sun Grid means $1 per hour wasted

Page 8: Parallel Computing Scenarios  and the new challenges for the Software Architect

8

AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION

Page 9: Parallel Computing Scenarios  and the new challenges for the Software Architect

9

Case study> Concrete problem and potential community

– To be addressed with state-of-the art design– Focused on image processing, but many things are general purpose

> Different scenarios considered– Single core, multi-core– “Local mini grids” made with Jini and Rio– Sun Grid

> Mistral – the imaging framework– http://mistral.tidalwave.it

> Pleiades – the application– http://pleiades.bloomingstars.com

Page 10: Parallel Computing Scenarios  and the new challenges for the Software Architect

10

Hires imaging of solar system bodies> For decades only with pro equipment> Since 90s within the reach of amateurs

– availability of decent quality optics – good cameras at reasonable prices

> Key concept– take multiple exposures– stack and align them– improve S/N ratio by averaging

> Bottom line: consumer's perspective fit with the scenario– Recall previous slide about users and computing power

Page 11: Parallel Computing Scenarios  and the new challenges for the Software Architect

11

Algorithm

Page 12: Parallel Computing Scenarios  and the new challenges for the Software Architect

12

Parallel decomposition

Page 13: Parallel Computing Scenarios  and the new challenges for the Software Architect

13

AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION

Page 14: Parallel Computing Scenarios  and the new challenges for the Software Architect

14

Mistral> Abstract Imaging layer

– Wraps Java2D, JAI, ImageJ, others> Flexible

– Operations and/or engines can be plugged in> Versatile Imaging Processor

– Based on the Master/Worker pattern> Built-in support for profiling

– Benchmarking is a must

Page 15: Parallel Computing Scenarios  and the new challenges for the Software Architect

15

Mistral ImageProcessor> Master / Worker pattern> Polymorphic implementation

– Local (multi core)– Rio– Sun Grid

> Images wrapped in an opaque container (EditableImage)

Page 16: Parallel Computing Scenarios  and the new challenges for the Software Architect

16

Phase controllerreference = createReference();

for each image { schedule new RegisterTask(image, reference); }

when (at least 2 RegisterTasks completed) { image1 = registerTask1.getResult(); image2 = registerTask2.getResult(); schedule new AddTask(image1, image2); }

when (at least 2 AddTasks completed) { image1 = addTask1.getResult(); image2 = addTask2.getResult(); schedule new AddTask(image1, image2); }

// Detects last phasewhen (no more pending tasks && only 1 completed AddTask has not been processed) { sumImage = addTask.getResult(); normalize(sumImage); return; }

Page 17: Parallel Computing Scenarios  and the new challenges for the Software Architect

17

Best practices> Fallacies #2, #3 of distributed computing

– “Latency is zero”– “Bandwidth is infinite”

> In other words– Don't pretend the network is not there– Serialization overhead is an issue

> Memory is also a problem– Memory is not infinite– Typical of imaging or large-datasets problems– Was not an issue with sequential processing

Queuing intermediate results vs process one by one

Page 18: Parallel Computing Scenarios  and the new challenges for the Software Architect

18

Adapt to scenarios> Consume results as soon as possible

– Avoid accumulation of idle results in queues– Post tasks with priority

> Adapt the most to the environment capabilities– Synthetic images are re-computed at each node– Filesystem-based exchange is used when NFS is available (e.g. Sun Grid)– Distributed image cache otherwise– Optimized routing

Page 19: Parallel Computing Scenarios  and the new challenges for the Software Architect

19

EditableImage serialization> Opaque holder of the real image> Each instance has its own unique UUID

– Serializable – but only moves UUID around> NFS implementation

– Each serialized image gets stored on the disk– Upon use on a remote node, it is loaded from the disk

> Otherwise– Images are pulled from a distributed cache– Pull vs push approach for cache

Page 20: Parallel Computing Scenarios  and the new challenges for the Software Architect

20

Optimized routing> Optimize scheduling to minimize data motion

– Multi-phase: the operands come from a previous phase– For instance, while adding two images

> The scheduler– Queries the pending Task about the needed images– Looks up the distributed image cache– Finds the node where most of needed images are– Schedule the task to that node

Page 21: Parallel Computing Scenarios  and the new challenges for the Software Architect

21

AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION

Page 22: Parallel Computing Scenarios  and the new challenges for the Software Architect

22

Conclusion> Parallel computing is coming among us

– Hard, but in reach– It's an opportunity, not a scary thing

> In different fashions– Multi core– Local mini grids (Jini, Rio)– Massive grids as a facility (Sun Grid)

> Can be dealt with more patterns in our catalog> You don't need always the “optimal” solution

– Just pull most out of the CPUs with trade-off design

Page 23: Parallel Computing Scenarios  and the new challenges for the Software Architect

23

Desktop too – and demo> Mistral and Pleiades

integrated in blueMarine, a desktop photo application

> Demos at Jazoon: – “blueMarine - a desktop

app for the open source photographic workflow“

– Tuesday, 2007-06-26, 12:00 - 12:50, Arena 2

– Thursday, 2007-06-28, 14:00 - 14:50, Arena 1

Page 24: Parallel Computing Scenarios  and the new challenges for the Software Architect

24

Q&A> Question time

Page 25: Parallel Computing Scenarios  and the new challenges for the Software Architect

Fabrizio Giudici www.tidalwave.itTidalwave s.a.s [email protected]

Emmanuele Sordini [email protected]