{"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/329042466","pull_request_review_id":294285393,"id":329042466,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyOTA0MjQ2Ng==","diff_hunk":"@@ -131,42 +143,67 @@ namespace internal\n                         level, level_dof_indices[i]))\n                     continue;\n \n-                  types::global_dof_index global_idx =\n-                    globally_relevant.index_within_set(global_dof_indices[i]);\n-                  // skip if we did this global dof already (on this or a\n-                  // coarser level)\n-                  if (dof_touched[global_idx])\n-                    continue;\n                   bool global_mine = mg_dof.locally_owned_dofs().is_element(\n                     global_dof_indices[i]);\n                   bool level_mine =\n                     mg_dof.locally_owned_mg_dofs(level).is_element(\n                       level_dof_indices[i]);\n \n-\n                   if (global_mine && level_mine)\n                     {\n-                      copy_indices[level].emplace_back(global_dof_indices[i],\n-                                                       level_dof_indices[i]);\n-                    }\n-                  else if (global_mine)\n-                    {\n-                      copy_indices_global_mine[level].emplace_back(\n-                        global_dof_indices[i], level_dof_indices[i]);\n-\n-                      // send this to the owner of the level_dof:\n-                      send_data_temp.emplace_back(level,\n-                                                  global_dof_indices[i],\n-                                                  level_dof_indices[i]);\n+                      // we own both the active dof index and the level one ->\n+                      // set them into the vector, indexed by the local index\n+                      // range of the active dof\n+                      unrolled_copy_indices[mg_dof.locally_owned_dofs()\n+                                              .index_within_set(\n+                                                global_dof_indices[i])] =\n+                        level_dof_indices[i];\n                     }\n                   else\n                     {\n-                      // somebody will send those to me\n-                    }\n+                      // now we collect them in the pair\n+                      const unsigned int relevant_idx =\n+                        globally_relevant.index_within_set(\n+                          global_dof_indices[i]);\n+\n+                      // skip if we did this global dof already (on this or a\n+                      // coarser level)\n+                      if (dof_touched[relevant_idx])\n+                        continue;\n+\n+                      if (global_mine)\n+                        {\n+                          copy_indices_global_mine[level].emplace_back(\n+                            global_dof_indices[i], level_dof_indices[i]);\n+\n+                          // send this to the owner of the level_dof:\n+                          send_data_temp.emplace_back(level,\n+                                                      global_dof_indices[i],\n+                                                      level_dof_indices[i]);\n+                        }\n+                      else\n+                        {\n+                          // somebody will send those to me\n+                        }\n \n-                  dof_touched[global_idx] = true;\n+                      dof_touched[relevant_idx] = true;\n+                    }\n                 }\n             }\n+\n+          // we now translate the plain vector for the copy_indices field into\n+          // the expected format of a pair of indices.\n+          if (has_active_cells_on_this_level)\n+            {\n+              copy_indices[level] = {};\n+              if (copy_indices_global_mine[level].empty())\n+                copy_indices[level].reserve(unrolled_copy_indices.size());\n+              for (unsigned int i = 0; i < unrolled_copy_indices.size(); ++i)\n+                if (unrolled_copy_indices[i] != numbers::invalid_dof_index)\n+                  copy_indices[level].emplace_back(\n+                    mg_dof.locally_owned_dofs().nth_index_in_set(i),","path":"source/multigrid/mg_transfer_internal.cc","position":128,"original_position":128,"commit_id":"0af44f379ed44125df0be225d83d7b0a242b8ce1","original_commit_id":"0af44f379ed44125df0be225d83d7b0a242b8ce1","user":{"login":"kronbichler","id":8276200,"node_id":"MDQ6VXNlcjgyNzYyMDA=","avatar_url":"https://avatars0.githubusercontent.com/u/8276200?v=4","gravatar_id":"","url":"https://api.github.com/users/kronbichler","html_url":"https://github.com/kronbichler","followers_url":"https://api.github.com/users/kronbichler/followers","following_url":"https://api.github.com/users/kronbichler/following{/other_user}","gists_url":"https://api.github.com/users/kronbichler/gists{/gist_id}","starred_url":"https://api.github.com/users/kronbichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronbichler/subscriptions","organizations_url":"https://api.github.com/users/kronbichler/orgs","repos_url":"https://api.github.com/users/kronbichler/repos","events_url":"https://api.github.com/users/kronbichler/events{/privacy}","received_events_url":"https://api.github.com/users/kronbichler/received_events","type":"User","site_admin":false},"body":"No, because they are on locally owned dofs; I added comments.","created_at":"2019-09-27T12:14:54Z","updated_at":"2019-09-27T12:14:54Z","html_url":"https://github.com/dealii/dealii/pull/8811#discussion_r329042466","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/8811","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/329042466"},"html":{"href":"https://github.com/dealii/dealii/pull/8811#discussion_r329042466"},"pull_request":{"href":"https://api.github.com/repos/dealii/dealii/pulls/8811"}},"in_reply_to_id":328911491},"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/8811","id":319623039,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE5NjIzMDM5","html_url":"https://github.com/dealii/dealii/pull/8811","diff_url":"https://github.com/dealii/dealii/pull/8811.diff","patch_url":"https://github.com/dealii/dealii/pull/8811.patch","issue_url":"https://api.github.com/repos/dealii/dealii/issues/8811","number":8811,"state":"open","locked":false,"title":"Avoid sorting a large array in MG fill_copy_indices","user":{"login":"kronbichler","id":8276200,"node_id":"MDQ6VXNlcjgyNzYyMDA=","avatar_url":"https://avatars0.githubusercontent.com/u/8276200?v=4","gravatar_id":"","url":"https://api.github.com/users/kronbichler","html_url":"https://github.com/kronbichler","followers_url":"https://api.github.com/users/kronbichler/followers","following_url":"https://api.github.com/users/kronbichler/following{/other_user}","gists_url":"https://api.github.com/users/kronbichler/gists{/gist_id}","starred_url":"https://api.github.com/users/kronbichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronbichler/subscriptions","organizations_url":"https://api.github.com/users/kronbichler/orgs","repos_url":"https://api.github.com/users/kronbichler/repos","events_url":"https://api.github.com/users/kronbichler/events{/privacy}","received_events_url":"https://api.github.com/users/kronbichler/received_events","type":"User","site_admin":false},"body":"This is one of the last performance improvements I plan for now, given an inspection of `step-37` and `step-59`, apart from the open issue #8785 and some of my open PRs.\r\n\r\nIn this PR, I replace adding some copy indices and later sorting them by adding them into an appropriate array with direct access, and later picking those numbers that were actually touched. This is for the case in the `copy_indices` where both the level dof and the global dof are locally owned, which is the most usual one with more than 95% of indices filled. The old solution of adding them at the back of a vector is still used for the rare indices global-mine/level-remote, where having a full vector does of course make less sense.","created_at":"2019-09-20T08:55:27Z","updated_at":"2019-09-27T12:14:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ec68fba927f0eee4dc78d1340fbd6205463dba3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":481884087,"node_id":"MDU6TGFiZWw0ODE4ODQwODc=","url":"https://api.github.com/repos/dealii/dealii/labels/Geometric%20multigrid","name":"Geometric multigrid","color":"bfd4f2","default":false},{"id":1049482938,"node_id":"MDU6TGFiZWwxMDQ5NDgyOTM4","url":"https://api.github.com/repos/dealii/dealii/labels/ready%20to%20test","name":"ready to test","color":"24f287","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dealii/dealii/pulls/8811/commits","review_comments_url":"https://api.github.com/repos/dealii/dealii/pulls/8811/comments","review_comment_url":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/8811/comments","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/0af44f379ed44125df0be225d83d7b0a242b8ce1","head":{"label":"kronbichler:speedup_mg_transfer_copy_indices","ref":"speedup_mg_transfer_copy_indices","sha":"0af44f379ed44125df0be225d83d7b0a242b8ce1","user":{"login":"kronbichler","id":8276200,"node_id":"MDQ6VXNlcjgyNzYyMDA=","avatar_url":"https://avatars0.githubusercontent.com/u/8276200?v=4","gravatar_id":"","url":"https://api.github.com/users/kronbichler","html_url":"https://github.com/kronbichler","followers_url":"https://api.github.com/users/kronbichler/followers","following_url":"https://api.github.com/users/kronbichler/following{/other_user}","gists_url":"https://api.github.com/users/kronbichler/gists{/gist_id}","starred_url":"https://api.github.com/users/kronbichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronbichler/subscriptions","organizations_url":"https://api.github.com/users/kronbichler/orgs","repos_url":"https://api.github.com/users/kronbichler/repos","events_url":"https://api.github.com/users/kronbichler/events{/privacy}","received_events_url":"https://api.github.com/users/kronbichler/received_events","type":"User","site_admin":false},"repo":{"id":22549298,"node_id":"MDEwOlJlcG9zaXRvcnkyMjU0OTI5OA==","name":"dealii","full_name":"kronbichler/dealii","private":false,"owner":{"login":"kronbichler","id":8276200,"node_id":"MDQ6VXNlcjgyNzYyMDA=","avatar_url":"https://avatars0.githubusercontent.com/u/8276200?v=4","gravatar_id":"","url":"https://api.github.com/users/kronbichler","html_url":"https://github.com/kronbichler","followers_url":"https://api.github.com/users/kronbichler/followers","following_url":"https://api.github.com/users/kronbichler/following{/other_user}","gists_url":"https://api.github.com/users/kronbichler/gists{/gist_id}","starred_url":"https://api.github.com/users/kronbichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronbichler/subscriptions","organizations_url":"https://api.github.com/users/kronbichler/orgs","repos_url":"https://api.github.com/users/kronbichler/repos","events_url":"https://api.github.com/users/kronbichler/events{/privacy}","received_events_url":"https://api.github.com/users/kronbichler/received_events","type":"User","site_admin":false},"html_url":"https://github.com/kronbichler/dealii","description":"The development repository for the deal.II finite element library.","fork":true,"url":"https://api.github.com/repos/kronbichler/dealii","forks_url":"https://api.github.com/repos/kronbichler/dealii/forks","keys_url":"https://api.github.com/repos/kronbichler/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kronbichler/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kronbichler/dealii/teams","hooks_url":"https://api.github.com/repos/kronbichler/dealii/hooks","issue_events_url":"https://api.github.com/repos/kronbichler/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/kronbichler/dealii/events","assignees_url":"https://api.github.com/repos/kronbichler/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/kronbichler/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/kronbichler/dealii/tags","blobs_url":"https://api.github.com/repos/kronbichler/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kronbichler/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kronbichler/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/kronbichler/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kronbichler/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/kronbichler/dealii/languages","stargazers_url":"https://api.github.com/repos/kronbichler/dealii/stargazers","contributors_url":"https://api.github.com/repos/kronbichler/dealii/contributors","subscribers_url":"https://api.github.com/repos/kronbichler/dealii/subscribers","subscription_url":"https://api.github.com/repos/kronbichler/dealii/subscription","commits_url":"https://api.github.com/repos/kronbichler/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/kronbichler/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/kronbichler/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/kronbichler/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/kronbichler/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/kronbichler/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kronbichler/dealii/merges","archive_url":"https://api.github.com/repos/kronbichler/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kronbichler/dealii/downloads","issues_url":"https://api.github.com/repos/kronbichler/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/kronbichler/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/kronbichler/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/kronbichler/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kronbichler/dealii/labels{/name}","releases_url":"https://api.github.com/repos/kronbichler/dealii/releases{/id}","deployments_url":"https://api.github.com/repos/kronbichler/dealii/deployments","created_at":"2014-08-02T15:52:43Z","updated_at":"2019-09-10T10:08:41Z","pushed_at":"2019-09-25T10:15:13Z","git_url":"git://github.com/kronbichler/dealii.git","ssh_url":"git@github.com:kronbichler/dealii.git","clone_url":"https://github.com/kronbichler/dealii.git","svn_url":"https://github.com/kronbichler/dealii","homepage":"http://www.dealii.org/","size":225232,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dealii:master","ref":"master","sha":"f0f3ab0d230cb1046f48150fdcd897cd9456c0a4","user":{"login":"dealii","id":7506070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MDYwNzA=","avatar_url":"https://avatars3.githubusercontent.com/u/7506070?v=4","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"repo":{"id":21943980,"node_id":"MDEwOlJlcG9zaXRvcnkyMTk0Mzk4MA==","name":"dealii","full_name":"dealii/dealii","private":false,"owner":{"login":"dealii","id":7506070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MDYwNzA=","avatar_url":"https://avatars3.githubusercontent.com/u/7506070?v=4","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dealii/dealii","description":"The development repository for the deal.II finite element library.","fork":false,"url":"https://api.github.com/repos/dealii/dealii","forks_url":"https://api.github.com/repos/dealii/dealii/forks","keys_url":"https://api.github.com/repos/dealii/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dealii/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dealii/dealii/teams","hooks_url":"https://api.github.com/repos/dealii/dealii/hooks","issue_events_url":"https://api.github.com/repos/dealii/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/dealii/dealii/events","assignees_url":"https://api.github.com/repos/dealii/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/dealii/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/dealii/dealii/tags","blobs_url":"https://api.github.com/repos/dealii/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dealii/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dealii/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/dealii/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/dealii/dealii/languages","stargazers_url":"https://api.github.com/repos/dealii/dealii/stargazers","contributors_url":"https://api.github.com/repos/dealii/dealii/contributors","subscribers_url":"https://api.github.com/repos/dealii/dealii/subscribers","subscription_url":"https://api.github.com/repos/dealii/dealii/subscription","commits_url":"https://api.github.com/repos/dealii/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/dealii/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/dealii/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/dealii/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/dealii/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/dealii/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dealii/dealii/merges","archive_url":"https://api.github.com/repos/dealii/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dealii/dealii/downloads","issues_url":"https://api.github.com/repos/dealii/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/dealii/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/dealii/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/dealii/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dealii/dealii/labels{/name}","releases_url":"https://api.github.com/repos/dealii/dealii/releases{/id}","deployments_url":"https://api.github.com/repos/dealii/dealii/deployments","created_at":"2014-07-17T14:00:26Z","updated_at":"2019-09-27T07:03:33Z","pushed_at":"2019-09-27T07:03:30Z","git_url":"git://github.com/dealii/dealii.git","ssh_url":"git@github.com:dealii/dealii.git","clone_url":"https://github.com/dealii/dealii.git","svn_url":"https://github.com/dealii/dealii","homepage":"https://www.dealii.org/","size":225777,"stargazers_count":526,"watchers_count":526,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":410,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":414,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":410,"open_issues":414,"watchers":526,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/8811"},"html":{"href":"https://github.com/dealii/dealii/pull/8811"},"issue":{"href":"https://api.github.com/repos/dealii/dealii/issues/8811"},"comments":{"href":"https://api.github.com/repos/dealii/dealii/issues/8811/comments"},"review_comments":{"href":"https://api.github.com/repos/dealii/dealii/pulls/8811/comments"},"review_comment":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dealii/dealii/pulls/8811/commits"},"statuses":{"href":"https://api.github.com/repos/dealii/dealii/statuses/0af44f379ed44125df0be225d83d7b0a242b8ce1"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kronbichler"}}