Upload
fabrizio-giudici
View
1.121
Download
0
Tags:
Embed Size (px)
Citation preview
Parallel Computing Scenarios
and the new challenges for the Software Architect
Fabrizio GiudiciTidalwave s.a.s.880
Emmanuele SordiniBloomingStars.com
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
3
AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION
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
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
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
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
8
AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION
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
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
11
Algorithm
12
Parallel decomposition
13
AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION
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
15
Mistral ImageProcessor> Master / Worker pattern> Polymorphic implementation
– Local (multi core)– Rio– Sun Grid
> Images wrapped in an opaque container (EditableImage)
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; }
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
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
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
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
21
AGENDA> MOTIVATIONS> CASE STUDY> ARCHITECTURE> CONCLUSION
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
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
24
Q&A> Question time
Fabrizio Giudici www.tidalwave.itTidalwave s.a.s [email protected]
Emmanuele Sordini [email protected]