Skip to content

Parallel sort using MPI. Successfully tested on an HPC cluster with 26 nodes.

Notifications You must be signed in to change notification settings

Tony080/ParallelSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Parallel Sorting with MPI

Author: Chengzhi Hu

1. Introduction

This is a parallel sorting using MPI.
You shall install MPI before run this program.
The architecture is described below:
Architecture
The program first read an unsorted file as input. The unsorted file contains 1 number per line.
By default, MAIN_PROCESS(0 ~ max node #) defined as a macro at the top of the code will do the I/O, and other process(node) will just wait.
Then MAIN_PROCESS will send the equivalent copy of input array to each node via MPI_Scatterv method.
Each node will perform a quick sort in to sort.
After that, merges will be performed. That is, treat the node named with even rank as master node. And treat the node named with odd rank as slave node.
Then merge these node as we perform a bottom up merge sort.
As a final result, MAIN_PROCESS will hold the final sorted array and print them out in a file.

2. How to use

You can just download the main.c and makefile. And in your terminal, enter the directory where your files downloaded. And just use command “make” to run the program.
Notice that, you can modify the makefile such that you can run with different number of nodes, given different input & output files.
By default,
NODE = 2
INPUT = sm.dat
OUTPUT = sm-sol.txt

Attention: you can't give a NODE number that is greater than the actual physical cores you have.

About

Parallel sort using MPI. Successfully tested on an HPC cluster with 26 nodes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published