{"id":21470908,"url":"https://github.com/saadarazzaq/odd-even-sorting","last_synced_at":"2025-03-17T06:45:07.957Z","repository":{"id":213607265,"uuid":"733088424","full_name":"SaadARazzaq/Odd-Even-Sorting","owner":"SaadARazzaq","description":"Used MPI OpenMP for Parallel Distributed Computing 💻","archived":false,"fork":false,"pushed_at":"2023-12-21T20:38:25.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T16:14:20.602Z","etag":null,"topics":["beginner-friendly","mpi","odd-even-sort","openmp","parallel-computing","parallel-distributed-computing","well-commented-code","well-documented"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/watch?v=bkfCrj-rBjU","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SaadARazzaq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-18T14:36:15.000Z","updated_at":"2023-12-21T20:38:53.000Z","dependencies_parsed_at":"2024-01-13T04:10:44.646Z","dependency_job_id":null,"html_url":"https://github.com/SaadARazzaq/Odd-Even-Sorting","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"aef49ccac00b9aa089aeb58c72989d48b93e2b4f"},"previous_names":["saadarazzaq/odd-even-sorting"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FOdd-Even-Sorting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FOdd-Even-Sorting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FOdd-Even-Sorting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FOdd-Even-Sorting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SaadARazzaq","download_url":"https://codeload.github.com/SaadARazzaq/Odd-Even-Sorting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243988956,"owners_count":20379649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginner-friendly","mpi","odd-even-sort","openmp","parallel-computing","parallel-distributed-computing","well-commented-code","well-documented"],"created_at":"2024-11-23T09:29:43.070Z","updated_at":"2025-03-17T06:45:07.936Z","avatar_url":"https://github.com/SaadARazzaq.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Odd-Even-Sorting\n\n## Introduction\n\nThis 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.\n\n## Compilation\n\nTo compile the program, use the following command:\n\n```bash\nmpicc -o odd_even_sort odd_even_sort.c -lm\n```\n\nHere,\n\n- mpicc is the MPI compiler wrapper.\n- -o odd_even_sort specifies the output executable name.\n- odd_even_sort.c is the source code file.\n- -lm is used to link the math library (required for rand() function).\n\n## Execution\n\nTo execute the program, use the mpirun command:\n\n```bash\nmpirun -np \u003cnum_processes\u003e ./odd_even_sort \u003cnumber_of_elements\u003e\n```\n\nHere,\n\n- \u003cnum_processes\u003e is the number of MPI processes you want to run.\n- \u003cnumber_of_elements\u003e is the total number of elements to be sorted.\n\nFor example, to run the program with 4 MPI processes and 1000 elements:\n\n```bash\nmpirun -np 4 ./odd_even_sort 1000\n```\n\n## Program Logic\n\n1. Each MPI process generates a local array of random integers.\n2. The local arrays are sorted individually using qsort.\n3. Processes exchange elements during Odd and Even phases using MPI communication.\n4. The compareSplit function is used to merge the elements based on the process rank.\n5. The sorting process is repeated for a number of iterations equal to the number of processes.\n\n**Note**\n\n**- Ensure that MPI is properly installed on your system.**\n\n**- Adjust the compilation and execution commands based on your MPI setup.**\n\n**- The program expects a command-line argument for the number of elements.**\n\n## Example Compilation:\n\n```bash\nmpicc -o odd_even_sort odd_even_sort.c -lm\nmpirun -np 4 ./odd_even_sort 1000\n```\n\nThis will run the program with 4 MPI processes, sorting an array of 1000 elements.\n\nFeel free to modify the program or instructions based on your specific requirements and environment.\n\n```bash \nMade with 💖 by Saad and Wasif\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaadarazzaq%2Fodd-even-sorting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaadarazzaq%2Fodd-even-sorting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaadarazzaq%2Fodd-even-sorting/lists"}