Skip to content

sirodoht/parallel-rank-sort

Repository files navigation

Parallel Rank Sort

SeqRankSort.java is a C-like sequential implementation of rank sort. Demonstrated with a sample reversed array of 10 integers.

ParallelRankSort.java uses command line arguments for problem size and number of threads to use. It divides the array to be sorted into equal[1] blocks, which are then divided to each thread. The work of each thread is to calculate the position of each element in the (result) array.

[1] In case of remainder Math.ceil is invoked.

Use

Compile

javac -Xdiags:verbose SeqRankSort.java
javac -Xdiags:verbose ParallelRankSort.java

Tested with Java 8.

Run

java SeqRankSort
java ParallelRankSort 1000 4 true

ParallelRankSort arguments:

  1. 1000 problem size, that is the number of elements of the array.
  2. 4 problem size, that is the number of elements of the array.
  3. true random boolean, true means random array elements while every other statement evaluates false.

Also available by running java ParallelRankSort argument-less.

Experiment

./run_parallel.sh

run_parallel creates a results directory and runs the parallel version for sample problem sizes and number of threads. It can be used as boilerplate for your own numbers for the arguments.

License

Code released under the MIT license.

About

Parallel (and sequential) rank sort in Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published