{"action":"created","comment":{"url":"https://api.github.com/repos/Theano/libgpuarray/pulls/comments/69394558","id":69394558,"diff_hunk":"@@ -0,0 +1,299 @@\n+from libc.stdlib cimport malloc, calloc, free\n+\n+from pygpu.gpuarray cimport (gpucontext, GpuContext, _GpuArray, GpuArray,\n+                             ensure_context,\n+                             GA_NO_ERROR, get_exc, gpucontext_error,\n+                             GpuArray_IS_C_CONTIGUOUS,\n+                             GA_C_ORDER, GA_F_ORDER, GA_ANY_ORDER,\n+                             pygpu_empty_like, pygpu_empty, memcpy)\n+from pygpu.gpuarray import GpuArrayException\n+\n+\n+cdef class GpuCommCliqueId:\n+    \"\"\"\n+    \"\"\"\n+    def __cinit__(self, GpuContext context=None):\n+        self.context = ensure_context(context)\n+\n+    property comm_id:\n+        \"Unique clique id to be used by each GpuComm in a group of devices\"\n+        def __get__(self):\n+            cdef bytes res\n+            comm_generate_id(self.context.ctx, self)\n+            res = self.comm_id.internal[:GA_COMM_ID_BYTES]\n+            return res\n+\n+        def __set__(self, unsigned char[:] bytearr):\n+            cdef int length\n+            length = bytearr.shape[0]\n+            if length < GA_COMM_ID_BYTES:\n+                raise ValueError, \"GpuComm clique id must have length %d bytes\" % (GA_COMM_ID_BYTES)\n+            memcpy(self.comm_id.internal, <char*>&bytearr[0], GA_COMM_ID_BYTES)\n+\n+\n+cdef class GpuComm:\n+    \"\"\"\n+    \"\"\"\n+    def __dealloc__(self):\n+        gpucomm_free(self.c)\n+\n+    def __reduce__(self):\n+        raise RuntimeError, \"Cannot pickle GpuComm object\"\n+\n+    def __cinit__(self, GpuCommCliqueId cid not None, int ndev, int rank):\n+        self.context = cid.context\n+        cdef int err\n+        err = gpucomm_new(&self.c, self.context.ctx, self.cid.comm_id,\n+                          ndev, rank)\n+        if err != GA_NO_ERROR:\n+            raise get_exc(err), gpucontext_error(self.context.ctx, err)\n+\n+    def get_count(self):\n+        cdef int gpucount\n+        comm_get_count(self, &gpucount)\n+        return gpucount\n+\n+    def get_rank(self):\n+        cdef int gpurank\n+        comm_get_rank(self, &gpurank)\n+        return gpurank\n+\n+    def reduce(self, GpuArray src not None, op, GpuArray dest=None, int root=-1):\n+        if dest is None:\n+            if root != -1:\n+                return comm_reduce_from(self, src, to_reduce_opcode(op), root)\n+            else:\n+                return pygpu_make_reduced(self, src, to_reduce_opcode(op))\n+        if root == -1:\n+            comm_get_rank(self, &root)","path":"pygpu/collectives.pyx","position":126,"original_position":68,"commit_id":"56c0cf6acbc7d0b6dd0822da53e69b5a530fb8d9","original_commit_id":"40cab54b8ccdc1435c3bd950c64d20d2d2847238","user":{"login":"abergeron","id":1002504,"avatar_url":"https://avatars.githubusercontent.com/u/1002504?v=3","gravatar_id":"","url":"https://api.github.com/users/abergeron","html_url":"https://github.com/abergeron","followers_url":"https://api.github.com/users/abergeron/followers","following_url":"https://api.github.com/users/abergeron/following{/other_user}","gists_url":"https://api.github.com/users/abergeron/gists{/gist_id}","starred_url":"https://api.github.com/users/abergeron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abergeron/subscriptions","organizations_url":"https://api.github.com/users/abergeron/orgs","repos_url":"https://api.github.com/users/abergeron/repos","events_url":"https://api.github.com/users/abergeron/events{/privacy}","received_events_url":"https://api.github.com/users/abergeron/received_events","type":"User","site_admin":false},"body":"Oh so the root can be any rank and the user choose?  In that case, yes you need to take it as input.","created_at":"2016-07-03T17:10:27Z","updated_at":"2016-07-03T17:10:27Z","html_url":"https://github.com/Theano/libgpuarray/pull/206#discussion_r69394558","pull_request_url":"https://api.github.com/repos/Theano/libgpuarray/pulls/206","_links":{"self":{"href":"https://api.github.com/repos/Theano/libgpuarray/pulls/comments/69394558"},"html":{"href":"https://github.com/Theano/libgpuarray/pull/206#discussion_r69394558"},"pull_request":{"href":"https://api.github.com/repos/Theano/libgpuarray/pulls/206"}}},"pull_request":{"url":"https://api.github.com/repos/Theano/libgpuarray/pulls/206","id":75555316,"html_url":"https://github.com/Theano/libgpuarray/pull/206","diff_url":"https://github.com/Theano/libgpuarray/pull/206.diff","patch_url":"https://github.com/Theano/libgpuarray/pull/206.patch","issue_url":"https://api.github.com/repos/Theano/libgpuarray/issues/206","number":206,"state":"open","locked":false,"title":"Add python bindings for collevtives in pygpu","user":{"login":"tsirif","id":4084993,"avatar_url":"https://avatars.githubusercontent.com/u/4084993?v=3","gravatar_id":"","url":"https://api.github.com/users/tsirif","html_url":"https://github.com/tsirif","followers_url":"https://api.github.com/users/tsirif/followers","following_url":"https://api.github.com/users/tsirif/following{/other_user}","gists_url":"https://api.github.com/users/tsirif/gists{/gist_id}","starred_url":"https://api.github.com/users/tsirif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsirif/subscriptions","organizations_url":"https://api.github.com/users/tsirif/orgs","repos_url":"https://api.github.com/users/tsirif/repos","events_url":"https://api.github.com/users/tsirif/events{/privacy}","received_events_url":"https://api.github.com/users/tsirif/received_events","type":"User","site_admin":false},"body":"pygpu part of nccl wrapping","created_at":"2016-06-28T21:40:04Z","updated_at":"2016-07-03T17:10:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"acc623562ba1c042d3c401fdc29adf52ef32cc5f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Theano/libgpuarray/pulls/206/commits","review_comments_url":"https://api.github.com/repos/Theano/libgpuarray/pulls/206/comments","review_comment_url":"https://api.github.com/repos/Theano/libgpuarray/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Theano/libgpuarray/issues/206/comments","statuses_url":"https://api.github.com/repos/Theano/libgpuarray/statuses/56c0cf6acbc7d0b6dd0822da53e69b5a530fb8d9","head":{"label":"tsirif:feature/pygpu-collectives","ref":"feature/pygpu-collectives","sha":"56c0cf6acbc7d0b6dd0822da53e69b5a530fb8d9","user":{"login":"tsirif","id":4084993,"avatar_url":"https://avatars.githubusercontent.com/u/4084993?v=3","gravatar_id":"","url":"https://api.github.com/users/tsirif","html_url":"https://github.com/tsirif","followers_url":"https://api.github.com/users/tsirif/followers","following_url":"https://api.github.com/users/tsirif/following{/other_user}","gists_url":"https://api.github.com/users/tsirif/gists{/gist_id}","starred_url":"https://api.github.com/users/tsirif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsirif/subscriptions","organizations_url":"https://api.github.com/users/tsirif/orgs","repos_url":"https://api.github.com/users/tsirif/repos","events_url":"https://api.github.com/users/tsirif/events{/privacy}","received_events_url":"https://api.github.com/users/tsirif/received_events","type":"User","site_admin":false},"repo":{"id":58962997,"name":"libgpuarray","full_name":"tsirif/libgpuarray","owner":{"login":"tsirif","id":4084993,"avatar_url":"https://avatars.githubusercontent.com/u/4084993?v=3","gravatar_id":"","url":"https://api.github.com/users/tsirif","html_url":"https://github.com/tsirif","followers_url":"https://api.github.com/users/tsirif/followers","following_url":"https://api.github.com/users/tsirif/following{/other_user}","gists_url":"https://api.github.com/users/tsirif/gists{/gist_id}","starred_url":"https://api.github.com/users/tsirif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsirif/subscriptions","organizations_url":"https://api.github.com/users/tsirif/orgs","repos_url":"https://api.github.com/users/tsirif/repos","events_url":"https://api.github.com/users/tsirif/events{/privacy}","received_events_url":"https://api.github.com/users/tsirif/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tsirif/libgpuarray","description":"Library to manipulate tensors on the GPU.","fork":true,"url":"https://api.github.com/repos/tsirif/libgpuarray","forks_url":"https://api.github.com/repos/tsirif/libgpuarray/forks","keys_url":"https://api.github.com/repos/tsirif/libgpuarray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tsirif/libgpuarray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tsirif/libgpuarray/teams","hooks_url":"https://api.github.com/repos/tsirif/libgpuarray/hooks","issue_events_url":"https://api.github.com/repos/tsirif/libgpuarray/issues/events{/number}","events_url":"https://api.github.com/repos/tsirif/libgpuarray/events","assignees_url":"https://api.github.com/repos/tsirif/libgpuarray/assignees{/user}","branches_url":"https://api.github.com/repos/tsirif/libgpuarray/branches{/branch}","tags_url":"https://api.github.com/repos/tsirif/libgpuarray/tags","blobs_url":"https://api.github.com/repos/tsirif/libgpuarray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tsirif/libgpuarray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tsirif/libgpuarray/git/refs{/sha}","trees_url":"https://api.github.com/repos/tsirif/libgpuarray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tsirif/libgpuarray/statuses/{sha}","languages_url":"https://api.github.com/repos/tsirif/libgpuarray/languages","stargazers_url":"https://api.github.com/repos/tsirif/libgpuarray/stargazers","contributors_url":"https://api.github.com/repos/tsirif/libgpuarray/contributors","subscribers_url":"https://api.github.com/repos/tsirif/libgpuarray/subscribers","subscription_url":"https://api.github.com/repos/tsirif/libgpuarray/subscription","commits_url":"https://api.github.com/repos/tsirif/libgpuarray/commits{/sha}","git_commits_url":"https://api.github.com/repos/tsirif/libgpuarray/git/commits{/sha}","comments_url":"https://api.github.com/repos/tsirif/libgpuarray/comments{/number}","issue_comment_url":"https://api.github.com/repos/tsirif/libgpuarray/issues/comments{/number}","contents_url":"https://api.github.com/repos/tsirif/libgpuarray/contents/{+path}","compare_url":"https://api.github.com/repos/tsirif/libgpuarray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tsirif/libgpuarray/merges","archive_url":"https://api.github.com/repos/tsirif/libgpuarray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tsirif/libgpuarray/downloads","issues_url":"https://api.github.com/repos/tsirif/libgpuarray/issues{/number}","pulls_url":"https://api.github.com/repos/tsirif/libgpuarray/pulls{/number}","milestones_url":"https://api.github.com/repos/tsirif/libgpuarray/milestones{/number}","notifications_url":"https://api.github.com/repos/tsirif/libgpuarray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tsirif/libgpuarray/labels{/name}","releases_url":"https://api.github.com/repos/tsirif/libgpuarray/releases{/id}","deployments_url":"https://api.github.com/repos/tsirif/libgpuarray/deployments","created_at":"2016-05-16T19:56:40Z","updated_at":"2016-05-16T19:56:41Z","pushed_at":"2016-07-03T16:54:47Z","git_url":"git://github.com/tsirif/libgpuarray.git","ssh_url":"git@github.com:tsirif/libgpuarray.git","clone_url":"https://github.com/tsirif/libgpuarray.git","svn_url":"https://github.com/tsirif/libgpuarray","homepage":null,"size":1784,"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":"Theano:master","ref":"master","sha":"538ca975721f5e19a9d0cdb5877aa0242af31044","user":{"login":"Theano","id":970517,"avatar_url":"https://avatars.githubusercontent.com/u/970517?v=3","gravatar_id":"","url":"https://api.github.com/users/Theano","html_url":"https://github.com/Theano","followers_url":"https://api.github.com/users/Theano/followers","following_url":"https://api.github.com/users/Theano/following{/other_user}","gists_url":"https://api.github.com/users/Theano/gists{/gist_id}","starred_url":"https://api.github.com/users/Theano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Theano/subscriptions","organizations_url":"https://api.github.com/users/Theano/orgs","repos_url":"https://api.github.com/users/Theano/repos","events_url":"https://api.github.com/users/Theano/events{/privacy}","received_events_url":"https://api.github.com/users/Theano/received_events","type":"Organization","site_admin":false},"repo":{"id":19312996,"name":"libgpuarray","full_name":"Theano/libgpuarray","owner":{"login":"Theano","id":970517,"avatar_url":"https://avatars.githubusercontent.com/u/970517?v=3","gravatar_id":"","url":"https://api.github.com/users/Theano","html_url":"https://github.com/Theano","followers_url":"https://api.github.com/users/Theano/followers","following_url":"https://api.github.com/users/Theano/following{/other_user}","gists_url":"https://api.github.com/users/Theano/gists{/gist_id}","starred_url":"https://api.github.com/users/Theano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Theano/subscriptions","organizations_url":"https://api.github.com/users/Theano/orgs","repos_url":"https://api.github.com/users/Theano/repos","events_url":"https://api.github.com/users/Theano/events{/privacy}","received_events_url":"https://api.github.com/users/Theano/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Theano/libgpuarray","description":"Library to manipulate tensors on the GPU.","fork":false,"url":"https://api.github.com/repos/Theano/libgpuarray","forks_url":"https://api.github.com/repos/Theano/libgpuarray/forks","keys_url":"https://api.github.com/repos/Theano/libgpuarray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Theano/libgpuarray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Theano/libgpuarray/teams","hooks_url":"https://api.github.com/repos/Theano/libgpuarray/hooks","issue_events_url":"https://api.github.com/repos/Theano/libgpuarray/issues/events{/number}","events_url":"https://api.github.com/repos/Theano/libgpuarray/events","assignees_url":"https://api.github.com/repos/Theano/libgpuarray/assignees{/user}","branches_url":"https://api.github.com/repos/Theano/libgpuarray/branches{/branch}","tags_url":"https://api.github.com/repos/Theano/libgpuarray/tags","blobs_url":"https://api.github.com/repos/Theano/libgpuarray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Theano/libgpuarray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Theano/libgpuarray/git/refs{/sha}","trees_url":"https://api.github.com/repos/Theano/libgpuarray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Theano/libgpuarray/statuses/{sha}","languages_url":"https://api.github.com/repos/Theano/libgpuarray/languages","stargazers_url":"https://api.github.com/repos/Theano/libgpuarray/stargazers","contributors_url":"https://api.github.com/repos/Theano/libgpuarray/contributors","subscribers_url":"https://api.github.com/repos/Theano/libgpuarray/subscribers","subscription_url":"https://api.github.com/repos/Theano/libgpuarray/subscription","commits_url":"https://api.github.com/repos/Theano/libgpuarray/commits{/sha}","git_commits_url":"https://api.github.com/repos/Theano/libgpuarray/git/commits{/sha}","comments_url":"https://api.github.com/repos/Theano/libgpuarray/comments{/number}","issue_comment_url":"https://api.github.com/repos/Theano/libgpuarray/issues/comments{/number}","contents_url":"https://api.github.com/repos/Theano/libgpuarray/contents/{+path}","compare_url":"https://api.github.com/repos/Theano/libgpuarray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Theano/libgpuarray/merges","archive_url":"https://api.github.com/repos/Theano/libgpuarray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Theano/libgpuarray/downloads","issues_url":"https://api.github.com/repos/Theano/libgpuarray/issues{/number}","pulls_url":"https://api.github.com/repos/Theano/libgpuarray/pulls{/number}","milestones_url":"https://api.github.com/repos/Theano/libgpuarray/milestones{/number}","notifications_url":"https://api.github.com/repos/Theano/libgpuarray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Theano/libgpuarray/labels{/name}","releases_url":"https://api.github.com/repos/Theano/libgpuarray/releases{/id}","deployments_url":"https://api.github.com/repos/Theano/libgpuarray/deployments","created_at":"2014-04-30T12:33:14Z","updated_at":"2016-06-30T10:48:03Z","pushed_at":"2016-07-03T16:54:47Z","git_url":"git://github.com/Theano/libgpuarray.git","ssh_url":"git@github.com:Theano/libgpuarray.git","clone_url":"https://github.com/Theano/libgpuarray.git","svn_url":"https://github.com/Theano/libgpuarray","homepage":null,"size":2243,"stargazers_count":71,"watchers_count":71,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":35,"forks":43,"open_issues":35,"watchers":71,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Theano/libgpuarray/pulls/206"},"html":{"href":"https://github.com/Theano/libgpuarray/pull/206"},"issue":{"href":"https://api.github.com/repos/Theano/libgpuarray/issues/206"},"comments":{"href":"https://api.github.com/repos/Theano/libgpuarray/issues/206/comments"},"review_comments":{"href":"https://api.github.com/repos/Theano/libgpuarray/pulls/206/comments"},"review_comment":{"href":"https://api.github.com/repos/Theano/libgpuarray/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Theano/libgpuarray/pulls/206/commits"},"statuses":{"href":"https://api.github.com/repos/Theano/libgpuarray/statuses/56c0cf6acbc7d0b6dd0822da53e69b5a530fb8d9"}}}}
{"actor":{"display_login":"abergeron"}}