{"id":19237671,"url":"https://github.com/adamouization/relaxation-technique-parallel-computing","last_synced_at":"2026-06-23T10:32:11.188Z","repository":{"id":78089335,"uuid":"156097413","full_name":"Adamouization/Relaxation-Technique-Parallel-Computing","owner":"Adamouization","description":":repeat: Relaxation technique using POSIX threads (shared memory configuration) and MPI (distributed memory configuration).","archived":false,"fork":false,"pushed_at":"2019-01-08T13:47:06.000Z","size":1762,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-08T19:31:22.017Z","etag":null,"topics":["c","distributed-memory","distributed-systems","mpi","parallel-programming","posix-threads","pthreads","shared-memory"],"latest_commit_sha":null,"homepage":"","language":"C","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/Adamouization.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":"2018-11-04T15:41:27.000Z","updated_at":"2022-10-24T17:27:10.000Z","dependencies_parsed_at":"2023-05-01T15:46:07.375Z","dependency_job_id":null,"html_url":"https://github.com/Adamouization/Relaxation-Technique-Parallel-Computing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Adamouization/Relaxation-Technique-Parallel-Computing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamouization%2FRelaxation-Technique-Parallel-Computing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamouization%2FRelaxation-Technique-Parallel-Computing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamouization%2FRelaxation-Technique-Parallel-Computing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamouization%2FRelaxation-Technique-Parallel-Computing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adamouization","download_url":"https://codeload.github.com/Adamouization/Relaxation-Technique-Parallel-Computing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamouization%2FRelaxation-Technique-Parallel-Computing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34686725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","distributed-memory","distributed-systems","mpi","parallel-programming","posix-threads","pthreads","shared-memory"],"created_at":"2024-11-09T16:27:48.309Z","updated_at":"2026-06-23T10:32:11.167Z","avatar_url":"https://github.com/Adamouization.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Relaxation Technique Parallelised in C using Pthreads and MPI\n\n## Problem Description\n\nThe objective of this assignment is to use low-level primitive parallelism constructs, first on a shared memory architecture then on a distributed memory architecture, and analyse how parallel problems scale on such an architectures using C, pthreads and MPI on Balena, a mid-sized cluster with 2720 cpu cores.\n\nThe background is a method called relaxation technique, a solution to differential equations, which is achieved by having a square array of values and repeatedly replacing a value with the average of its four neighbours, excepting boundaries values which remain fixed. This process is repeated until all values settle down to within a given precision.\n\n## Usage\n\n### Shared Memory Architecture (pthreads)\n\n* Compile using the makefile: `make`, or `gcc main.c array_helpers.c print_helpers.c -o shared_relaxation -pthread -Wall -Wextra -Wconversion`\n* Run: `./shared_relaxation \u003cnumber_of_threads\u003e`\n\n### Distributed Memory Architecture (MPI)\n\n* Compile using the makefile: `make` or: `mpicc -Wall -Wextra -Wconversion main.c -o distributed_relaxation -lm`\n* Run: `mpirun -np \u003cnum_processes\u003e ./distributed_relaxation -d \u003cdimension\u003e -p \u003cprecision\u003e -debug \u003cdebug mode\u003e`\n\nwhere:\n* -np corresponds to the number of processes;\n* -d corresponds to the dimensions of the square array;\n* -p corresponds to the precision of the relaxation;\n* -debug corresponds to the debug mode (0: only essential information, 1: row allocation logs, 2: process IDs logs, 3: initial and \fnal arrays, 4: iteration debugging data).\n\n### Other\n\n#### Running the shared memory architecture on the Balena cluster using SLURM\n\n* SSH into Balena: `ssh [user_name]@balena.bath.ac.uk`\n* `cd` into the project directory and submit the SLURM job script [`job.slurm`](https://github.com/Adamouization/Parallel-Computing-Relaxion-Shared-Memory/blob/master/job.slurm) to the queue: `sbatch jobscript.slurm`\n* Monitor the job in the queue: `squeue -u [user_name]`\n* View the results in the `relaxation.\u003cjob_id\u003e.out` file using the `cat *.out` command.\n\n#### Submitting multiple files using a bash script (shared memory testing)\n\n* `./submit_multiple_batch 1`\n* `cat *.out`\n* Use following regex to retrieve time by using this regex `\\=.(\\d+)\\..(\\d+)` and pasting the output in [regex101](https://regex101.com/)\n\n#### Copying files to/from Balena\n\n* from BUCS to Balena: `cp $BUCSHOME/dos/year\\ 4/Relaxation-Technique-Parallel-Computing/src/\u003cfile\u003e /home/o/aj645/scratch/cw2-distributed-architecture/`\n\n* from Balena to BUCS: `cp /home/o/aj645/scratch/cw2-distributed-architecture/\u003cfile\u003e $BUCSHOME/dos/year\\ 4/Relaxation-Technique-Parallel-Computing`\n\n## Reports\n\n* You can read the shared architecture implementation using pthreads report [here](https://github.com/Adamouization/Relaxation-Technique-Parallel-Computing/blob/master/reports/shared_architecture_report.pdf).\n* You can read the distributed architecture implementation using MPI report [here](https://github.com/Adamouization/Relaxation-Technique-Parallel-Computing/blob/master/reports/distributed_architecture_report.pdf).\n\n## TODO\n\nSee [TODO.md](https://github.com/Adamouization/Relaxation-Technique-Parallel-Computing/blob/master/TODO.md)\n\n## License \n* see [LICENSE](https://github.com/Adamouization/Relaxation-Technique-Parallel-Computing/blob/master/LICENSE) file.\n\n## Contact\n* email: adam@jaamour.com\n* website: www.adam.jaamour.com\n* twitter: [@Adamouization](https://twitter.com/Adamouization)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamouization%2Frelaxation-technique-parallel-computing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamouization%2Frelaxation-technique-parallel-computing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamouization%2Frelaxation-technique-parallel-computing/lists"}