{"id":34254881,"url":"https://github.com/fraadap/n-body-parallelization","last_synced_at":"2026-03-13T19:08:16.802Z","repository":{"id":286813602,"uuid":"962642615","full_name":"fraadap/n-body-parallelization","owner":"fraadap","description":"💻 N-Body problem parallelization with OpenMP and MPI","archived":false,"fork":false,"pushed_at":"2025-04-08T13:13:07.000Z","size":15239,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-19T23:30:36.914Z","etag":null,"topics":["c","mpi","multicore","multithreading","nbody-problem","nbody-simulation","openmp"],"latest_commit_sha":null,"homepage":"","language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fraadap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-08T13:09:38.000Z","updated_at":"2025-06-08T09:47:34.000Z","dependencies_parsed_at":"2025-04-08T14:35:45.097Z","dependency_job_id":null,"html_url":"https://github.com/fraadap/n-body-parallelization","commit_stats":null,"previous_names":["fraadap/n-body-parallelization"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fraadap/n-body-parallelization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraadap%2Fn-body-parallelization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraadap%2Fn-body-parallelization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraadap%2Fn-body-parallelization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraadap%2Fn-body-parallelization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fraadap","download_url":"https://codeload.github.com/fraadap/n-body-parallelization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraadap%2Fn-body-parallelization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30472990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T17:15:31.527Z","status":"ssl_error","status_checked_at":"2026-03-13T17:15:22.394Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["c","mpi","multicore","multithreading","nbody-problem","nbody-simulation","openmp"],"created_at":"2025-12-16T12:23:21.532Z","updated_at":"2026-03-13T19:08:16.795Z","avatar_url":"https://github.com/fraadap.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"# N-Body Problem Parallelization\nThis project contains several C implementations capable of parallelizing the [n-body problem](https://en.wikipedia.org/wiki/N-body_problem). The project was made by students for a Multicore Programming course within a BSc degree program in Computer Science.\n\n## ♟️ Algorithms\nTwo algorithms were used to experiment:\n- A trivial direct sum algorithm with time complexity: $O(n^3)$\n- The [Barnes-Hut algorithm](https://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation) with time complexity: $O(n \\log n)$\n\nBoth algorithms have been parallelized and compared.\n\n## 👾 Implementations\nA single process version and two multicore versions are provided for both algorithms:\n- One with distributed memory, implemented using the [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface) library.\n- One with shared memory, implemented using the [OpenMP](https://en.wikipedia.org/wiki/OpenMP) library.\n\n## 🗂️ In this repository \nIn this repository you will find:\n- Various versions of optimization procedures done on the initial code.\n- A detailed report explaining the various optimizations and the reason behind the choices made.\n- Some utility Python scripts that are able to:\n    - Carry out performance tests\n    - Generate input files with random bodies\n    - Render the output file and have a graph of the bodies\n    - Test the similarity between the outputs of the different implementations\n- The data used for performance analysis, including pre-populated input csv files end some expected results. \n\n## 📚 Libs\nTo run the codes correctly you need to install the libraries:\n- open-mpi (C)\n- omp (C)\n- mathplot (Python, only to render the results)\n\n## 💻 Usage\nFirst, clone [this repository](https://github.com/Exyss/n-body-parallelization.git). In each subfolder there is a makefile that automatically compiles the associated version. Set the current working directory to the desired folder and run `make`.\n\n### To run the code:\n- **exhaustive sequential** version\n\n```bash\n .\\\u003cname_of_executable\u003e \u003cinput_file\u003e \u003csimulation_steps\u003e\n```\n- **Barnes Hut sequential** version \n```bash\n.\\\u003cname_of_executable\u003e \u003cinput_file\u003e \u003csimulation_steps\u003e \u003capprox_threshold\u003e\n```\n- **exhaustive mpi** version\n```bash\nmpirun -n \u003cnumber_of_cores\u003e \u003cname_of_executable\u003e \u003cinput_file\u003e \u003csimulation_steps\u003e\n```\n- **Barnes Hut mpi** version\n```bash\nmpirun -n \u003cnumber_of_cores\u003e \u003cname_of_executable\u003e \u003cinput_file\u003e \u003csimulation_steps\u003e \u003capprox_threshold\u003e\n```\n- **exhaustive omp** version\n```bash\n.\\\u003cname_of_executable\u003e \u003cinput_file\u003e \u003csimulation_steps\u003e \u003cthread_count\u003e\n```\n- **Barnes Hut omp** \n```bash\n.\\\u003cname_of_executable\u003e \u003cinput_file\u003e \u003csimulation_steps\u003e \u003capprox_threshold\u003e \u003cthread_count\u003e\n```\n\nThe output file will be written to the current directory with the name _output.csv_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraadap%2Fn-body-parallelization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffraadap%2Fn-body-parallelization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraadap%2Fn-body-parallelization/lists"}