{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/170375348","pull_request_review_id":99060512,"id":170375348,"diff_hunk":"@@ -523,95 +537,236 @@ class CommDevice : public Comm {\n     }\n \n     InitBuffersAndComm(src);\n-    auto& buf = merge_buf_[key];\n-    std::vector<NDArray> reduce(src.size());\n-\n-    const NDArrayStorageType stype = buf.merged.storage_type();\n+    // merge buffer holds the first group of gpus\n+    BufferEntry& buf = merge_buf_[key];\n+    // stage buffer holds the data of the second group  or the first when merge\n+    // buffer is empty\n+    BufferEntry& stage = stage_buf_[key];\n+    std::vector<NDArray> reduce_s;\n+\n+    const NDArrayStorageType stype = stage.merged.storage_type();\n     if (stype == kDefaultStorage) {\n-      CopyFromTo(src[0], &(buf.merged), priority);\n-      reduce[0] = buf.merged;\n-\n-      if (buf.copy_buf.empty()) {\n-        // TODO(mli) this results in large device memory usage for huge ndarray,","path":"src/kvstore/comm.h","position":495,"original_position":495,"commit_id":"d174d78f72018dc0a2809c77012c3498905c3cc5","original_commit_id":"d174d78f72018dc0a2809c77012c3498905c3cc5","user":{"login":"piiswrong","id":568948,"avatar_url":"https://avatars0.githubusercontent.com/u/568948?v=4","gravatar_id":"","url":"https://api.github.com/users/piiswrong","html_url":"https://github.com/piiswrong","followers_url":"https://api.github.com/users/piiswrong/followers","following_url":"https://api.github.com/users/piiswrong/following{/other_user}","gists_url":"https://api.github.com/users/piiswrong/gists{/gist_id}","starred_url":"https://api.github.com/users/piiswrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piiswrong/subscriptions","organizations_url":"https://api.github.com/users/piiswrong/orgs","repos_url":"https://api.github.com/users/piiswrong/repos","events_url":"https://api.github.com/users/piiswrong/events{/privacy}","received_events_url":"https://api.github.com/users/piiswrong/received_events","type":"User","site_admin":false},"body":"Is this TODO handled by this PR?","created_at":"2018-02-23T21:42:08Z","updated_at":"2018-02-23T21:53:54Z","html_url":"https://github.com/apache/incubator-mxnet/pull/8915#discussion_r170375348","pull_request_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/170375348"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/8915#discussion_r170375348"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915","id":155970809,"html_url":"https://github.com/apache/incubator-mxnet/pull/8915","diff_url":"https://github.com/apache/incubator-mxnet/pull/8915.diff","patch_url":"https://github.com/apache/incubator-mxnet/pull/8915.patch","issue_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/8915","number":8915,"state":"open","locked":false,"title":"NVLink communication pattern updated ","user":{"login":"Laurawly","id":3700467,"avatar_url":"https://avatars1.githubusercontent.com/u/3700467?v=4","gravatar_id":"","url":"https://api.github.com/users/Laurawly","html_url":"https://github.com/Laurawly","followers_url":"https://api.github.com/users/Laurawly/followers","following_url":"https://api.github.com/users/Laurawly/following{/other_user}","gists_url":"https://api.github.com/users/Laurawly/gists{/gist_id}","starred_url":"https://api.github.com/users/Laurawly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Laurawly/subscriptions","organizations_url":"https://api.github.com/users/Laurawly/orgs","repos_url":"https://api.github.com/users/Laurawly/repos","events_url":"https://api.github.com/users/Laurawly/events{/privacy}","received_events_url":"https://api.github.com/users/Laurawly/received_events","type":"User","site_admin":false},"body":"## Description ##\r\n(Optimized kvstore communication pattern to make full use of NVLinks)\r\n\r\n## Checklist ##\r\n### Essentials ###\r\n- [x] Passed code style checking (`make lint`)\r\n- [x] Changes are complete (i.e. I finished coding on this PR)\r\n- [x] All changes have test coverage\r\n- [x] For user-facing API changes, API doc string has been updated. For new C++ functions in header files, their functionalities and arguments are well-documented. \r\n- [x] To my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change\r\n\r\n### Changes ###\r\n- [x] Device reduce\r\n- [x] Device broadcast\r\n\r\n## Comments ##\r\n- The changes make kvstore to use more NVLinks/PCIe and avoid using QPI when both are present, edge cases include 4 and 8 gpus are used.\r\n","created_at":"2017-12-01T22:21:07Z","updated_at":"2018-02-23T21:53:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a03e886ca77f3f94f50d36d4df4c6982250c291d","assignee":{"login":"eric-haibin-lin","id":5545640,"avatar_url":"https://avatars1.githubusercontent.com/u/5545640?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-haibin-lin","html_url":"https://github.com/eric-haibin-lin","followers_url":"https://api.github.com/users/eric-haibin-lin/followers","following_url":"https://api.github.com/users/eric-haibin-lin/following{/other_user}","gists_url":"https://api.github.com/users/eric-haibin-lin/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-haibin-lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-haibin-lin/subscriptions","organizations_url":"https://api.github.com/users/eric-haibin-lin/orgs","repos_url":"https://api.github.com/users/eric-haibin-lin/repos","events_url":"https://api.github.com/users/eric-haibin-lin/events{/privacy}","received_events_url":"https://api.github.com/users/eric-haibin-lin/received_events","type":"User","site_admin":false},"assignees":[{"login":"eric-haibin-lin","id":5545640,"avatar_url":"https://avatars1.githubusercontent.com/u/5545640?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-haibin-lin","html_url":"https://github.com/eric-haibin-lin","followers_url":"https://api.github.com/users/eric-haibin-lin/followers","following_url":"https://api.github.com/users/eric-haibin-lin/following{/other_user}","gists_url":"https://api.github.com/users/eric-haibin-lin/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-haibin-lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-haibin-lin/subscriptions","organizations_url":"https://api.github.com/users/eric-haibin-lin/orgs","repos_url":"https://api.github.com/users/eric-haibin-lin/repos","events_url":"https://api.github.com/users/eric-haibin-lin/events{/privacy}","received_events_url":"https://api.github.com/users/eric-haibin-lin/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/8915/comments","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/d174d78f72018dc0a2809c77012c3498905c3cc5","head":{"label":"Laurawly:master","ref":"master","sha":"d174d78f72018dc0a2809c77012c3498905c3cc5","user":{"login":"Laurawly","id":3700467,"avatar_url":"https://avatars1.githubusercontent.com/u/3700467?v=4","gravatar_id":"","url":"https://api.github.com/users/Laurawly","html_url":"https://github.com/Laurawly","followers_url":"https://api.github.com/users/Laurawly/followers","following_url":"https://api.github.com/users/Laurawly/following{/other_user}","gists_url":"https://api.github.com/users/Laurawly/gists{/gist_id}","starred_url":"https://api.github.com/users/Laurawly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Laurawly/subscriptions","organizations_url":"https://api.github.com/users/Laurawly/orgs","repos_url":"https://api.github.com/users/Laurawly/repos","events_url":"https://api.github.com/users/Laurawly/events{/privacy}","received_events_url":"https://api.github.com/users/Laurawly/received_events","type":"User","site_admin":false},"repo":{"id":101235092,"name":"incubator-mxnet","full_name":"Laurawly/incubator-mxnet","owner":{"login":"Laurawly","id":3700467,"avatar_url":"https://avatars1.githubusercontent.com/u/3700467?v=4","gravatar_id":"","url":"https://api.github.com/users/Laurawly","html_url":"https://github.com/Laurawly","followers_url":"https://api.github.com/users/Laurawly/followers","following_url":"https://api.github.com/users/Laurawly/following{/other_user}","gists_url":"https://api.github.com/users/Laurawly/gists{/gist_id}","starred_url":"https://api.github.com/users/Laurawly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Laurawly/subscriptions","organizations_url":"https://api.github.com/users/Laurawly/orgs","repos_url":"https://api.github.com/users/Laurawly/repos","events_url":"https://api.github.com/users/Laurawly/events{/privacy}","received_events_url":"https://api.github.com/users/Laurawly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Laurawly/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":true,"url":"https://api.github.com/repos/Laurawly/incubator-mxnet","forks_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/Laurawly/incubator-mxnet/deployments","created_at":"2017-08-24T00:02:10Z","updated_at":"2018-01-26T19:11:06Z","pushed_at":"2018-02-07T19:46:33Z","git_url":"git://github.com/Laurawly/incubator-mxnet.git","ssh_url":"git@github.com:Laurawly/incubator-mxnet.git","clone_url":"https://github.com/Laurawly/incubator-mxnet.git","svn_url":"https://github.com/Laurawly/incubator-mxnet","homepage":"http://mxnet.io","size":33260,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"48dcbf23ab7d0c1e103a8419ed4e72b1f9d43fa2","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":34864402,"name":"incubator-mxnet","full_name":"apache/incubator-mxnet","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":false,"url":"https://api.github.com/repos/apache/incubator-mxnet","forks_url":"https://api.github.com/repos/apache/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/apache/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/apache/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/apache/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/apache/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/apache/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/apache/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-mxnet/deployments","created_at":"2015-04-30T16:21:15Z","updated_at":"2018-02-23T21:36:01Z","pushed_at":"2018-02-23T20:56:14Z","git_url":"git://github.com/apache/incubator-mxnet.git","ssh_url":"git@github.com:apache/incubator-mxnet.git","clone_url":"https://github.com/apache/incubator-mxnet.git","svn_url":"https://github.com/apache/incubator-mxnet","homepage":"http://mxnet.io","size":33390,"stargazers_count":13126,"watchers_count":13126,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4834,"mirror_url":null,"archived":false,"open_issues_count":835,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":4834,"open_issues":835,"watchers":13126,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/8915"},"issue":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/8915"},"comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/8915/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/8915/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-mxnet/statuses/d174d78f72018dc0a2809c77012c3498905c3cc5"}},"author_association":"NONE"}}
{"actor":{"display_login":"piiswrong"}}