{"action":"created","comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/66512281","id":66512281,"diff_hunk":"@@ -117,6 +118,82 @@ class SparseBlockDom: BaseSparseDom {\n     dsiAdd((ind,));\n   }\n \n+  proc dsiBulkAdd(inds: [] index(rank, idxType), isSorted=false, isUnique=false,\n+      preserveInds=true){\n+  \n+    if !isSorted && preserveInds {\n+      var _inds = inds;\n+      bulkAdd_help(_inds, isSorted, isUnique); \n+    }\n+    else {\n+      bulkAdd_help(inds, isSorted, isUnique);\n+    }\n+  }\n+\n+  // Tried to put this record in the function and the if statement, but got a\n+  // segfault from the compiler.\n+  record TargetLocaleComparator {\n+\n+    // I wish I could return tuple from key function. There are checks to see\n+    // if the type of the function is numeric/string. Maybe there should be\n+    // isComparable that can do recursive checks for at least tuples of\n+    // numericals/strings/comparables.\n+    // In general being able to return tuples from key() can enable sorting with\n+    // multiple keys.\n+\n+    //proc key(a: index(rank, idxType)) { \n+    //  return dist.targetLocales[dist.targetLocsIdx(a)].id; \n+    //}\n+\n+    proc compare(a: index(rank, idxType), b: index(rank, idxType)) {\n+      var locDif = dist.targetLocales[dist.targetLocsIdx(a)].id -\n+        dist .targetLocales[dist.targetLocsIdx(b)].id;\n+\n+      if locDif != 0 then return locDif;\n+\n+      if a < b then return -1;\n+      if a > b then return 1;\n+      return 0;\n+    }\n+  }\n+\n+  proc bulkAdd_help(inds: [] index(rank,idxType), isSorted=false, isUnique=false) {\n+\n+    if !isSorted {\n+\n+      // without _new_ record functions throw null deref. It doesn't seem to be \n+      // able to deref _outer_ ? I think it has something to do with memory\n+      // allocation for classes vs records, but I cannot explain\n+      var comp = new TargetLocaleComparator;\n+      sort(inds, comparator=comp);\n+    }\n+\n+    var active : atomic int;\n+    var firstIndex = inds.domain.low;\n+    var curLoc = dist.targetLocsIdx(inds[inds.domain.low]);\n+\n+    for i in inds.domain {\n+      const _tmpLoc = dist.targetLocsIdx(inds[i]);\n+      if _tmpLoc != curLoc {\n+        spawnBulkAdd(firstIndex..i-1, curLoc);\n+        curLoc = _tmpLoc;\n+        firstIndex = i;\n+      }\n+    }\n+    spawnBulkAdd(firstIndex..inds.domain.high, curLoc);\n+\n+    active.waitFor(0);\n+\n+    proc spawnBulkAdd(indsRange: range, loc){\n+      active.add(1);\n+      begin on dist.targetLocales(loc) {","path":"modules/dists/SparseBlockDist.chpl","position":80,"original_position":80,"commit_id":"0059cff01370346b67bcadb4cb5d748d5909460c","original_commit_id":"0059cff01370346b67bcadb4cb5d748d5909460c","user":{"login":"e-kayrakli","id":4141670,"avatar_url":"https://avatars.githubusercontent.com/u/4141670?v=3","gravatar_id":"","url":"https://api.github.com/users/e-kayrakli","html_url":"https://github.com/e-kayrakli","followers_url":"https://api.github.com/users/e-kayrakli/followers","following_url":"https://api.github.com/users/e-kayrakli/following{/other_user}","gists_url":"https://api.github.com/users/e-kayrakli/gists{/gist_id}","starred_url":"https://api.github.com/users/e-kayrakli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e-kayrakli/subscriptions","organizations_url":"https://api.github.com/users/e-kayrakli/orgs","repos_url":"https://api.github.com/users/e-kayrakli/repos","events_url":"https://api.github.com/users/e-kayrakli/events{/privacy}","received_events_url":"https://api.github.com/users/e-kayrakli/received_events","type":"User","site_admin":false},"body":"I am not entirely sure if this is the right way of spawning tasks here, mostly due to my ignorance of mechanics of on statement. Should it be\r\n```\r\non dist.targetLocales(loc) do begin {\r\n```\r\nWhich I would think to be more costly with my current understanding.","created_at":"2016-06-09T20:07:33Z","updated_at":"2016-06-09T20:07:33Z","html_url":"https://github.com/chapel-lang/chapel/pull/3994#discussion_r66512281","pull_request_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994","_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/66512281"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3994#discussion_r66512281"},"pull_request":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994"}}},"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994","id":72977364,"html_url":"https://github.com/chapel-lang/chapel/pull/3994","diff_url":"https://github.com/chapel-lang/chapel/pull/3994.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/3994.patch","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/3994","number":3994,"state":"open","locked":false,"title":"+= support for SparseBlockDist","user":{"login":"e-kayrakli","id":4141670,"avatar_url":"https://avatars.githubusercontent.com/u/4141670?v=3","gravatar_id":"","url":"https://api.github.com/users/e-kayrakli","html_url":"https://github.com/e-kayrakli","followers_url":"https://api.github.com/users/e-kayrakli/followers","following_url":"https://api.github.com/users/e-kayrakli/following{/other_user}","gists_url":"https://api.github.com/users/e-kayrakli/gists{/gist_id}","starred_url":"https://api.github.com/users/e-kayrakli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e-kayrakli/subscriptions","organizations_url":"https://api.github.com/users/e-kayrakli/orgs","repos_url":"https://api.github.com/users/e-kayrakli/repos","events_url":"https://api.github.com/users/e-kayrakli/events{/privacy}","received_events_url":"https://api.github.com/users/e-kayrakli/received_events","type":"User","site_admin":false},"body":"This PR is an extension of recently merged #3948 \r\n\r\nAdds += and bulkAdd support for SparseBlockDist. Also ports tests from #3948 for multilocale.\r\n\r\nNote: dsiBulkAdd in SparseBlockDist uses memoization(much simpler then it sounds) to figure out locale of an index. I am not 100% sure on it out-performing non-memoized version on actual multi-locale runs. Therefore I added a config param bulkAddMemoize to switch it off.\r\n\r\nLabeling as WIP for performance tests of memoization.","created_at":"2016-06-08T02:18:08Z","updated_at":"2016-06-09T20:07:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdcaf578d1c8776f1223524ab1e1a42fb9583fa2","assignee":{"login":"mppf","id":3653132,"avatar_url":"https://avatars.githubusercontent.com/u/3653132?v=3","gravatar_id":"","url":"https://api.github.com/users/mppf","html_url":"https://github.com/mppf","followers_url":"https://api.github.com/users/mppf/followers","following_url":"https://api.github.com/users/mppf/following{/other_user}","gists_url":"https://api.github.com/users/mppf/gists{/gist_id}","starred_url":"https://api.github.com/users/mppf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mppf/subscriptions","organizations_url":"https://api.github.com/users/mppf/orgs","repos_url":"https://api.github.com/users/mppf/repos","events_url":"https://api.github.com/users/mppf/events{/privacy}","received_events_url":"https://api.github.com/users/mppf/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994/commits","review_comments_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994/comments","review_comment_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/3994/comments","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/0059cff01370346b67bcadb4cb5d748d5909460c","head":{"label":"e-kayrakli:sparse-bulk-op-dist","ref":"sparse-bulk-op-dist","sha":"0059cff01370346b67bcadb4cb5d748d5909460c","user":{"login":"e-kayrakli","id":4141670,"avatar_url":"https://avatars.githubusercontent.com/u/4141670?v=3","gravatar_id":"","url":"https://api.github.com/users/e-kayrakli","html_url":"https://github.com/e-kayrakli","followers_url":"https://api.github.com/users/e-kayrakli/followers","following_url":"https://api.github.com/users/e-kayrakli/following{/other_user}","gists_url":"https://api.github.com/users/e-kayrakli/gists{/gist_id}","starred_url":"https://api.github.com/users/e-kayrakli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e-kayrakli/subscriptions","organizations_url":"https://api.github.com/users/e-kayrakli/orgs","repos_url":"https://api.github.com/users/e-kayrakli/repos","events_url":"https://api.github.com/users/e-kayrakli/events{/privacy}","received_events_url":"https://api.github.com/users/e-kayrakli/received_events","type":"User","site_admin":false},"repo":{"id":58942509,"name":"chapel","full_name":"e-kayrakli/chapel","owner":{"login":"e-kayrakli","id":4141670,"avatar_url":"https://avatars.githubusercontent.com/u/4141670?v=3","gravatar_id":"","url":"https://api.github.com/users/e-kayrakli","html_url":"https://github.com/e-kayrakli","followers_url":"https://api.github.com/users/e-kayrakli/followers","following_url":"https://api.github.com/users/e-kayrakli/following{/other_user}","gists_url":"https://api.github.com/users/e-kayrakli/gists{/gist_id}","starred_url":"https://api.github.com/users/e-kayrakli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/e-kayrakli/subscriptions","organizations_url":"https://api.github.com/users/e-kayrakli/orgs","repos_url":"https://api.github.com/users/e-kayrakli/repos","events_url":"https://api.github.com/users/e-kayrakli/events{/privacy}","received_events_url":"https://api.github.com/users/e-kayrakli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/e-kayrakli/chapel","description":"a Productive Parallel Programming Language","fork":true,"url":"https://api.github.com/repos/e-kayrakli/chapel","forks_url":"https://api.github.com/repos/e-kayrakli/chapel/forks","keys_url":"https://api.github.com/repos/e-kayrakli/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/e-kayrakli/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/e-kayrakli/chapel/teams","hooks_url":"https://api.github.com/repos/e-kayrakli/chapel/hooks","issue_events_url":"https://api.github.com/repos/e-kayrakli/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/e-kayrakli/chapel/events","assignees_url":"https://api.github.com/repos/e-kayrakli/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/e-kayrakli/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/e-kayrakli/chapel/tags","blobs_url":"https://api.github.com/repos/e-kayrakli/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/e-kayrakli/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/e-kayrakli/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/e-kayrakli/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/e-kayrakli/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/e-kayrakli/chapel/languages","stargazers_url":"https://api.github.com/repos/e-kayrakli/chapel/stargazers","contributors_url":"https://api.github.com/repos/e-kayrakli/chapel/contributors","subscribers_url":"https://api.github.com/repos/e-kayrakli/chapel/subscribers","subscription_url":"https://api.github.com/repos/e-kayrakli/chapel/subscription","commits_url":"https://api.github.com/repos/e-kayrakli/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/e-kayrakli/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/e-kayrakli/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/e-kayrakli/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/e-kayrakli/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/e-kayrakli/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/e-kayrakli/chapel/merges","archive_url":"https://api.github.com/repos/e-kayrakli/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/e-kayrakli/chapel/downloads","issues_url":"https://api.github.com/repos/e-kayrakli/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/e-kayrakli/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/e-kayrakli/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/e-kayrakli/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/e-kayrakli/chapel/labels{/name}","releases_url":"https://api.github.com/repos/e-kayrakli/chapel/releases{/id}","deployments_url":"https://api.github.com/repos/e-kayrakli/chapel/deployments","created_at":"2016-05-16T15:13:42Z","updated_at":"2016-05-16T15:14:09Z","pushed_at":"2016-06-09T20:01:32Z","git_url":"git://github.com/e-kayrakli/chapel.git","ssh_url":"git@github.com:e-kayrakli/chapel.git","clone_url":"https://github.com/e-kayrakli/chapel.git","svn_url":"https://github.com/e-kayrakli/chapel","homepage":"http://chapel.cray.com/","size":363158,"stargazers_count":0,"watchers_count":0,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"chapel-lang:master","ref":"master","sha":"768fe9fe548ec6e056a64f386510efcef5b4f7a6","user":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":21663285,"name":"chapel","full_name":"chapel-lang/chapel","owner":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chapel-lang/chapel","description":"a Productive Parallel Programming Language","fork":false,"url":"https://api.github.com/repos/chapel-lang/chapel","forks_url":"https://api.github.com/repos/chapel-lang/chapel/forks","keys_url":"https://api.github.com/repos/chapel-lang/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chapel-lang/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chapel-lang/chapel/teams","hooks_url":"https://api.github.com/repos/chapel-lang/chapel/hooks","issue_events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/chapel-lang/chapel/events","assignees_url":"https://api.github.com/repos/chapel-lang/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/chapel-lang/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/chapel-lang/chapel/tags","blobs_url":"https://api.github.com/repos/chapel-lang/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chapel-lang/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chapel-lang/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/chapel-lang/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/chapel-lang/chapel/languages","stargazers_url":"https://api.github.com/repos/chapel-lang/chapel/stargazers","contributors_url":"https://api.github.com/repos/chapel-lang/chapel/contributors","subscribers_url":"https://api.github.com/repos/chapel-lang/chapel/subscribers","subscription_url":"https://api.github.com/repos/chapel-lang/chapel/subscription","commits_url":"https://api.github.com/repos/chapel-lang/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/chapel-lang/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/chapel-lang/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/chapel-lang/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chapel-lang/chapel/merges","archive_url":"https://api.github.com/repos/chapel-lang/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chapel-lang/chapel/downloads","issues_url":"https://api.github.com/repos/chapel-lang/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/chapel-lang/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/chapel-lang/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/chapel-lang/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chapel-lang/chapel/labels{/name}","releases_url":"https://api.github.com/repos/chapel-lang/chapel/releases{/id}","deployments_url":"https://api.github.com/repos/chapel-lang/chapel/deployments","created_at":"2014-07-09T18:15:54Z","updated_at":"2016-06-08T04:11:45Z","pushed_at":"2016-06-09T20:01:33Z","git_url":"git://github.com/chapel-lang/chapel.git","ssh_url":"git@github.com:chapel-lang/chapel.git","clone_url":"https://github.com/chapel-lang/chapel.git","svn_url":"https://github.com/chapel-lang/chapel","homepage":"http://chapel.cray.com/","size":473703,"stargazers_count":277,"watchers_count":277,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":103,"mirror_url":null,"open_issues_count":16,"forks":103,"open_issues":16,"watchers":277,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3994"},"issue":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3994"},"comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3994/comments"},"review_comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994/comments"},"review_comment":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3994/commits"},"statuses":{"href":"https://api.github.com/repos/chapel-lang/chapel/statuses/0059cff01370346b67bcadb4cb5d748d5909460c"}}}}
{"actor":{"display_login":"e-kayrakli"}}