Title: Out-of-bound access in the CUDA/SumReductionRevealed example · Issue #1 · essentialsofparallelcomputing/Chapter12 · GitHub
Open Graph Title: Out-of-bound access in the CUDA/SumReductionRevealed example · Issue #1 · essentialsofparallelcomputing/Chapter12
X Title: Out-of-bound access in the CUDA/SumReductionRevealed example · Issue #1 · essentialsofparallelcomputing/Chapter12
Description: when running the CUDA/SumReductionRevealed example I got output like this: ====== ITREE_LEVEL 1 offset 64 ntX is 128 MIN_REDUCE_SYNC_SIZE 32 ==== 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 1...
Open Graph Description: when running the CUDA/SumReductionRevealed example I got output like this: ====== ITREE_LEVEL 1 offset 64 ntX is 128 MIN_REDUCE_SYNC_SIZE 32 ==== 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 ...
X Description: when running the CUDA/SumReductionRevealed example I got output like this: ====== ITREE_LEVEL 1 offset 64 ntX is 128 MIN_REDUCE_SYNC_SIZE 32 ==== 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 ...
Opengraph URL: https://github.com/essentialsofparallelcomputing/Chapter12/issues/1
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Out-of-bound access in the CUDA/SumReductionRevealed example","articleBody":"when running the CUDA/SumReductionRevealed example I got output like this:\r\n\r\n```\r\n ====== ITREE_LEVEL 1 offset 64 ntX is 128 MIN_REDUCE_SYNC_SIZE 32 ====\r\n 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 \r\n320 322 324 326 328 330 332 334 136 137 1179 139 1027416214 1027423690 1381255598 1281312212 1279612629 1864380849 1702061816 875962631 1484025524 544434613 540553927 1598966244 1430537706 1398752732 1598246643 1163545070 540160956 1027423706 540553640 540619199 540029632 540095169 540160706 540226243 540291780 540357317 540422854 540488391 540553928 540619465 540029898 540095435 540160972 540226509 540292046 540357583 540423120 540488657 540554194 540619731 540030164 540095701 540161238 540226775 540292312 540357849 540423386 540488923 540554460 540619997 540030430 540095967 \r\nSum is 1482423102. Data count is reduced to 128\r\nSync threads when larger than warp\r\n```\r\n\r\nwhere the numbers in the second half go wild.\r\nI think the problem is around line 40:\r\n```\r\nif (tiX \u003c offset){\r\n array[giX]+=array[giX+offset];\r\n```\r\nwhen looping through the second grid, `giX` goes from 128 to 191, so `giX+offset` (offset=64 in the first round) goes beyond the size of `array` (200), leading to arbitrary numbers entering the summation. The real cuda example works because the array is first copied to `spad` with a boundary check, and `spad` was filled with 0 before copying.\r\n\r\nA possible fix would be changing the if condition to e.g. `if (tiX \u003c offset \u0026\u0026 (giX+offset) \u003c isize)`.","author":{"url":"https://github.com/cihe13375","@type":"Person","name":"cihe13375"},"datePublished":"2024-08-15T15:17:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1/Chapter12/issues/1"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9c5b5f26-866d-4154-2df3-3d85f514287d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A194:1A2C96:14CBC3:1BCDC6:6A62C526 |
| html-safe-nonce | ffe1ce22672d8e78fcf82ca83c2bf707ff3e9acdb51147557b9a36bbc6b3fe03 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTk0OjFBMkM5NjoxNENCQzM6MUJDREM2OjZBNjJDNTI2IiwidmlzaXRvcl9pZCI6IjgxNTUyMjYyODIxNDg0MTQ3NTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | db88cf634ef90c08162557a8b36152391b3de1ca422dbc8cabdd1a1545cc60ee |
| hovercard-subject-tag | issue:2468281546 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/essentialsofparallelcomputing/Chapter12/1/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ffc5dd6b6a27be9bc29e1623339b23dc7b180234892e8ead952675d29b50751/essentialsofparallelcomputing/Chapter12/issues/1 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ffc5dd6b6a27be9bc29e1623339b23dc7b180234892e8ead952675d29b50751/essentialsofparallelcomputing/Chapter12/issues/1 |
| og:image:alt | when running the CUDA/SumReductionRevealed example I got output like this: ====== ITREE_LEVEL 1 offset 64 ntX is 128 MIN_REDUCE_SYNC_SIZE 32 ==== 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cihe13375 |
| hostname | github.com |
| expected-hostname | github.com |
| None | df33b1b61ee7b9a0af988199bfc3503c9c1acafb1f1d40e1f140ea7c84f890dd |
| turbo-cache-control | no-preview |
| go-import | github.com/essentialsofparallelcomputing/Chapter12 git https://github.com/essentialsofparallelcomputing/Chapter12.git |
| octolytics-dimension-user_id | 50278728 |
| octolytics-dimension-user_login | essentialsofparallelcomputing |
| octolytics-dimension-repository_id | 233338423 |
| octolytics-dimension-repository_nwo | essentialsofparallelcomputing/Chapter12 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 233338423 |
| octolytics-dimension-repository_network_root_nwo | essentialsofparallelcomputing/Chapter12 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d41cd1bdb290013455c0ac430fa755621733f5eb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width