Parallelizing Bucket Sort with MPI
Done as an assignment for 491: Parallel Processing at MSU. The code in bucket_sort_skeleton.c was provided to us, the v1, v2, & v3 files are my solutions. These were run on MSU's HPCC to compare run-times.
v1:
- generate: create the array at the root process
- bin: root process determines buckets -- which data belongs on which processor
- distribute: root sends buckets to appropriate processes
- local sort: each process sorts the data locally using qsort()
- gather: results are gathered at the root process
v2:
- generate: create N/P elements randomly on each process
- bin: each process determines buckets - which of their data belongs on which processor
- distribute: each process sends buckets to appropriate processes
- local sort: each process sorts the data locally using qsort()
- gather: results are gathered at the root process
v2.1: Different data distribution: random distribution to create unbalanced load on each processor
v3: Pivots with sampling to deal with imbalanced loads:
- Each process selects S/P elements randomly within its part of array A
- S samples are gathered at the root process
- root process sorts samples locally using qsort()
- root selects and broadcasts pivots = [S_sorted[S/P], S_sorted[2S/P], S_sorted[3S/P] ...]