{"id":25307971,"url":"https://github.com/sixleopard/cellular_automata_hpc","last_synced_at":"2025-10-27T07:09:51.052Z","repository":{"id":275938372,"uuid":"927667188","full_name":"SixLeopard/Cellular_Automata_HPC","owner":"SixLeopard","description":"Customisable Cellular Automata written in C++ using OpenMP, MPI and CUDA used to compare the diffreneces in performance between different parallelisation methods","archived":false,"fork":false,"pushed_at":"2025-02-05T11:35:38.000Z","size":1464,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T11:56:27.688Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/SixLeopard.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-05T10:42:35.000Z","updated_at":"2025-02-05T11:35:41.000Z","dependencies_parsed_at":"2025-02-05T12:20:25.927Z","dependency_job_id":"767646bc-457a-49d6-8fcb-02ced2eb9c5d","html_url":"https://github.com/SixLeopard/Cellular_Automata_HPC","commit_stats":null,"previous_names":["sixleopard/cellular_automata_hpc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixLeopard%2FCellular_Automata_HPC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixLeopard%2FCellular_Automata_HPC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixLeopard%2FCellular_Automata_HPC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixLeopard%2FCellular_Automata_HPC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SixLeopard","download_url":"https://codeload.github.com/SixLeopard/Cellular_Automata_HPC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615476,"owners_count":20967183,"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":[],"created_at":"2025-02-13T11:56:33.009Z","updated_at":"2025-10-27T07:09:46.004Z","avatar_url":"https://github.com/SixLeopard.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cellular Automata HPC\nCustomisable Cellular Automata written in C++ using OpenMP, MPI and CUDA used to compare the diffreneces in performance between different parallelisation methods\n\n## Introduction to Cellular Automata \nthis is a cellular automata with a changeable ruleset. the most well know cellular automata \"the game of life\" has the rules that if there are 2 or 3 adjacent cells alive then the cell stays live and if there a 3 adjacent cells to a dead cells then it comes alive. But my implementation allows the input of any number of cells for the survive and birth conditions\n\n## Overview\n- The state of the world is stored in 2D C++ std vector.\n- Every generation loop through all cells in vector and calculates number of alive neighbours which is then used to determine whether the cells should be dead or alive next generations, the results is then written to a second Vector.\n- Once all cells are check the original vector is swapped with the second vector now which now contains the next generation. Repeat until all generations are complete.\n- However problems can occur when live cells get close to the edge of the Vector so, If a check goes over the edge of the world (end of vector), it wraps around to the other side\n\n\n\n### OpenMP (Multi-Threading)\nCell checks are split across threads using #pragma omp parallel for collapse(2) on the evolve for loop\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide15.PNG)\n\n### MPI (Multi-Node)\nCell checks split across Nodes, then also uses the same OpenMP multithreading on the nodes from before\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide18.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide19.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide20.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide21.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide22.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide23.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide24.PNG)\n\n### Cuda\nUses the GPU, since the most GPUs have  thousands of cores instead of just a few like CPUs have it can be massively parallelised.\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide30.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide31.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide32.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide33.PNG)\n\n## Results\n- All Bench marks were run by running the program on for all the test cases on the right for 100 generations.\n- The results taking from them were only the time taking to complete the 100 generations. This includes any additional time taking to copy memory or communication apart of a particular parallelisation method but doesn't included time taken to import or export data\n- in cases where multiple nodes finish at separate times the longest time was always take\n### Test Files\n| Tests | Test File                   | Cell count  |\n| ----- | --------------------------- | ----------- |\n| 1     | universalturingmachine.life | 400,000,000 |\n| 2     | turingmachine.life          | 100,000,000 |\n| 3     | turingmachine.life          | 25,000,000  |\n| 4     | sawtooth.life               | 1,000,000   |\n| 5     | ArrayGlider-100.life        | 562,500     |\n| 6     | ArrayGlider-100.life        | 250,000     |\n| 7     | ArrayGlider-100.life        | 625,00      |\n| 8     | ArrayGlider-100.life        | 100         |\n\n### Overall Results\n| Cells  | 400000000 | 100000000 | 25000000 | 1000000  | 562500   | 250000   | 62500    | 100      |\n| ------ | --------- | --------- | -------- | -------- | -------- | -------- | -------- | -------- |\n| Serial | 138.511s   | 34.6999s   | 8.8182s   | 0.350179s | 0.200059s | 0.08722s  | 0.022642s | 0.000261s |\n| OMP    | 43.9713s   | 11.1775s   | 3.09118s  | 0.114765s | 0.063866s | 0.047792s | 0.007799s | 0.000679s |\n| MPI    | 19853.1s   | 3622.52s   | 701.825s  | 13.4531s  | 6.55774s  | 3.15742s  | 1.06508s  | 0.085449s |\n| CUDA   | 3.28898s   | 0.700402s   | 0.220769s | 0.0779065s | 0.0782972s | 0.0751151s | 0.0730136s | 0.0720081s |\n\n### Induvidual Results\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide16.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide25.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide26.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide34.PNG)\n\n### Comparisons\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide36.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide37.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide38.PNG)\n![image](https://github.com/SixLeopard/Cellular_Automata_HPC/blob/main/Images/Slide39.PNG)\n\n### Review\n- Overall CUDA solution is the best as even though it lost in smaller tests it still only took roughly 0.07 seconds, meaning that its significantly better where the time to complete becomes significant\n- OpenMP being the best without using a GPU and MPI preforming fairly bad for this specific case\n\n## Possible Future Imporvements\n- storing the state in a run length encoded format to see if the added overhead of having to deal with the encoding would be faster then the time it takes to check redundant cells\n\n# Credits\n- Author: Jamie Westerhout\n- OpenMP: https://www.openmp.org/\n- MPI: https://www.open-mpi.org/\n- CUDA: https://developer.nvidia.com/cuda-toolkit\n\n#Note\nthis is recreation of the orignal repositry\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixleopard%2Fcellular_automata_hpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsixleopard%2Fcellular_automata_hpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixleopard%2Fcellular_automata_hpc/lists"}