A fun twist on traditional sorting algorithms that utilizes parallel computing and MPI communication!
This project implements the traditional in-place Heapsort algorithm but uniquely apply it while using the power of MPI and parallel computing to distribute the work among multiple processors to make the sorting even more efficient.
- The program starts with a random set of numbers in each processor.
- Next each process sorts the values stored in its machine.
- Once the set of numbers in each processor are sorted, each processor creates its "p-sample". Essentially each processor creates a list holding each n/p value (n = number of values, p = number of processors).
- Next, each processor sends its p-sample list to processor-0.
- Processor-0 then sorts all the p-sample values into one ordered list.
- Processor-0 then takes this sorted list and creates a global p-sample list and sends this global p-sample to all the processors.
- Within each processor distribute each processors values into "buckets" using the global p-sample list to set the number of buckets and what values will go into each bucket.
- Next, have each processor communicate its bucket size to all other processors
- Now send each processor buckets to all other processors
- Finally, send the sorted post bucket sizes to all and make the appropriate adjustments so each processor has equal (or as close to equal as possible) size of values
- Values are now sorted evenly within each processor
The main MPI call being used is is MP_Alltoall() as this limits the cost of communication and ensures the costly act of MPI communication between systems is done as efficiently as possible.
This project was developed with Java and a slew of other technologies. Please Follow the instructions bellow carefully to download and run the project. If you have any issues please feel free to email me at [email protected] . I would be happy to help or fix any issues you run into.
Here the things you need to run the code:
- C++
- MPI
- Openstack
Ensure you have access to an Openstack program that gives access to utilizing a large array of machines. I was lucky enough to be able to use my universities Openstack system for this cool project. It is likely you probably don't have access to this and sadly it won't be obvious how to run my program in your position.
I will include my schools instructions of how to setup Openstack to work this program however. This general set of steps is what I used to make my project work. Openstack Instructions
To use the program is pretty simple to use once you have set-up everything with Openstack. I have provided input and (correct) output files that each processor should read in and the code includes a function to intelligently have each processor read in its file of values. From there, just run the code appropriately through Openstack and see how the results compare to the output files!
Luke Daschko - @lukeduker - [email protected]
Project Link:https://github.com/LukeVibes/MPI_Sorting