midterm-solutions-Feb2011

midterm-solutions-Feb2011 - Programing for Performance (ECE...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Programing for Performance (ECE 459): Midterm solution Xavier, Jon, and Hany; edits by Patrick February 17, 2010 1 Question 1: Parallelization Patterns 1.1 Naming Parallelization patterns (10 points) Build system: Multiple independent tasks, at a per-file granularity . Given a project to build, the build system can compute sets of independent files and compile each set in parallel. The compilation of each independent set would proceed sequentially. After each set compiles, the build system might need to combine results from the sets. This requires communication: the compiler needs to communicate success/failure to the build system after each compilation, and the compiler output files need to go to the linker. Optical character recognition system: Pipeline of tasks . We are assuming that we have a bitmap and we want to convert it into characters. The first task is segmentation into lines and characters, while the second task is classification of each character. This can happen in parallel for the different characters. 1.2 Concrete examples (10 points) Single task, multiple threads (fork-join): Computation of a mathematical function with independent sub-formulas . Each sub-formula may be computed by a different thread. At the end of all sub-formula computations, it may be necessary to combine the sub-results sequentially. Example: f ( x ) = h ( x ) + g ( x ). Producer-consumer: Processing of stock-market data . A server might generate raw financial data (quotes) for a particular security. The server would be the producer. Several clients (or consumers) may take the raw data and use them in different ways. For instance by generating averages, means, charts, etc. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Midterm solution, ECE 459 2 2 Question 2: Speculation 2.1 Conditions under which it is safe to parallelize the calls (5 points) longCalculation and secondLongCalculation must not call each other. The implementation of secondLongCalculation must not depend on any values that may be set or modified by longCalculation . The return value of longCalculation must be deterministic.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/22/2011 for the course ECE 459 taught by Professor Patricklam during the Spring '11 term at Waterloo.

Page1 / 5

midterm-solutions-Feb2011 - Programing for Performance (ECE...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online