Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saadarazzaq/odd-even-sorting
Used MPI OpenMP for Parallel Distributed Computing 💻
https://github.com/saadarazzaq/odd-even-sorting
beginner-friendly mpi odd-even-sort openmp parallel-computing parallel-distributed-computing well-commented-code well-documented
Last synced: about 2 months ago
JSON representation
Used MPI OpenMP for Parallel Distributed Computing 💻
- Host: GitHub
- URL: https://github.com/saadarazzaq/odd-even-sorting
- Owner: SaadARazzaq
- Created: 2023-12-18T14:36:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-21T20:38:25.000Z (about 1 year ago)
- Last Synced: 2024-07-07T23:24:39.132Z (6 months ago)
- Topics: beginner-friendly, mpi, odd-even-sort, openmp, parallel-computing, parallel-distributed-computing, well-commented-code, well-documented
- Language: C
- Homepage: https://www.youtube.com/watch?v=bkfCrj-rBjU
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Odd-Even-Sorting
## Introduction
This MPI (Message Passing Interface) program implements the Odd-Even Sort algorithm to efficiently sort an array of integers in parallel across multiple processes. The Odd-Even Sort is a parallel sorting algorithm that works by iteratively comparing and swapping neighboring elements.
## Compilation
To compile the program, use the following command:
```bash
mpicc -o odd_even_sort odd_even_sort.c -lm
```Here,
- mpicc is the MPI compiler wrapper.
- -o odd_even_sort specifies the output executable name.
- odd_even_sort.c is the source code file.
- -lm is used to link the math library (required for rand() function).## Execution
To execute the program, use the mpirun command:
```bash
mpirun -np ./odd_even_sort
```Here,
- is the number of MPI processes you want to run.
- is the total number of elements to be sorted.For example, to run the program with 4 MPI processes and 1000 elements:
```bash
mpirun -np 4 ./odd_even_sort 1000
```## Program Logic
1. Each MPI process generates a local array of random integers.
2. The local arrays are sorted individually using qsort.
3. Processes exchange elements during Odd and Even phases using MPI communication.
4. The compareSplit function is used to merge the elements based on the process rank.
5. The sorting process is repeated for a number of iterations equal to the number of processes.**Note**
**- Ensure that MPI is properly installed on your system.**
**- Adjust the compilation and execution commands based on your MPI setup.**
**- The program expects a command-line argument for the number of elements.**
## Example Compilation:
```bash
mpicc -o odd_even_sort odd_even_sort.c -lm
mpirun -np 4 ./odd_even_sort 1000
```This will run the program with 4 MPI processes, sorting an array of 1000 elements.
Feel free to modify the program or instructions based on your specific requirements and environment.
```bash
Made with 💖 by Saad and Wasif
```