{"action":"created","comment":{"url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/comments/45455450","id":45455450,"diff_hunk":"@@ -146,22 +173,66 @@ int Gather<dim>::rank() const\n }\n \n template<int dim>\n-template<typename Type, int memDim, class T_Alloc, class T_Copy, class T_Assign, class T_Alloc2, class T_Copy2, class T_Assign2>\n-void Gather<dim>::CopyToDest::operator()(const Gather<dim>& gather,\n+template<typename Type, int memDim, class T_Alloc, class T_Copy, class T_Assign>\n+void Gather<dim>::CopyToDest::operator()(\n+                        const Gather<dim>& gather,\n                         container::CartBuffer<Type, memDim, T_Alloc, T_Copy, T_Assign>& dest,\n                         std::vector<Type>& tmpDest,\n-                        container::CartBuffer<Type, memDim, T_Alloc2, T_Copy2, T_Assign2>& source, int dir) const\n+                        int dir,\n+                        const std::vector<math::Size_t<memDim> >& srcSizes,\n+                        const std::vector<size_t>& srcOffsets1D) const\n {\n     using namespace math;\n \n-    for(int i = 0; i < (int)gather.positions.size(); i++)\n+    int numRanks = (int)gather.positions.size();\n+\n+    // calculate offsets per axis in destination buffer\n+    std::vector<size_t> offsets_per_axis[memDim];\n+    std::vector<size_t> sizes_per_axis[memDim];\n+\n+    // sizes per axis\n+    for(int i = 0; i < numRanks; i++)\n     {\n         Int<dim> pos = gather.positions[i];\n         Int<memDim> posInMem = GatherHelper::posInMem<dim, memDim>()(pos, dir);\n+        for(int axis = 0; axis < memDim; axis++)\n+        {\n+            size_t pos_on_axis = (size_t)posInMem[axis];\n+            if(pos_on_axis >= sizes_per_axis[axis].size())\n+                sizes_per_axis[axis].resize(pos_on_axis + 1);\n+            sizes_per_axis[axis][pos_on_axis] = srcSizes[i][axis];\n+        }\n+    }\n+\n+    // offsets per axis\n+    for(int axis = 0; axis < memDim; axis++)\n+    {\n+        offsets_per_axis[axis].resize(sizes_per_axis[axis].size());\n+        std::vector<size_t> partialSum(offsets_per_axis[axis].size());\n+        std::partial_sum(sizes_per_axis[axis].begin(), sizes_per_axis[axis].end(), partialSum.begin());\n+        offsets_per_axis[axis][0] = 0;\n+        std::copy(partialSum.begin(), partialSum.end()-1, offsets_per_axis[axis].begin()+1);","path":"src/libPMacc/include/cuSTL/algorithm/mpi/Gather.tpp","position":89,"original_position":89,"commit_id":"48885c659f7f0a3c7cf5267f092566dc0828230f","original_commit_id":"48885c659f7f0a3c7cf5267f092566dc0828230f","user":{"login":"psychocoderHPC","id":4037125,"avatar_url":"https://avatars.githubusercontent.com/u/4037125?v=3","gravatar_id":"","url":"https://api.github.com/users/psychocoderHPC","html_url":"https://github.com/psychocoderHPC","followers_url":"https://api.github.com/users/psychocoderHPC/followers","following_url":"https://api.github.com/users/psychocoderHPC/following{/other_user}","gists_url":"https://api.github.com/users/psychocoderHPC/gists{/gist_id}","starred_url":"https://api.github.com/users/psychocoderHPC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychocoderHPC/subscriptions","organizations_url":"https://api.github.com/users/psychocoderHPC/orgs","repos_url":"https://api.github.com/users/psychocoderHPC/repos","events_url":"https://api.github.com/users/psychocoderHPC/events{/privacy}","received_events_url":"https://api.github.com/users/psychocoderHPC/received_events","type":"User","site_admin":false},"body":"Why you not copy the last element in `partialSum`.\r\nstd::copy is [defined as](http://www.cplusplus.com/reference/algorithm/copy/) `Copies the elements in the range [first,last) into the range beginning at result.`\r\nIf it is intended please add a comment.","created_at":"2015-11-20T10:37:24Z","updated_at":"2015-11-20T10:37:24Z","html_url":"https://github.com/ComputationalRadiationPhysics/picongpu/pull/1244#discussion_r45455450","pull_request_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244","_links":{"self":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/comments/45455450"},"html":{"href":"https://github.com/ComputationalRadiationPhysics/picongpu/pull/1244#discussion_r45455450"},"pull_request":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244"}}},"pull_request":{"url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244","id":50381281,"html_url":"https://github.com/ComputationalRadiationPhysics/picongpu/pull/1244","diff_url":"https://github.com/ComputationalRadiationPhysics/picongpu/pull/1244.diff","patch_url":"https://github.com/ComputationalRadiationPhysics/picongpu/pull/1244.patch","issue_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/issues/1244","number":1244,"state":"open","locked":false,"title":"fix cuSTL/Gather for supporting static load balancing","user":{"login":"Heikman","id":5159590,"avatar_url":"https://avatars.githubusercontent.com/u/5159590?v=3","gravatar_id":"","url":"https://api.github.com/users/Heikman","html_url":"https://github.com/Heikman","followers_url":"https://api.github.com/users/Heikman/followers","following_url":"https://api.github.com/users/Heikman/following{/other_user}","gists_url":"https://api.github.com/users/Heikman/gists{/gist_id}","starred_url":"https://api.github.com/users/Heikman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Heikman/subscriptions","organizations_url":"https://api.github.com/users/Heikman/orgs","repos_url":"https://api.github.com/users/Heikman/repos","events_url":"https://api.github.com/users/Heikman/events{/privacy}","received_events_url":"https://api.github.com/users/Heikman/received_events","type":"User","site_admin":false},"body":"Before this pull request, cuSTL::algorithm::mpi::Gather assumed all local containers to have an equal size. Now, the algorithm asks each participating rank for its local container size before perfoming the gather operation.\r\n\r\nTests:\r\n- [x] KHI, SliceFieldPrinter, equal decomposition\r\n- [x] KHI, SliceFieldPrinter, non-equal decomposition\r\n\r\nsolves #1195","created_at":"2015-11-11T13:07:00Z","updated_at":"2015-11-20T10:37:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b0dfdb04b9021960f6b8742aa3cef8c19777f07","assignee":{"login":"psychocoderHPC","id":4037125,"avatar_url":"https://avatars.githubusercontent.com/u/4037125?v=3","gravatar_id":"","url":"https://api.github.com/users/psychocoderHPC","html_url":"https://github.com/psychocoderHPC","followers_url":"https://api.github.com/users/psychocoderHPC/followers","following_url":"https://api.github.com/users/psychocoderHPC/following{/other_user}","gists_url":"https://api.github.com/users/psychocoderHPC/gists{/gist_id}","starred_url":"https://api.github.com/users/psychocoderHPC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychocoderHPC/subscriptions","organizations_url":"https://api.github.com/users/psychocoderHPC/orgs","repos_url":"https://api.github.com/users/psychocoderHPC/repos","events_url":"https://api.github.com/users/psychocoderHPC/events{/privacy}","received_events_url":"https://api.github.com/users/psychocoderHPC/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/milestones/2","html_url":"https://github.com/ComputationalRadiationPhysics/picongpu/milestones/Open%20Beta","labels_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/milestones/2/labels","id":395839,"number":2,"title":"Open Beta","description":"Tasks to complete until the release of our open beta (version 0.1)\r\n\r\nThe [beta](https://en.wikipedia.org/wiki/Software_release_life_cycle#Beta) release shall be useful for *physicist* that used a Particle-in-Cell code *before*. Experience with *compiling libraries from source* and a *good Linux knowledge* is required for the initial installation.\r\n","creator":{"login":"ax3l","id":1353258,"avatar_url":"https://avatars.githubusercontent.com/u/1353258?v=3","gravatar_id":"","url":"https://api.github.com/users/ax3l","html_url":"https://github.com/ax3l","followers_url":"https://api.github.com/users/ax3l/followers","following_url":"https://api.github.com/users/ax3l/following{/other_user}","gists_url":"https://api.github.com/users/ax3l/gists{/gist_id}","starred_url":"https://api.github.com/users/ax3l/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ax3l/subscriptions","organizations_url":"https://api.github.com/users/ax3l/orgs","repos_url":"https://api.github.com/users/ax3l/repos","events_url":"https://api.github.com/users/ax3l/events{/privacy}","received_events_url":"https://api.github.com/users/ax3l/received_events","type":"User","site_admin":false},"open_issues":140,"closed_issues":1019,"state":"open","created_at":"2013-08-06T16:38:57Z","updated_at":"2015-11-20T09:51:32Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244/commits","review_comments_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244/comments","review_comment_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/issues/1244/comments","statuses_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/statuses/48885c659f7f0a3c7cf5267f092566dc0828230f","head":{"label":"Heikman:fix-MPI_Gather","ref":"fix-MPI_Gather","sha":"48885c659f7f0a3c7cf5267f092566dc0828230f","user":{"login":"Heikman","id":5159590,"avatar_url":"https://avatars.githubusercontent.com/u/5159590?v=3","gravatar_id":"","url":"https://api.github.com/users/Heikman","html_url":"https://github.com/Heikman","followers_url":"https://api.github.com/users/Heikman/followers","following_url":"https://api.github.com/users/Heikman/following{/other_user}","gists_url":"https://api.github.com/users/Heikman/gists{/gist_id}","starred_url":"https://api.github.com/users/Heikman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Heikman/subscriptions","organizations_url":"https://api.github.com/users/Heikman/orgs","repos_url":"https://api.github.com/users/Heikman/repos","events_url":"https://api.github.com/users/Heikman/events{/privacy}","received_events_url":"https://api.github.com/users/Heikman/received_events","type":"User","site_admin":false},"repo":{"id":12133878,"name":"picongpu","full_name":"Heikman/picongpu","owner":{"login":"Heikman","id":5159590,"avatar_url":"https://avatars.githubusercontent.com/u/5159590?v=3","gravatar_id":"","url":"https://api.github.com/users/Heikman","html_url":"https://github.com/Heikman","followers_url":"https://api.github.com/users/Heikman/followers","following_url":"https://api.github.com/users/Heikman/following{/other_user}","gists_url":"https://api.github.com/users/Heikman/gists{/gist_id}","starred_url":"https://api.github.com/users/Heikman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Heikman/subscriptions","organizations_url":"https://api.github.com/users/Heikman/orgs","repos_url":"https://api.github.com/users/Heikman/repos","events_url":"https://api.github.com/users/Heikman/events{/privacy}","received_events_url":"https://api.github.com/users/Heikman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Heikman/picongpu","description":"PIConGPU - A particle-in-cell code for GPGPUs","fork":true,"url":"https://api.github.com/repos/Heikman/picongpu","forks_url":"https://api.github.com/repos/Heikman/picongpu/forks","keys_url":"https://api.github.com/repos/Heikman/picongpu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Heikman/picongpu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Heikman/picongpu/teams","hooks_url":"https://api.github.com/repos/Heikman/picongpu/hooks","issue_events_url":"https://api.github.com/repos/Heikman/picongpu/issues/events{/number}","events_url":"https://api.github.com/repos/Heikman/picongpu/events","assignees_url":"https://api.github.com/repos/Heikman/picongpu/assignees{/user}","branches_url":"https://api.github.com/repos/Heikman/picongpu/branches{/branch}","tags_url":"https://api.github.com/repos/Heikman/picongpu/tags","blobs_url":"https://api.github.com/repos/Heikman/picongpu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Heikman/picongpu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Heikman/picongpu/git/refs{/sha}","trees_url":"https://api.github.com/repos/Heikman/picongpu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Heikman/picongpu/statuses/{sha}","languages_url":"https://api.github.com/repos/Heikman/picongpu/languages","stargazers_url":"https://api.github.com/repos/Heikman/picongpu/stargazers","contributors_url":"https://api.github.com/repos/Heikman/picongpu/contributors","subscribers_url":"https://api.github.com/repos/Heikman/picongpu/subscribers","subscription_url":"https://api.github.com/repos/Heikman/picongpu/subscription","commits_url":"https://api.github.com/repos/Heikman/picongpu/commits{/sha}","git_commits_url":"https://api.github.com/repos/Heikman/picongpu/git/commits{/sha}","comments_url":"https://api.github.com/repos/Heikman/picongpu/comments{/number}","issue_comment_url":"https://api.github.com/repos/Heikman/picongpu/issues/comments{/number}","contents_url":"https://api.github.com/repos/Heikman/picongpu/contents/{+path}","compare_url":"https://api.github.com/repos/Heikman/picongpu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Heikman/picongpu/merges","archive_url":"https://api.github.com/repos/Heikman/picongpu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Heikman/picongpu/downloads","issues_url":"https://api.github.com/repos/Heikman/picongpu/issues{/number}","pulls_url":"https://api.github.com/repos/Heikman/picongpu/pulls{/number}","milestones_url":"https://api.github.com/repos/Heikman/picongpu/milestones{/number}","notifications_url":"https://api.github.com/repos/Heikman/picongpu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Heikman/picongpu/labels{/name}","releases_url":"https://api.github.com/repos/Heikman/picongpu/releases{/id}","created_at":"2013-08-15T12:28:22Z","updated_at":"2014-06-12T11:22:44Z","pushed_at":"2015-11-17T09:34:08Z","git_url":"git://github.com/Heikman/picongpu.git","ssh_url":"git@github.com:Heikman/picongpu.git","clone_url":"https://github.com/Heikman/picongpu.git","svn_url":"https://github.com/Heikman/picongpu","homepage":"http://picongpu.hzdr.de","size":9620,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"ComputationalRadiationPhysics:dev","ref":"dev","sha":"d2173bbf60273d05be04b498071d13fa015a5597","user":{"login":"ComputationalRadiationPhysics","id":5120388,"avatar_url":"https://avatars.githubusercontent.com/u/5120388?v=3","gravatar_id":"","url":"https://api.github.com/users/ComputationalRadiationPhysics","html_url":"https://github.com/ComputationalRadiationPhysics","followers_url":"https://api.github.com/users/ComputationalRadiationPhysics/followers","following_url":"https://api.github.com/users/ComputationalRadiationPhysics/following{/other_user}","gists_url":"https://api.github.com/users/ComputationalRadiationPhysics/gists{/gist_id}","starred_url":"https://api.github.com/users/ComputationalRadiationPhysics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ComputationalRadiationPhysics/subscriptions","organizations_url":"https://api.github.com/users/ComputationalRadiationPhysics/orgs","repos_url":"https://api.github.com/users/ComputationalRadiationPhysics/repos","events_url":"https://api.github.com/users/ComputationalRadiationPhysics/events{/privacy}","received_events_url":"https://api.github.com/users/ComputationalRadiationPhysics/received_events","type":"Organization","site_admin":false},"repo":{"id":11764461,"name":"picongpu","full_name":"ComputationalRadiationPhysics/picongpu","owner":{"login":"ComputationalRadiationPhysics","id":5120388,"avatar_url":"https://avatars.githubusercontent.com/u/5120388?v=3","gravatar_id":"","url":"https://api.github.com/users/ComputationalRadiationPhysics","html_url":"https://github.com/ComputationalRadiationPhysics","followers_url":"https://api.github.com/users/ComputationalRadiationPhysics/followers","following_url":"https://api.github.com/users/ComputationalRadiationPhysics/following{/other_user}","gists_url":"https://api.github.com/users/ComputationalRadiationPhysics/gists{/gist_id}","starred_url":"https://api.github.com/users/ComputationalRadiationPhysics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ComputationalRadiationPhysics/subscriptions","organizations_url":"https://api.github.com/users/ComputationalRadiationPhysics/orgs","repos_url":"https://api.github.com/users/ComputationalRadiationPhysics/repos","events_url":"https://api.github.com/users/ComputationalRadiationPhysics/events{/privacy}","received_events_url":"https://api.github.com/users/ComputationalRadiationPhysics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ComputationalRadiationPhysics/picongpu","description":"PIConGPU - A particle-in-cell code for GPGPUs","fork":false,"url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu","forks_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/forks","keys_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/teams","hooks_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/hooks","issue_events_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/issues/events{/number}","events_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/events","assignees_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/assignees{/user}","branches_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/branches{/branch}","tags_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/tags","blobs_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/git/refs{/sha}","trees_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/statuses/{sha}","languages_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/languages","stargazers_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/stargazers","contributors_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/contributors","subscribers_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/subscribers","subscription_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/subscription","commits_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/commits{/sha}","git_commits_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/git/commits{/sha}","comments_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/comments{/number}","issue_comment_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/issues/comments{/number}","contents_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/contents/{+path}","compare_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/merges","archive_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/downloads","issues_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/issues{/number}","pulls_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls{/number}","milestones_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/milestones{/number}","notifications_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/labels{/name}","releases_url":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/releases{/id}","created_at":"2013-07-30T12:28:20Z","updated_at":"2015-11-19T13:22:05Z","pushed_at":"2015-11-20T10:27:27Z","git_url":"git://github.com/ComputationalRadiationPhysics/picongpu.git","ssh_url":"git@github.com:ComputationalRadiationPhysics/picongpu.git","clone_url":"https://github.com/ComputationalRadiationPhysics/picongpu.git","svn_url":"https://github.com/ComputationalRadiationPhysics/picongpu","homepage":"http://picongpu.hzdr.de","size":10253,"stargazers_count":134,"watchers_count":134,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":202,"forks":71,"open_issues":202,"watchers":134,"default_branch":"release-0.1.1"}},"_links":{"self":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244"},"html":{"href":"https://github.com/ComputationalRadiationPhysics/picongpu/pull/1244"},"issue":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/issues/1244"},"comments":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/issues/1244/comments"},"review_comments":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244/comments"},"review_comment":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/pulls/1244/commits"},"statuses":{"href":"https://api.github.com/repos/ComputationalRadiationPhysics/picongpu/statuses/48885c659f7f0a3c7cf5267f092566dc0828230f"}}}}