# CS代写 XJCO3221 Parallel Computation – cscodehelp代写

Overview Multi-threaded vector addition Nested loops in parallel Summary and next lecture
XJCO3221 Parallel Computation

University of Leeds

Lecture 3: Data parallel problems
XJCO3221 Parallel Computation

Nested loops in parallel Today’s lecture Summary and next lecture
Previous lectures
In the last lecture we started looking at shared memory parallelism (SMP):
Relevant to multi-core CPUs.
Separate processing units (cores) share some levels of
memory cache.
Various frameworks for programming SMP systems. Widely-implemented standard: OpenMP.
XJCO3221 Parallel Computation

Summary and next lecture
Today’s lecture
Today we are going to look at a some actual problems.
Examples of a data parallel problems, where the same operation is applied to multiple data elements.
Also known as a map1.
Multi-threading solution employs a fork-join pattern.
How to parallelise nested loops.
Parallel code can be non-deterministic, even when the serial code is deterministic.
1McCool et al., Structured parallel programming (Morgan-Kaufman, 2012). XJCO3221 Parallel Computation

Nested loops in parallel Summary and next lecture
Data parallel and embarrassingly parallel
An n-vector a can be thought of as an array of n numbers: a = (a1,a2,…,an).
If two vectors a and b are the same size, they can be added to generate a new n-vector c:
a=( a1, a2, a3, …, an ) +++++ b=( b1, b2, b3, … bn ) ↓↓↓↓↓ c=( c1, c2, c3 …, cn )
ci=ai+bi , i=1…n.
XJCO3221 Parallel Computation