{"id":27099510,"url":"https://github.com/puzzlef/vector-sum-openmp","last_synced_at":"2025-07-21T10:33:00.052Z","repository":{"id":109078773,"uuid":"366451226","full_name":"puzzlef/vector-sum-openmp","owner":"puzzlef","description":"Comparing performance of sequential vs OpenMP-based vector element sum.","archived":false,"fork":false,"pushed_at":"2023-02-11T11:25:14.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T12:43:53.041Z","etag":null,"topics":["element","experiment","multi-threaded","openmp","sequential","single-threaded","sum","vector"],"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/puzzlef.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":"2021-05-11T16:41:29.000Z","updated_at":"2023-02-11T09:53:25.000Z","dependencies_parsed_at":"2023-04-21T13:55:29.742Z","dependency_job_id":null,"html_url":"https://github.com/puzzlef/vector-sum-openmp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"puzzlef/vector-multiplication-openmp","purl":"pkg:github/puzzlef/vector-sum-openmp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-sum-openmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-sum-openmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-sum-openmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-sum-openmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puzzlef","download_url":"https://codeload.github.com/puzzlef/vector-sum-openmp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-sum-openmp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266285490,"owners_count":23905361,"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":["element","experiment","multi-threaded","openmp","sequential","single-threaded","sum","vector"],"created_at":"2025-04-06T12:35:50.614Z","updated_at":"2025-07-21T10:33:00.045Z","avatar_url":"https://github.com/puzzlef.png","language":"C++","readme":"Comparing performance of *sequential* vs *OpenMP-based* **vector element sum**.\n\n\u003cbr\u003e\n\n\n### Adjusting OpenMP schedule\n\nIn this experiment ([adjust-schedule]), we sum together all values of a\nfloating-point vector `x`, with number of **elements** from `1E+6` to `1E+9`\nusing OpenMP. We attempt each element with various **OpenMP schedule**\n**configs**, running each config 5 times to get a good time measure. Sum here\nrepresents any `reduce()` operation that processes several values to a single\nvalue. Our results indicate a **schedule-kind** of `auto`/`guided` to be suitable.\n\n[adjust-schedule]: https://github.com/puzzlef/vector-sum-openmp/tree/adjust-schedule\n\n\u003cbr\u003e\n\n\n### Comparison with Sequential approach\n\nIn this experiment ([compare-sequential], [main]), we compare the performance\nbetween finding `Σx` using a single thread (**sequential**) or **OpenMP**. While\nit might seem that **OpenMP** method would be a clear winner, our results\nindicate it is dependent upon the workload, i.e., from `10⁵` elements, OpenMP\napproach performs *better* than sequential. All outputs are saved in [gist].\nSome [charts] are also included below, generated from [sheets].\n\n[compare-sequential]: https://github.com/puzzlef/vector-sum-openmp/tree/compare-sequential\n[main]: https://github.com/puzzlef/vector-sum-openmp\n\n\u003cbr\u003e\n\n[![](https://i.imgur.com/gdJQIVJ.png)][sheetp]\n[![](https://i.imgur.com/4VKbI6Q.png)][sheetp]\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## References\n\n- [Parallel for loop in openmp](https://stackoverflow.com/a/11773714/1413259)\n- [What's the difference between “static” and “dynamic” schedule in OpenMP?](https://stackoverflow.com/a/10852852/1413259)\n- [Git pulling a branch from another repository?](https://stackoverflow.com/a/46289324/1413259)\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n[![](https://i.imgur.com/Va4qBPD.jpg)](https://www.youtube.com/watch?v=0XTLuFpuAtE)\n![](https://ga-beacon.deno.dev/G-KD28SG54JQ:hbAybl6nQFOtmVxW4if3xw/github.com/puzzlef/vector-sum-openmp)\n\n[gist]: https://gist.github.com/wolfram77/9b90248012dda38727d57e12786ff40c\n[charts]: https://photos.app.goo.gl/ruBBeXTz6vEATFQc6\n[sheets]: https://docs.google.com/spreadsheets/d/1ZBp9TFxisTn_8_7_X_2HSPt_SbmP16gUW6_fiMtr8rc/edit?usp=sharing\n[sheetp]: https://docs.google.com/spreadsheets/d/e/2PACX-1vTPFQlVfelJvgStWlpUnmAWcTZZXpYbL4APW0nc0djGLIGJdWABXx6S2QLkrxHbct_jnXJ51JlB7cv7/pubhtml\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzlef%2Fvector-sum-openmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuzzlef%2Fvector-sum-openmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzlef%2Fvector-sum-openmp/lists"}