Design of parallel algorithms Sorting J. Porras
Problem Rearrange numbers (x 1,...,x n ) into ascending order ? What is your intuitive approach –Take one at a time an insert into correct place –Exchange elements in incorrect places –Select largest and separate, select 2nd largest,... –Compare the rank of each number (enumeration) –Some special approach
Terminology Internal –Fits into memory External –External storage is needed Comparison-based –Compare-and-exchange Non-comparison based –Use properties of the elements
Approaches Internal –Insertion (straight, binary, shellsort) –Exchanging (Bubble, Batcher, Quick, Radix) –Selection (Straight, Heap) –Merging (Two-way, natural two-way) –Distribution (Bucket, Radix) External Networks of sorting –Bitonic
Parallel aspects Input/output location Comparisons # of elements per processor Architecture –# of processors –interconnection network
Practical exercise II Each person is given a sorting method that is implemented to our cluster environment Problem is –Defined and analysed beforehand to get some idea how fast the approach may work –Implemented –Results are collected and compared to the results of other persons (times, usage of network, work,...) Parameters –2,3,4 processors –Array of 10, 100, 1000, 10000, elements
Algorithms (Pipelined) bubble sort Odd-even transposition Shellsort Quicksort Bucket/Sample sort Radix sort Merge sort Selection Bitonic network