Parallel Algorithms for the Convex Hull Problem
John Daigle
Georgia State University
Overview
Introduction to the Problem
- What is the Convex Hull Problem?
- Sequential Algorithm for Convex Hull
- PRAM Algorithm
Using the Bridging Model
- What is the BSP model?
- BSP algorithm for Convex Hull
[any material that should appear in print but not on the slide]
Definitions
- Convex
- A subset Q of the plane is convex if and only if:
&forall p, q &isin Q, line seqment pq is completely contained in Q
- Convex Hull
- The smallest convex set containing Q, denoted as CH(Q)
Sequential Algorithm
The Divide and Conquer Approach
Given a set of points in
d dimensional Euclidian Space
Ed
Algorithm CH
Input: A set
S{a
1,..., a
n}, where a
i&isin E
d and
xi(ai) < xj(aj)for
i, j = 1,..., n.
Output: The Convex Hull
CH(S)of
S
- Subdivide S into S1 = {a1,..., a&lfloor½n&rfloor} and S2 = {a&lfloor½n&rfloor+1,..., an}
- Apply recursively CH to S1 and S2 to obtain CH(S1) and CH(S2)
- Apply a merge algorithm to CH(S1) and CH(S2) to obtain CH(S) and halt.
Analysis
- Running time
- The sorting operation (Step One) runs in O(nlogn) time
- The merge operation runs in linear time.
- Therefore the linear algorithm is O(nlogn)
The PRAM algorithm
PRAM CH(n, Q, CH(Q))
- Sort the points of Q by their xcoordinates
- Partition Q into n½ subsets Q1,Q2, ... Qn½
- FOR i = 1 to n½ do in parallel
IF points in Qi &le 3 THEN CH(Qi)=Qi
ELSE PRAM CH(n½,Qi,CH(Qi))
- CH(Q) &larr Q1 &cup Q2, Q3, &cup ... &cup Qn½
The PRAM algorithm
The PRAM algorithm is initially quite simple. The points are sorted in increasing order by
x coordinate. Then, the Set is partitioned into n
½ subsets,
Q1,
Q2,
Q3, ...
Qn½, such that for all q
i &isin
Qi, &forall q
j&isin
Qj, the
x coordinate of q
i < x of q
j.

The PRAM algorithm
Step 3 is the recursive step that finds the hull, when |
Qi| &le 3, this group is returned as the convex hull of
Qi, that is, in a group of 3 or fewer points, all of the points are in the hull.

Merging a Set of Disjoint Polygons
The Convex Hull consists of two parts:
- The Upper Hull: The sequence clockwise from u to v
- The Lower Hull: The sequence clockwise from v to u

Identifying the Upper Hull
- Suppose that n processors are available
- We assign n½-1 processors to CH(Qi) for i=1, 2,...,n½
- Each processor assigned to CH(Qi) finds the upper tangent common to CH(Qi) and one of the remaining n½-1 convex polygons CH(Qj), j &ne i
- These computations are done simultaneously for all CH(Qi), each yielding a list of points of Q on the upper hull.
- The lists are then compressed into one list using an array-packing algorithm.
Identifying the Upper Hull
Identifying a Tangent
A
tangent between two polygon
a and
b is a line which runs through a single point
k of
a and a single point
m of
b without passing through either
a or
b.
To compute a tangent between CH(Qi) and CH(Qj), we select a point in the middle of the sequence from u to v of both Qi and Qj (the midpoint of the upper hull of each polygon). For Qi call this s, and w for Qj
- Either (s,w) is the upper common tangent of CH(Qi) and CH(Qj), in which case we are done.
- Or we can eliminate one half of the remaining corners of CH(Qi) and CH(Qj) as candidates for k, m
Analysis of the PRAM algorithm
- Step One: Sorting
Given n processors, PRAM SORT is O(logn).
- Step Two: Partitioning
O(1) for n processors to partition n points.
- Step Three: Recursive Step
t(n½), where t(n) is the running time for the Algorithm PRAM CONVEX HULL, and n½ processors compute CH(Qi)
Analysis of the PRAM algorithm
- Step Four: Merging
- Each of (n½-1)n½ processors computes one tangent in O(logn) time, similar to a binary search.
- Tangents Li and Ri are found in constant time using a MIN CW instruction for each CH(Qi).
- Determining whether the corners from li to ri belong to the upper hull is done in constant time.
- Array packing is O(logn)
- The entire algorithm is therefore:
t(n) = t(n½) + &beta logn
t(n) = O(logn).
- This is optimal, as convex hull is bounded by search.
The Bridging Model
- In sequential computing, one unifying model, the RAM architecture.
- In parallel computing, the PRAM machine comes in many flavors and topologies.
- A bridging model for parallel programming would provide a unifying model for all of these.
The Bridging Model
- What are the advantages of a bridging model?
- What are the challenges?
- Maintaining efficiency.
- Sufficient generality.
- Bulk-Synchronous Parallel model.
- A number of components, processors and/or memory
- A router that delivers messages point to point between components.
- Facilities for synchronizing a subset of the components at regular intervals of L time units.
BSP supersteps
- A computation is divided into supersteps.
- Each component is allocated a task
- 1 or more local computation steps
- 1 or more message transmissions
- Periodic global checks are made to determine wether the current step is complete. If yes, the machine proceeds to the next superstep, if no, the next period of L units is allocated to the current superstep.
- The total run time of a BSP algorithm is the sum of the computation time plus the total communication time.
BSP Terms
A BSP Communication is described by
O(T1 + (L + gh)TC)
- T1 is the total computation time
- L is the Latency of the network
- g is the intrastep gap between messages
- h is the number of messages usually &Theta(n/p)
- TC is the number of communication rounds.
A BSP algorithm for Convex Hull
Assuming
n>
h
- Sort the input points.
- Divide the input into O(n¼) groups of size O(n¾ each, and recursively find the upper hull of each set.
- Find the common upper tangents by simulating a PRAM method (similar to what we have done)
- Calculate the upper tangents as we have seen
- Perform a parallel prefix computation to compress the points on the upper hull.
Analysis of the BSP algorithm
- Sorting: O(loghn) communication rounds, combined running time of O((nlogn)/p + (L + gh) loghn)
- The recursive step: T(n¾)
- Simulating PRAM tangent finding O(loghn)
- Tangent finding remains constant
- Parallel prefix finding is still log time:O(logdk+&lceilm/h&rceil) (where d = 2&lceilh/m&rceil and the input is a k×m array.
- Total time is T(n) = T(n¾) + O(loghn)