payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rapidsai/rmm/pulls/comments/354365025","pull_request_review_id":327617190,"id":354365025,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM1NDM2NTAyNQ==","diff_hunk":"@@ -267,6 +267,31 @@ def get_ipc_handle(ary, stream=0):\n     )\n \n \n+def make_cupy_use_rmm():\n+    \"\"\"\n+    Make CuPy use RMM.\n+    Requires the cupy module.\n+    \"\"\"\n+    import cupy\n+    from rmm._lib.device_buffer import DeviceBuffer\n+\n+    class RMMMemory(cupy.cuda.memory.BaseMemory):\n+        def __init__(self, size):\n+            self.size = size\n+            self.device_id = cupy.cuda.device.get_device_id()\n+            if size > 0:\n+                self.rmm_array = DeviceBuffer(size=size)\n+                self.ptr = self.rmm_array.ptr\n+            else:\n+                self.rmm_array = None\n+                self.ptr = 0\n+\n+    def rmm_mem_allocator(bsize):\n+        return cupy.cuda.memory.MemoryPointer(RMMMemory(bsize), 0)","path":"python/rmm/rmm.py","position":24,"original_position":24,"commit_id":"a77ce838cdc888e32ac1ebfe4832d7c7cee184f1","original_commit_id":"3e8ddbe6edd2d291515bf087a8c4c0a2b812163a","user":{"login":"kkraus14","id":3665167,"node_id":"MDQ6VXNlcjM2NjUxNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/3665167?v=4","gravatar_id":"","url":"https://api.github.com/users/kkraus14","html_url":"https://github.com/kkraus14","followers_url":"https://api.github.com/users/kkraus14/followers","following_url":"https://api.github.com/users/kkraus14/following{/other_user}","gists_url":"https://api.github.com/users/kkraus14/gists{/gist_id}","starred_url":"https://api.github.com/users/kkraus14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkraus14/subscriptions","organizations_url":"https://api.github.com/users/kkraus14/orgs","repos_url":"https://api.github.com/users/kkraus14/repos","events_url":"https://api.github.com/users/kkraus14/events{/privacy}","received_events_url":"https://api.github.com/users/kkraus14/received_events","type":"User","site_admin":false},"body":"> @kkraus14 I thought Python was duck typed, so you wouldn't need to subclass, just provide the methods and members that cupy expects. But it was just a thought and I'm by no means a Python expert.\r\n\r\nCuPy is mostly Cython so a lot of that can go out the window depending on if something is passed into `cdef` functions and whatnot as well.","created_at":"2019-12-05T15:04:56Z","updated_at":"2019-12-05T15:04:56Z","html_url":"https://github.com/rapidsai/rmm/pull/198#discussion_r354365025","pull_request_url":"https://api.github.com/repos/rapidsai/rmm/pulls/198","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rapidsai/rmm/pulls/comments/354365025"},"html":{"href":"https://github.com/rapidsai/rmm/pull/198#discussion_r354365025"},"pull_request":{"href":"https://api.github.com/repos/rapidsai/rmm/pulls/198"}},"in_reply_to_id":354016622},"pull_request":{"url":"https://api.github.com/repos/rapidsai/rmm/pulls/198","id":348900328,"node_id":"MDExOlB1bGxSZXF1ZXN0MzQ4OTAwMzI4","html_url":"https://github.com/rapidsai/rmm/pull/198","diff_url":"https://github.com/rapidsai/rmm/pull/198.diff","patch_url":"https://github.com/rapidsai/rmm/pull/198.patch","issue_url":"https://api.github.com/repos/rapidsai/rmm/issues/198","number":198,"state":"open","locked":false,"title":"[WIP] Implemented make_cupy_use_rmm()","user":{"login":"madsbk","id":1041088,"node_id":"MDQ6VXNlcjEwNDEwODg=","avatar_url":"https://avatars1.githubusercontent.com/u/1041088?v=4","gravatar_id":"","url":"https://api.github.com/users/madsbk","html_url":"https://github.com/madsbk","followers_url":"https://api.github.com/users/madsbk/followers","following_url":"https://api.github.com/users/madsbk/following{/other_user}","gists_url":"https://api.github.com/users/madsbk/gists{/gist_id}","starred_url":"https://api.github.com/users/madsbk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madsbk/subscriptions","organizations_url":"https://api.github.com/users/madsbk/orgs","repos_url":"https://api.github.com/users/madsbk/repos","events_url":"https://api.github.com/users/madsbk/events{/privacy}","received_events_url":"https://api.github.com/users/madsbk/received_events","type":"User","site_admin":false},"body":"Closes https://github.com/rapidsai/rmm/issues/191 by implementing `rmm.make_cupy_use_rmm()`\r\n\r\nI suggest that we add this function here and then make [`cudf.set_allocator()`](https://github.com/rapidsai/cudf/blob/5a73e75be813e76f750f3ad1416d8cdc54906bbd/python/cudf/cudf/utils/utils.py#L253) set it implicitly.\r\n\r\nWhat are your thoughts? \r\nDo we want `make_cupy_use_rmm()` here? or do we want it in another repos such as cuDF, dask-cuda, or ucx-py?\r\n@kkraus14 @harrism @jakirkham?","created_at":"2019-12-04T13:52:37Z","updated_at":"2019-12-05T15:04:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5defbdcc98e6002bb636e645c255c6479527a13","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rapidsai/rmm/pulls/198/commits","review_comments_url":"https://api.github.com/repos/rapidsai/rmm/pulls/198/comments","review_comment_url":"https://api.github.com/repos/rapidsai/rmm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rapidsai/rmm/issues/198/comments","statuses_url":"https://api.github.com/repos/rapidsai/rmm/statuses/a77ce838cdc888e32ac1ebfe4832d7c7cee184f1","head":{"label":"madsbk:make_cupy_use_rmm","ref":"make_cupy_use_rmm","sha":"a77ce838cdc888e32ac1ebfe4832d7c7cee184f1","user":{"login":"madsbk","id":1041088,"node_id":"MDQ6VXNlcjEwNDEwODg=","avatar_url":"https://avatars1.githubusercontent.com/u/1041088?v=4","gravatar_id":"","url":"https://api.github.com/users/madsbk","html_url":"https://github.com/madsbk","followers_url":"https://api.github.com/users/madsbk/followers","following_url":"https://api.github.com/users/madsbk/following{/other_user}","gists_url":"https://api.github.com/users/madsbk/gists{/gist_id}","starred_url":"https://api.github.com/users/madsbk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madsbk/subscriptions","organizations_url":"https://api.github.com/users/madsbk/orgs","repos_url":"https://api.github.com/users/madsbk/repos","events_url":"https://api.github.com/users/madsbk/events{/privacy}","received_events_url":"https://api.github.com/users/madsbk/received_events","type":"User","site_admin":false},"repo":{"id":225875933,"node_id":"MDEwOlJlcG9zaXRvcnkyMjU4NzU5MzM=","name":"rmm","full_name":"madsbk/rmm","private":false,"owner":{"login":"madsbk","id":1041088,"node_id":"MDQ6VXNlcjEwNDEwODg=","avatar_url":"https://avatars1.githubusercontent.com/u/1041088?v=4","gravatar_id":"","url":"https://api.github.com/users/madsbk","html_url":"https://github.com/madsbk","followers_url":"https://api.github.com/users/madsbk/followers","following_url":"https://api.github.com/users/madsbk/following{/other_user}","gists_url":"https://api.github.com/users/madsbk/gists{/gist_id}","starred_url":"https://api.github.com/users/madsbk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madsbk/subscriptions","organizations_url":"https://api.github.com/users/madsbk/orgs","repos_url":"https://api.github.com/users/madsbk/repos","events_url":"https://api.github.com/users/madsbk/events{/privacy}","received_events_url":"https://api.github.com/users/madsbk/received_events","type":"User","site_admin":false},"html_url":"https://github.com/madsbk/rmm","description":"RAPIDS Memory Manager","fork":true,"url":"https://api.github.com/repos/madsbk/rmm","forks_url":"https://api.github.com/repos/madsbk/rmm/forks","keys_url":"https://api.github.com/repos/madsbk/rmm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madsbk/rmm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madsbk/rmm/teams","hooks_url":"https://api.github.com/repos/madsbk/rmm/hooks","issue_events_url":"https://api.github.com/repos/madsbk/rmm/issues/events{/number}","events_url":"https://api.github.com/repos/madsbk/rmm/events","assignees_url":"https://api.github.com/repos/madsbk/rmm/assignees{/user}","branches_url":"https://api.github.com/repos/madsbk/rmm/branches{/branch}","tags_url":"https://api.github.com/repos/madsbk/rmm/tags","blobs_url":"https://api.github.com/repos/madsbk/rmm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madsbk/rmm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madsbk/rmm/git/refs{/sha}","trees_url":"https://api.github.com/repos/madsbk/rmm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madsbk/rmm/statuses/{sha}","languages_url":"https://api.github.com/repos/madsbk/rmm/languages","stargazers_url":"https://api.github.com/repos/madsbk/rmm/stargazers","contributors_url":"https://api.github.com/repos/madsbk/rmm/contributors","subscribers_url":"https://api.github.com/repos/madsbk/rmm/subscribers","subscription_url":"https://api.github.com/repos/madsbk/rmm/subscription","commits_url":"https://api.github.com/repos/madsbk/rmm/commits{/sha}","git_commits_url":"https://api.github.com/repos/madsbk/rmm/git/commits{/sha}","comments_url":"https://api.github.com/repos/madsbk/rmm/comments{/number}","issue_comment_url":"https://api.github.com/repos/madsbk/rmm/issues/comments{/number}","contents_url":"https://api.github.com/repos/madsbk/rmm/contents/{+path}","compare_url":"https://api.github.com/repos/madsbk/rmm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madsbk/rmm/merges","archive_url":"https://api.github.com/repos/madsbk/rmm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madsbk/rmm/downloads","issues_url":"https://api.github.com/repos/madsbk/rmm/issues{/number}","pulls_url":"https://api.github.com/repos/madsbk/rmm/pulls{/number}","milestones_url":"https://api.github.com/repos/madsbk/rmm/milestones{/number}","notifications_url":"https://api.github.com/repos/madsbk/rmm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madsbk/rmm/labels{/name}","releases_url":"https://api.github.com/repos/madsbk/rmm/releases{/id}","deployments_url":"https://api.github.com/repos/madsbk/rmm/deployments","created_at":"2019-12-04T13:38:03Z","updated_at":"2019-12-04T13:41:12Z","pushed_at":"2019-12-05T09:03:00Z","git_url":"git://github.com/madsbk/rmm.git","ssh_url":"git@github.com:madsbk/rmm.git","clone_url":"https://github.com/madsbk/rmm.git","svn_url":"https://github.com/madsbk/rmm","homepage":null,"size":737,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"branch-0.11"}},"base":{"label":"rapidsai:branch-0.12","ref":"branch-0.12","sha":"e24a1a6f631fe0de3a61110001d355e667f0242a","user":{"login":"rapidsai","id":43887749,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzODg3NzQ5","avatar_url":"https://avatars2.githubusercontent.com/u/43887749?v=4","gravatar_id":"","url":"https://api.github.com/users/rapidsai","html_url":"https://github.com/rapidsai","followers_url":"https://api.github.com/users/rapidsai/followers","following_url":"https://api.github.com/users/rapidsai/following{/other_user}","gists_url":"https://api.github.com/users/rapidsai/gists{/gist_id}","starred_url":"https://api.github.com/users/rapidsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapidsai/subscriptions","organizations_url":"https://api.github.com/users/rapidsai/orgs","repos_url":"https://api.github.com/users/rapidsai/repos","events_url":"https://api.github.com/users/rapidsai/events{/privacy}","received_events_url":"https://api.github.com/users/rapidsai/received_events","type":"Organization","site_admin":false},"repo":{"id":160453496,"node_id":"MDEwOlJlcG9zaXRvcnkxNjA0NTM0OTY=","name":"rmm","full_name":"rapidsai/rmm","private":false,"owner":{"login":"rapidsai","id":43887749,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzODg3NzQ5","avatar_url":"https://avatars2.githubusercontent.com/u/43887749?v=4","gravatar_id":"","url":"https://api.github.com/users/rapidsai","html_url":"https://github.com/rapidsai","followers_url":"https://api.github.com/users/rapidsai/followers","following_url":"https://api.github.com/users/rapidsai/following{/other_user}","gists_url":"https://api.github.com/users/rapidsai/gists{/gist_id}","starred_url":"https://api.github.com/users/rapidsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapidsai/subscriptions","organizations_url":"https://api.github.com/users/rapidsai/orgs","repos_url":"https://api.github.com/users/rapidsai/repos","events_url":"https://api.github.com/users/rapidsai/events{/privacy}","received_events_url":"https://api.github.com/users/rapidsai/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/rapidsai/rmm","description":"RAPIDS Memory Manager","fork":false,"url":"https://api.github.com/repos/rapidsai/rmm","forks_url":"https://api.github.com/repos/rapidsai/rmm/forks","keys_url":"https://api.github.com/repos/rapidsai/rmm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rapidsai/rmm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rapidsai/rmm/teams","hooks_url":"https://api.github.com/repos/rapidsai/rmm/hooks","issue_events_url":"https://api.github.com/repos/rapidsai/rmm/issues/events{/number}","events_url":"https://api.github.com/repos/rapidsai/rmm/events","assignees_url":"https://api.github.com/repos/rapidsai/rmm/assignees{/user}","branches_url":"https://api.github.com/repos/rapidsai/rmm/branches{/branch}","tags_url":"https://api.github.com/repos/rapidsai/rmm/tags","blobs_url":"https://api.github.com/repos/rapidsai/rmm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rapidsai/rmm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rapidsai/rmm/git/refs{/sha}","trees_url":"https://api.github.com/repos/rapidsai/rmm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rapidsai/rmm/statuses/{sha}","languages_url":"https://api.github.com/repos/rapidsai/rmm/languages","stargazers_url":"https://api.github.com/repos/rapidsai/rmm/stargazers","contributors_url":"https://api.github.com/repos/rapidsai/rmm/contributors","subscribers_url":"https://api.github.com/repos/rapidsai/rmm/subscribers","subscription_url":"https://api.github.com/repos/rapidsai/rmm/subscription","commits_url":"https://api.github.com/repos/rapidsai/rmm/commits{/sha}","git_commits_url":"https://api.github.com/repos/rapidsai/rmm/git/commits{/sha}","comments_url":"https://api.github.com/repos/rapidsai/rmm/comments{/number}","issue_comment_url":"https://api.github.com/repos/rapidsai/rmm/issues/comments{/number}","contents_url":"https://api.github.com/repos/rapidsai/rmm/contents/{+path}","compare_url":"https://api.github.com/repos/rapidsai/rmm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rapidsai/rmm/merges","archive_url":"https://api.github.com/repos/rapidsai/rmm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rapidsai/rmm/downloads","issues_url":"https://api.github.com/repos/rapidsai/rmm/issues{/number}","pulls_url":"https://api.github.com/repos/rapidsai/rmm/pulls{/number}","milestones_url":"https://api.github.com/repos/rapidsai/rmm/milestones{/number}","notifications_url":"https://api.github.com/repos/rapidsai/rmm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rapidsai/rmm/labels{/name}","releases_url":"https://api.github.com/repos/rapidsai/rmm/releases{/id}","deployments_url":"https://api.github.com/repos/rapidsai/rmm/deployments","created_at":"2018-12-05T03:13:32Z","updated_at":"2019-12-04T22:20:35Z","pushed_at":"2019-12-05T09:03:02Z","git_url":"git://github.com/rapidsai/rmm.git","ssh_url":"git@github.com:rapidsai/rmm.git","clone_url":"https://github.com/rapidsai/rmm.git","svn_url":"https://github.com/rapidsai/rmm","homepage":null,"size":786,"stargazers_count":51,"watchers_count":51,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":42,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":41,"open_issues":42,"watchers":51,"default_branch":"branch-0.11"}},"_links":{"self":{"href":"https://api.github.com/repos/rapidsai/rmm/pulls/198"},"html":{"href":"https://github.com/rapidsai/rmm/pull/198"},"issue":{"href":"https://api.github.com/repos/rapidsai/rmm/issues/198"},"comments":{"href":"https://api.github.com/repos/rapidsai/rmm/issues/198/comments"},"review_comments":{"href":"https://api.github.com/repos/rapidsai/rmm/pulls/198/comments"},"review_comment":{"href":"https://api.github.com/repos/rapidsai/rmm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rapidsai/rmm/pulls/198/commits"},"statuses":{"href":"https://api.github.com/repos/rapidsai/rmm/statuses/a77ce838cdc888e32ac1ebfe4832d7c7cee184f1"}},"author_association":"MEMBER"}}
other: {"actor":{"display_login":"kkraus14"}}