{"action":"created","comment":{"url":"https://api.github.com/repos/Theano/libgpuarray/pulls/comments/69717231","id":69717231,"diff_hunk":"@@ -0,0 +1,91 @@\n+from __future__ import print_function\n+\n+import os\n+import unittest\n+from six.moves import range\n+from six import PY3\n+import pickle\n+\n+import numpy\n+\n+import pygpu\n+from pygpu.collectives import COMM_ID_BYTES, GpuCommCliqueId, GpuComm\n+\n+from .support import (guard_devsup, check_meta, check_flags, check_all,\n+                      check_content, gen_gpuarray, context as ctx, dtypes_all,\n+                      dtypes_no_complex, skip_single_f)\n+\n+\n+def get_user_gpu_rank():\n+    for name in ['GPUARRAY_TEST_DEVICE', 'DEVICE']:\n+        if name in os.environ:\n+            devname = os.environ[name]\n+            if devname.startswith(\"opencl\"):\n+                return -1\n+            if devname[-1] == 'a':\n+                return 0\n+            return int(devname[-1])\n+    return -1\n+\n+# check for py4mpi to test\n+# check if rank == -1\n+gpurank = get_user_gpu_rank()\n+# mpirank = ...\n+# in both cases skip GpuComm tests\n+\n+class TestGpuCommCliqueId(unittest.TestCase):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls.cid = GpuCommCliqueId(context=ctx)\n+\n+    def _create_in_scope_from_string(self):\n+        comm_id = bytearray(b'pipes' * (COMM_ID_BYTES // 5 + 1))\n+        return GpuCommCliqueId(context=ctx, comm_id=comm_id)\n+\n+    def test_create_from_string_id(self):\n+        cid2 = self._create_in_scope_from_string()\n+        a = bytearray(b'pipes' * (COMM_ID_BYTES // 5 + 1))\n+        assert cid2.comm_id == a[:COMM_ID_BYTES], (cid2.comm_id, a[:COMM_ID_BYTES])\n+        b = bytearray(b'mlkies' * (COMM_ID_BYTES // 6 + 1))\n+        cid2.comm_id = b\n+        assert cid2.comm_id == b[:COMM_ID_BYTES], (cid2.comm_id, b[:COMM_ID_BYTES])\n+        with self.assertRaises(ValueError):\n+            cid2.comm_id = bytearray(b'testestestest')\n+\n+    def test_pickle(self):\n+        with self.assertRaises(RuntimeError):\n+            pickle.dumps(self.cid)\n+        with self.assertRaises(RuntimeError):\n+            pickle.dumps(self.cid, protocol=0)\n+        with self.assertRaises(RuntimeError):\n+            pickle.dumps(self.cid, protocol=1)\n+        with self.assertRaises(RuntimeError):\n+            pickle.dumps(self.cid, protocol=2)\n+        if PY3:\n+            with self.assertRaises(RuntimeError):\n+                pickle.dumps(self.cid, protocol=3)\n+        with self.assertRaises(RuntimeError):\n+            pickle.dumps(self.cid, protocol=-1)\n+\n+    def test_richcmp(self):\n+        other_cid1 = GpuCommCliqueId(context=ctx, comm_id=self.cid.comm_id)\n+        other_cid2 = GpuCommCliqueId(context=ctx)\n+        assert self.cid == other_cid1\n+        assert self.cid != other_cid2\n+        assert other_cid2 > other_cid1\n+        assert other_cid2 >= other_cid1\n+        assert self.cid >= other_cid1\n+        assert other_cid1 < other_cid2\n+        assert other_cid1 <= other_cid2\n+        assert other_cid1 <= self.cid","path":"pygpu/tests/test_collectives.py","position":80,"original_position":80,"commit_id":"ea59f8efe5c3a0c091fb43aa491cf0862295031f","original_commit_id":"ea59f8efe5c3a0c091fb43aa491cf0862295031f","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":"So far, for NCCL yes. It uses internally a static counter which is increased for every call and is sufficed to string id containing process id. If something changes, I will set properly bytestrings.","created_at":"2016-07-06T12:00:10Z","updated_at":"2016-07-06T12:00:10Z","html_url":"https://github.com/Theano/libgpuarray/pull/206#discussion_r69717231","pull_request_url":"https://api.github.com/repos/Theano/libgpuarray/pulls/206","_links":{"self":{"href":"https://api.github.com/repos/Theano/libgpuarray/pulls/comments/69717231"},"html":{"href":"https://github.com/Theano/libgpuarray/pull/206#discussion_r69717231"},"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-06T12:00:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2bce9cb3c5ac5c021adc480dc6a1a1805c665f33","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/ea59f8efe5c3a0c091fb43aa491cf0862295031f","head":{"label":"tsirif:feature/pygpu-collectives","ref":"feature/pygpu-collectives","sha":"ea59f8efe5c3a0c091fb43aa491cf0862295031f","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-05T15:22:27Z","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":1775,"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-06T00:42:50Z","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":36,"forks":43,"open_issues":36,"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/ea59f8efe5c3a0c091fb43aa491cf0862295031f"}}}}
{"actor":{"display_login":"tsirif"}}