{"action":"created","comment":{"url":"https://api.github.com/repos/chainer/chainer/pulls/comments/203047212","pull_request_review_id":137859663,"id":203047212,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzA0NzIxMg==","diff_hunk":"@@ -54,4 +54,58 @@ def test_to_dense(self):\n         numpy.testing.assert_array_equal(x0, x1)\n \n \n+@testing.parameterize(*testing.product({\n+    'shape': [(2, 3), (3, 4)],\n+    'nbatch': [0, 1, 4],\n+    'dtype': [numpy.float16, numpy.float32, numpy.float64],\n+}))\n+class TestGetOrder(unittest.TestCase):\n+\n+    def test_get_order(self):\n+        if self.nbatch > 0:\n+            x_shape = (self.nbatch, self.shape[0], self.shape[1])\n+        else:\n+            x_shape = self.shape\n+        x0 = _setup_tensor(.5, 1, x_shape, self.dtype, .75)\n+        x0 = numpy.ascontiguousarray(x0)\n+        if self.nbatch > 0:\n+            x0[0, 0, self.shape[1]-1] = 1.\n+            x0[0, self.shape[0]-1, 0] = 1.\n+        else:\n+            x0[0, self.shape[1]-1] = 1.\n+            x0[self.shape[0]-1, 0] = 1.\n+        sp_x = utils.to_coo(x0)\n+        row = sp_x.row\n+        col = sp_x.col\n+        assert(utils.get_order(row, col) == 'C')\n+        assert(utils.get_order(col, row) == 'F')\n+\n+\n+class TestGetOrder2(unittest.TestCase):\n+\n+    def test_other_order(self):\n+        row = numpy.array((0, 2, 4, 1, 3), dtype=numpy.int32)\n+        col = numpy.array((1, 3, 0, 2, 4), dtype=numpy.int32)\n+        assert(utils.get_order(row, col) == 'other')\n+        assert(utils.get_order(col, row) == 'other')","path":"tests/chainer_tests/utils_tests/test_sparse.py","position":37,"original_position":37,"commit_id":"76767ec37659d4ca21a6c4877009a8d91c5a5cea","original_commit_id":"76767ec37659d4ca21a6c4877009a8d91c5a5cea","user":{"login":"hvy","id":5983694,"node_id":"MDQ6VXNlcjU5ODM2OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5983694?v=4","gravatar_id":"","url":"https://api.github.com/users/hvy","html_url":"https://github.com/hvy","followers_url":"https://api.github.com/users/hvy/followers","following_url":"https://api.github.com/users/hvy/following{/other_user}","gists_url":"https://api.github.com/users/hvy/gists{/gist_id}","starred_url":"https://api.github.com/users/hvy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvy/subscriptions","organizations_url":"https://api.github.com/users/hvy/orgs","repos_url":"https://api.github.com/users/hvy/repos","events_url":"https://api.github.com/users/hvy/events{/privacy}","received_events_url":"https://api.github.com/users/hvy/received_events","type":"User","site_admin":false},"body":"Could you prefer `assert utils.get_order(col, row) == 'other'`?","created_at":"2018-07-17T14:35:36Z","updated_at":"2018-07-17T14:35:36Z","html_url":"https://github.com/chainer/chainer/pull/4831#discussion_r203047212","pull_request_url":"https://api.github.com/repos/chainer/chainer/pulls/4831","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/chainer/chainer/pulls/comments/203047212"},"html":{"href":"https://github.com/chainer/chainer/pull/4831#discussion_r203047212"},"pull_request":{"href":"https://api.github.com/repos/chainer/chainer/pulls/4831"}}},"pull_request":{"url":"https://api.github.com/repos/chainer/chainer/pulls/4831","id":191727822,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxNzI3ODIy","html_url":"https://github.com/chainer/chainer/pull/4831","diff_url":"https://github.com/chainer/chainer/pull/4831.diff","patch_url":"https://github.com/chainer/chainer/pull/4831.patch","issue_url":"https://api.github.com/repos/chainer/chainer/issues/4831","number":4831,"state":"open","locked":false,"title":"Improve performance of sparse_matmul","user":{"login":"anaruse","id":20274068,"node_id":"MDQ6VXNlcjIwMjc0MDY4","avatar_url":"https://avatars1.githubusercontent.com/u/20274068?v=4","gravatar_id":"","url":"https://api.github.com/users/anaruse","html_url":"https://github.com/anaruse","followers_url":"https://api.github.com/users/anaruse/followers","following_url":"https://api.github.com/users/anaruse/following{/other_user}","gists_url":"https://api.github.com/users/anaruse/gists{/gist_id}","starred_url":"https://api.github.com/users/anaruse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anaruse/subscriptions","organizations_url":"https://api.github.com/users/anaruse/orgs","repos_url":"https://api.github.com/users/anaruse/repos","events_url":"https://api.github.com/users/anaruse/events{/privacy}","received_events_url":"https://api.github.com/users/anaruse/received_events","type":"User","site_admin":false},"body":"This PR aims to improve the performance of `sparse_matmul`.\r\n\r\nThe current `sparse_matmul` for GPU are implemented on NO assumption about how sparse matrix is being sorted. Therefore, memory access conflicts by atomic operations may occur badly and the performance may decrease. This performance degradation can be mitigated if there is kind of information about how the sparse matrix is sorted.\r\n\r\nThis PR adds an option `row_major` to a class `CooMatrix` so that you can add a hint on how the sparse matrix is being sorted. If you specify `row_major=True` or `row_major=False` when you make a sparse matrix using `CooMatrix`, then the sparse matrix is assumed to be sorted in row-major or column-major format respectively, and internal functions will use that information to improve performance.","created_at":"2018-05-31T11:43:45Z","updated_at":"2018-07-17T14:35:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b219af3d7f441c5a45d31a2c39d24add740f67b","assignee":{"login":"hvy","id":5983694,"node_id":"MDQ6VXNlcjU5ODM2OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5983694?v=4","gravatar_id":"","url":"https://api.github.com/users/hvy","html_url":"https://github.com/hvy","followers_url":"https://api.github.com/users/hvy/followers","following_url":"https://api.github.com/users/hvy/following{/other_user}","gists_url":"https://api.github.com/users/hvy/gists{/gist_id}","starred_url":"https://api.github.com/users/hvy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvy/subscriptions","organizations_url":"https://api.github.com/users/hvy/orgs","repos_url":"https://api.github.com/users/hvy/repos","events_url":"https://api.github.com/users/hvy/events{/privacy}","received_events_url":"https://api.github.com/users/hvy/received_events","type":"User","site_admin":false},"assignees":[{"login":"hvy","id":5983694,"node_id":"MDQ6VXNlcjU5ODM2OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5983694?v=4","gravatar_id":"","url":"https://api.github.com/users/hvy","html_url":"https://github.com/hvy","followers_url":"https://api.github.com/users/hvy/followers","following_url":"https://api.github.com/users/hvy/following{/other_user}","gists_url":"https://api.github.com/users/hvy/gists{/gist_id}","starred_url":"https://api.github.com/users/hvy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvy/subscriptions","organizations_url":"https://api.github.com/users/hvy/orgs","repos_url":"https://api.github.com/users/hvy/repos","events_url":"https://api.github.com/users/hvy/events{/privacy}","received_events_url":"https://api.github.com/users/hvy/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":222603817,"node_id":"MDU6TGFiZWwyMjI2MDM4MTc=","url":"https://api.github.com/repos/chainer/chainer/labels/feature","name":"feature","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/chainer/chainer/pulls/4831/commits","review_comments_url":"https://api.github.com/repos/chainer/chainer/pulls/4831/comments","review_comment_url":"https://api.github.com/repos/chainer/chainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chainer/chainer/issues/4831/comments","statuses_url":"https://api.github.com/repos/chainer/chainer/statuses/76767ec37659d4ca21a6c4877009a8d91c5a5cea","head":{"label":"anaruse:speedup_sparse_matmul","ref":"speedup_sparse_matmul","sha":"76767ec37659d4ca21a6c4877009a8d91c5a5cea","user":{"login":"anaruse","id":20274068,"node_id":"MDQ6VXNlcjIwMjc0MDY4","avatar_url":"https://avatars1.githubusercontent.com/u/20274068?v=4","gravatar_id":"","url":"https://api.github.com/users/anaruse","html_url":"https://github.com/anaruse","followers_url":"https://api.github.com/users/anaruse/followers","following_url":"https://api.github.com/users/anaruse/following{/other_user}","gists_url":"https://api.github.com/users/anaruse/gists{/gist_id}","starred_url":"https://api.github.com/users/anaruse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anaruse/subscriptions","organizations_url":"https://api.github.com/users/anaruse/orgs","repos_url":"https://api.github.com/users/anaruse/repos","events_url":"https://api.github.com/users/anaruse/events{/privacy}","received_events_url":"https://api.github.com/users/anaruse/received_events","type":"User","site_admin":false},"repo":{"id":63754829,"node_id":"MDEwOlJlcG9zaXRvcnk2Mzc1NDgyOQ==","name":"chainer","full_name":"anaruse/chainer","owner":{"login":"anaruse","id":20274068,"node_id":"MDQ6VXNlcjIwMjc0MDY4","avatar_url":"https://avatars1.githubusercontent.com/u/20274068?v=4","gravatar_id":"","url":"https://api.github.com/users/anaruse","html_url":"https://github.com/anaruse","followers_url":"https://api.github.com/users/anaruse/followers","following_url":"https://api.github.com/users/anaruse/following{/other_user}","gists_url":"https://api.github.com/users/anaruse/gists{/gist_id}","starred_url":"https://api.github.com/users/anaruse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anaruse/subscriptions","organizations_url":"https://api.github.com/users/anaruse/orgs","repos_url":"https://api.github.com/users/anaruse/repos","events_url":"https://api.github.com/users/anaruse/events{/privacy}","received_events_url":"https://api.github.com/users/anaruse/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anaruse/chainer","description":"A flexible framework of neural networks for deep learning","fork":true,"url":"https://api.github.com/repos/anaruse/chainer","forks_url":"https://api.github.com/repos/anaruse/chainer/forks","keys_url":"https://api.github.com/repos/anaruse/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anaruse/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anaruse/chainer/teams","hooks_url":"https://api.github.com/repos/anaruse/chainer/hooks","issue_events_url":"https://api.github.com/repos/anaruse/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/anaruse/chainer/events","assignees_url":"https://api.github.com/repos/anaruse/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/anaruse/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/anaruse/chainer/tags","blobs_url":"https://api.github.com/repos/anaruse/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anaruse/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anaruse/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/anaruse/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anaruse/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/anaruse/chainer/languages","stargazers_url":"https://api.github.com/repos/anaruse/chainer/stargazers","contributors_url":"https://api.github.com/repos/anaruse/chainer/contributors","subscribers_url":"https://api.github.com/repos/anaruse/chainer/subscribers","subscription_url":"https://api.github.com/repos/anaruse/chainer/subscription","commits_url":"https://api.github.com/repos/anaruse/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/anaruse/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/anaruse/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/anaruse/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/anaruse/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/anaruse/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anaruse/chainer/merges","archive_url":"https://api.github.com/repos/anaruse/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anaruse/chainer/downloads","issues_url":"https://api.github.com/repos/anaruse/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/anaruse/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/anaruse/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/anaruse/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anaruse/chainer/labels{/name}","releases_url":"https://api.github.com/repos/anaruse/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/anaruse/chainer/deployments","created_at":"2016-07-20T06:06:21Z","updated_at":"2018-06-25T02:55:31Z","pushed_at":"2018-07-11T10:40:28Z","git_url":"git://github.com/anaruse/chainer.git","ssh_url":"git@github.com:anaruse/chainer.git","clone_url":"https://github.com/anaruse/chainer.git","svn_url":"https://github.com/anaruse/chainer","homepage":"http://chainer.org","size":31270,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"chainer:master","ref":"master","sha":"9718f47ff29f4be6c3e6c3f44092441849a5adf1","user":{"login":"chainer","id":23183003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMTgzMDAz","avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"repo":{"id":36914478,"node_id":"MDEwOlJlcG9zaXRvcnkzNjkxNDQ3OA==","name":"chainer","full_name":"chainer/chainer","owner":{"login":"chainer","id":23183003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMTgzMDAz","avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chainer/chainer","description":"A flexible framework of neural networks for deep learning","fork":false,"url":"https://api.github.com/repos/chainer/chainer","forks_url":"https://api.github.com/repos/chainer/chainer/forks","keys_url":"https://api.github.com/repos/chainer/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chainer/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chainer/chainer/teams","hooks_url":"https://api.github.com/repos/chainer/chainer/hooks","issue_events_url":"https://api.github.com/repos/chainer/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/chainer/chainer/events","assignees_url":"https://api.github.com/repos/chainer/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/chainer/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/chainer/chainer/tags","blobs_url":"https://api.github.com/repos/chainer/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chainer/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chainer/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/chainer/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chainer/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/chainer/chainer/languages","stargazers_url":"https://api.github.com/repos/chainer/chainer/stargazers","contributors_url":"https://api.github.com/repos/chainer/chainer/contributors","subscribers_url":"https://api.github.com/repos/chainer/chainer/subscribers","subscription_url":"https://api.github.com/repos/chainer/chainer/subscription","commits_url":"https://api.github.com/repos/chainer/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/chainer/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/chainer/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/chainer/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/chainer/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/chainer/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chainer/chainer/merges","archive_url":"https://api.github.com/repos/chainer/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chainer/chainer/downloads","issues_url":"https://api.github.com/repos/chainer/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/chainer/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/chainer/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/chainer/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chainer/chainer/labels{/name}","releases_url":"https://api.github.com/repos/chainer/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/chainer/chainer/deployments","created_at":"2015-06-05T05:50:37Z","updated_at":"2018-07-17T12:32:58Z","pushed_at":"2018-07-17T11:53:36Z","git_url":"git://github.com/chainer/chainer.git","ssh_url":"git@github.com:chainer/chainer.git","clone_url":"https://github.com/chainer/chainer.git","svn_url":"https://github.com/chainer/chainer","homepage":"https://chainer.org","size":26840,"stargazers_count":3954,"watchers_count":3954,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1056,"mirror_url":null,"archived":false,"open_issues_count":205,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1056,"open_issues":205,"watchers":3954,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chainer/chainer/pulls/4831"},"html":{"href":"https://github.com/chainer/chainer/pull/4831"},"issue":{"href":"https://api.github.com/repos/chainer/chainer/issues/4831"},"comments":{"href":"https://api.github.com/repos/chainer/chainer/issues/4831/comments"},"review_comments":{"href":"https://api.github.com/repos/chainer/chainer/pulls/4831/comments"},"review_comment":{"href":"https://api.github.com/repos/chainer/chainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chainer/chainer/pulls/4831/commits"},"statuses":{"href":"https://api.github.com/repos/chainer/chainer/statuses/76767ec37659d4ca21a6c4877009a8d91c5a5cea"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hvy"}}