This project compares:
- Serial Quicksort (Normal C++)
- Parallel Quicksort using MPI
The purpose is to measure performance improvement using parallel computing.
- Windows 10 / 11
- WSL (Ubuntu installed)
- g++ compiler
- OpenMPI installed
Search Ubuntu in Windows and open it.
mkdir quicksort_project
cd quicksort_projectnano serial.cppπ Paste your serial code π Press:
CTRL + Oβ Press Enter (Save)CTRL + Xβ Exit nano
nano parallel.cppπ Paste your parallel MPI code π Press:
CTRL + Oβ Press EnterCTRL + Xβ Exit
g++ serial.cpp -o serial./serialExample Output:
Serial Execution Time: 0.114773 seconds
mpic++ parallel.cpp -o parallelmpirun --oversubscribe -np 4 ./parallelExample Output:
Parallel Execution Time: 0.0701045 seconds
Speedup = Serial Time / Parallel Time
Example:
Speedup = 0.114773 / 0.0701045 β 1.63
Efficiency = Speedup / Number of Processes
Efficiency = 1.63 / 4 β 0.40
sudo apt update
sudo apt install g++sudo apt update
sudo apt install openmpi-bin openmpi-common libopenmpi-devError message:
There are not enough slots available...
mpirun --oversubscribe -np 4 ./parallelchmod +x serial
chmod +x parallelCheck current folder:
pwd
lsMake sure you are inside:
quicksort_project
Nothing appears while typing password.
Just type password and press Enter. It is normal in Linux.
- Save β
CTRL + O - Press Enter
- Exit β
CTRL + X
If you want to exit without saving:
CTRL + X- Press
N
Stop program:
CTRL + C
Then try smaller process count:
mpirun --oversubscribe -np 2 ./parallel-
Parallel computing reduces execution time.
-
MPI allows communication between processes.
-
Speedup is limited due to:
- Communication overhead
- Synchronization delay
- Sequential part of program
This project demonstrates practical use of MPI for parallel programming and shows performance comparison between serial and parallel Quicksort algorithms.
Anish Phatake Harsh Kadam Pruthviraj Pawar Sachin Chavan BE Computer Engineering Mini Project β High Performance Computing