{"id":27099525,"url":"https://github.com/puzzlef/vector-multiplication-openmp","last_synced_at":"2025-10-12T18:50:29.794Z","repository":{"id":109078754,"uuid":"366376144","full_name":"puzzlef/vector-multiplication-openmp","owner":"puzzlef","description":"Comparing performance of sequential vs OpenMP-based element-by-element vector multiplication.","archived":false,"fork":false,"pushed_at":"2023-02-11T14:01:54.000Z","size":267,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T12:43:54.283Z","etag":null,"topics":["experiment","multi-threaded","multiply","openmp","sequential","single-threaded","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-11T12:35:32.000Z","updated_at":"2023-02-11T14:00:59.000Z","dependencies_parsed_at":"2023-06-26T00:54:48.609Z","dependency_job_id":null,"html_url":"https://github.com/puzzlef/vector-multiplication-openmp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/puzzlef/vector-multiplication-openmp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-multiplication-openmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-multiplication-openmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-multiplication-openmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-multiplication-openmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puzzlef","download_url":"https://codeload.github.com/puzzlef/vector-multiplication-openmp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzlef%2Fvector-multiplication-openmp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265198361,"owners_count":23726449,"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":["experiment","multi-threaded","multiply","openmp","sequential","single-threaded","vector"],"created_at":"2025-04-06T12:35:59.168Z","updated_at":"2025-10-12T18:50:24.737Z","avatar_url":"https://github.com/puzzlef.png","language":"C++","readme":"Comparing performance of *sequential* vs *OpenMP-based* **element-by-element vector multiplication**.\n\nIn each of the experiments given below, we multiply two floating-point vectors\n`x` and `y`, with number of **elements** from `10^6` to `10^9` using OpenMP.\nEach element count is attempted with various approaches, running each approach 5\ntimes to get a good time measure. Multiplication here represents any\nmemory-aligned independent operation, or a `map()` operation.\n\n\u003cbr\u003e\n\n\n### Adjusting OpenMP schedule\n\nIn this experiment ([adjust-schedule]), we multiply two floating-point vectors\n`x` and `y` using OpenMP. Each element count is attempted with various **OpenMP**\n**schedule configs**. Results indicate a **schedule-kind** of `auto` to be\nsuitable.\n\n[adjust-schedule]: https://github.com/puzzlef/vector-multiplication-openmp/tree/adjust-schedule\n\n\u003cbr\u003e\n\n\n### Comparision with Sequential implementation\n\nIn this experiment ([compare-sequential], [main]), we compare the performance\nbetween finding `x*y` using a single thread (**sequential**), and using\n**OpenMP**. Here `x`, `y` are both floating-point vectors, and the comparison in\nperformed on a number of vector sizes. Note that neither approach makes use of\n*SIMD instructions* which are available on all modern hardware. While it might\nseem that *OpenMP* method would be a clear winner, the results indicate it is\n*not the case*. This is possibly because of high communication costs, and not\nenough computational workload as indicated by [this answer]. However, **from 10⁸**\n**elements, OpenMP approach performs better** than sequential. All outputs are\nsaved in [gist]. Some [charts] are also included below, generated from [sheets].\n\n[![](https://i.imgur.com/Izuc0gw.png)][sheetp]\n[![](https://i.imgur.com/kGKSaG3.png)][sheetp]\n\n[compare-sequential]: https://github.com/puzzlef/vector-multiplication-openmp/tree/compare-sequential\n[main]: https://github.com/puzzlef/vector-multiplication-openmp\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## References\n\n- [open MP - dot product][this answer]\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/gHjBLSG.jpg)](https://www.youtube.com/watch?v=0XTLuFpuAtE)\n![](https://ga-beacon.deno.dev/G-KD28SG54JQ:hbAybl6nQFOtmVxW4if3xw/github.com/puzzlef/vector-multiplication-openmp)\n\n[this answer]: https://stackoverflow.com/a/5368572/1413259\n[gist]: https://gist.github.com/wolfram77/f9dae5ec1b65ff87b65ab30deb3b1aa9\n[charts]: https://photos.app.goo.gl/qfFxpy6v886ZQhja8\n[sheets]: https://docs.google.com/spreadsheets/d/1IdlGlGqvn-Gprb5cpgzZU9QU3dfo3SgySajN5oDgkeQ/edit?usp=sharing\n[sheetp]: https://docs.google.com/spreadsheets/d/e/2PACX-1vQvlt3NQwk-G2wh-LjDn9KhL2gbk2C9RKfW0OQRzmDw7UhoEdCx6KBTN1xuv7Svg_eTQbmjj_92SOkw/pubhtml\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzlef%2Fvector-multiplication-openmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuzzlef%2Fvector-multiplication-openmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzlef%2Fvector-multiplication-openmp/lists"}