{"action":"created","comment":{"url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/comments/195545647","pull_request_review_id":128936858,"id":195545647,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTU0NTY0Nw==","diff_hunk":"@@ -0,0 +1,56 @@\n+#ifndef GPU_SWAP_HISTORY_H_\n+#define GPU_SWAP_HISTORY_H_\n+\n+#include <chrono>\n+#include <vector>\n+#include \"storage.h\"\n+#include <thread>\n+#include <mutex>\n+\n+#if MXNET_USE_CUDA\n+#include <cuda_runtime.h>\n+#endif\n+\n+\n+using namespace std::chrono;\n+\n+namespace mxnet {\n+\n+class MemHistory {\n+public:\n+\n+  enum record_t {GET_ADDR, SET_ADDR, DEL_ADDR};\n+  struct MemRecord {\n+    handle_id_t handle_id;\n+    record_t operation_id;\n+    timestamp_t time;\n+    size_t size;\n+  };\n+\n+  std::vector<std::vector<MemRecord> > \n+      history = std::vector<std::vector<MemRecord> >(8);\n+  size_t record_idx;\n+\n+  ~MemHistory();\n+  static MemHistory* Get();\n+  static std::shared_ptr<MemHistory> _GetSharedRef();\n+  bool IterationStarted() {return iteration_started_;}\n+  bool DoRecord() {return do_record_;}\n+  void PutRecord(handle_id_t handle_id, int device, record_t type, size_t size);\n+  handle_id_t GetFurthest(std::vector<handle_id_t> handles, int device);\n+  void PrintRecord(int device);\n+  void StartIteration();\n+  void EndIteration();\n+\n+private:\n+  MemHistory();\n+  bool iteration_started_;\n+  bool do_record_;\n+  size_t iteration_idx_;\n+  high_resolution_clock::time_point begin_time_;\n+  std::vector<std::mutex> mutex_ = std::vector<std::mutex>(8);\n+};\n+\n+}","path":"include/mxnet/gpu_swap_history.h","position":54,"original_position":54,"commit_id":"eec8d17c5116a8d988553bdad42818213dfb0334","original_commit_id":"eec8d17c5116a8d988553bdad42818213dfb0334","user":{"login":"Sotskin","id":13271027,"node_id":"MDQ6VXNlcjEzMjcxMDI3","avatar_url":"https://avatars3.githubusercontent.com/u/13271027?v=4","gravatar_id":"","url":"https://api.github.com/users/Sotskin","html_url":"https://github.com/Sotskin","followers_url":"https://api.github.com/users/Sotskin/followers","following_url":"https://api.github.com/users/Sotskin/following{/other_user}","gists_url":"https://api.github.com/users/Sotskin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sotskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sotskin/subscriptions","organizations_url":"https://api.github.com/users/Sotskin/orgs","repos_url":"https://api.github.com/users/Sotskin/repos","events_url":"https://api.github.com/users/Sotskin/events{/privacy}","received_events_url":"https://api.github.com/users/Sotskin/received_events","type":"User","site_admin":false},"body":"Comment\r\n`}; // class MemHistory`\r\n`} // namespace mxnet`\r\nFor better readability","created_at":"2018-06-14T19:34:58Z","updated_at":"2018-06-14T19:36:05Z","html_url":"https://github.com/Sotskin/incubator-mxnet/pull/6#discussion_r195545647","pull_request_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/comments/195545647"},"html":{"href":"https://github.com/Sotskin/incubator-mxnet/pull/6#discussion_r195545647"},"pull_request":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6","id":194992455,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0OTkyNDU1","html_url":"https://github.com/Sotskin/incubator-mxnet/pull/6","diff_url":"https://github.com/Sotskin/incubator-mxnet/pull/6.diff","patch_url":"https://github.com/Sotskin/incubator-mxnet/pull/6.patch","issue_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/6","number":6,"state":"open","locked":false,"title":"Simple history recording","user":{"login":"KarlLeell","id":22437663,"node_id":"MDQ6VXNlcjIyNDM3NjYz","avatar_url":"https://avatars3.githubusercontent.com/u/22437663?v=4","gravatar_id":"","url":"https://api.github.com/users/KarlLeell","html_url":"https://github.com/KarlLeell","followers_url":"https://api.github.com/users/KarlLeell/followers","following_url":"https://api.github.com/users/KarlLeell/following{/other_user}","gists_url":"https://api.github.com/users/KarlLeell/gists{/gist_id}","starred_url":"https://api.github.com/users/KarlLeell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KarlLeell/subscriptions","organizations_url":"https://api.github.com/users/KarlLeell/orgs","repos_url":"https://api.github.com/users/KarlLeell/repos","events_url":"https://api.github.com/users/KarlLeell/events{/privacy}","received_events_url":"https://api.github.com/users/KarlLeell/received_events","type":"User","site_admin":false},"body":"#Comments#\r\nHeader file put in include as not only local files include it.\r\nData structure and basic functionalities of history record implemented.\r\nTODO: algorithm for choosing victim when memory is full.","created_at":"2018-06-14T19:20:57Z","updated_at":"2018-06-14T19:36:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87af572c9fe2ca523204a838171392a3aea282e7","assignee":null,"assignees":[],"requested_reviewers":[{"login":"fegin","id":2461448,"node_id":"MDQ6VXNlcjI0NjE0NDg=","avatar_url":"https://avatars0.githubusercontent.com/u/2461448?v=4","gravatar_id":"","url":"https://api.github.com/users/fegin","html_url":"https://github.com/fegin","followers_url":"https://api.github.com/users/fegin/followers","following_url":"https://api.github.com/users/fegin/following{/other_user}","gists_url":"https://api.github.com/users/fegin/gists{/gist_id}","starred_url":"https://api.github.com/users/fegin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fegin/subscriptions","organizations_url":"https://api.github.com/users/fegin/orgs","repos_url":"https://api.github.com/users/fegin/repos","events_url":"https://api.github.com/users/fegin/events{/privacy}","received_events_url":"https://api.github.com/users/fegin/received_events","type":"User","site_admin":false},{"login":"PhantomPhillipe","id":22649722,"node_id":"MDQ6VXNlcjIyNjQ5NzIy","avatar_url":"https://avatars3.githubusercontent.com/u/22649722?v=4","gravatar_id":"","url":"https://api.github.com/users/PhantomPhillipe","html_url":"https://github.com/PhantomPhillipe","followers_url":"https://api.github.com/users/PhantomPhillipe/followers","following_url":"https://api.github.com/users/PhantomPhillipe/following{/other_user}","gists_url":"https://api.github.com/users/PhantomPhillipe/gists{/gist_id}","starred_url":"https://api.github.com/users/PhantomPhillipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhantomPhillipe/subscriptions","organizations_url":"https://api.github.com/users/PhantomPhillipe/orgs","repos_url":"https://api.github.com/users/PhantomPhillipe/repos","events_url":"https://api.github.com/users/PhantomPhillipe/events{/privacy}","received_events_url":"https://api.github.com/users/PhantomPhillipe/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6/commits","review_comments_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6/comments","review_comment_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/6/comments","statuses_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/statuses/eec8d17c5116a8d988553bdad42818213dfb0334","head":{"label":"Sotskin:gpu_swap_prefetch","ref":"gpu_swap_prefetch","sha":"eec8d17c5116a8d988553bdad42818213dfb0334","user":{"login":"Sotskin","id":13271027,"node_id":"MDQ6VXNlcjEzMjcxMDI3","avatar_url":"https://avatars3.githubusercontent.com/u/13271027?v=4","gravatar_id":"","url":"https://api.github.com/users/Sotskin","html_url":"https://github.com/Sotskin","followers_url":"https://api.github.com/users/Sotskin/followers","following_url":"https://api.github.com/users/Sotskin/following{/other_user}","gists_url":"https://api.github.com/users/Sotskin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sotskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sotskin/subscriptions","organizations_url":"https://api.github.com/users/Sotskin/orgs","repos_url":"https://api.github.com/users/Sotskin/repos","events_url":"https://api.github.com/users/Sotskin/events{/privacy}","received_events_url":"https://api.github.com/users/Sotskin/received_events","type":"User","site_admin":false},"repo":{"id":136958964,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY5NTg5NjQ=","name":"incubator-mxnet","full_name":"Sotskin/incubator-mxnet","owner":{"login":"Sotskin","id":13271027,"node_id":"MDQ6VXNlcjEzMjcxMDI3","avatar_url":"https://avatars3.githubusercontent.com/u/13271027?v=4","gravatar_id":"","url":"https://api.github.com/users/Sotskin","html_url":"https://github.com/Sotskin","followers_url":"https://api.github.com/users/Sotskin/followers","following_url":"https://api.github.com/users/Sotskin/following{/other_user}","gists_url":"https://api.github.com/users/Sotskin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sotskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sotskin/subscriptions","organizations_url":"https://api.github.com/users/Sotskin/orgs","repos_url":"https://api.github.com/users/Sotskin/repos","events_url":"https://api.github.com/users/Sotskin/events{/privacy}","received_events_url":"https://api.github.com/users/Sotskin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sotskin/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/Sotskin/incubator-mxnet","forks_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/deployments","created_at":"2018-06-11T17:27:57Z","updated_at":"2018-06-11T17:28:06Z","pushed_at":"2018-06-14T19:34:13Z","git_url":"git://github.com/Sotskin/incubator-mxnet.git","ssh_url":"git@github.com:Sotskin/incubator-mxnet.git","clone_url":"https://github.com/Sotskin/incubator-mxnet.git","svn_url":"https://github.com/Sotskin/incubator-mxnet","homepage":"https://mxnet.apache.org","size":37570,"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":1,"mirror_url":null,"archived":false,"open_issues_count":1,"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":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Sotskin:gpu_swap","ref":"gpu_swap","sha":"9c3c84c26150f770b2eba73a26074991d5460fe8","user":{"login":"Sotskin","id":13271027,"node_id":"MDQ6VXNlcjEzMjcxMDI3","avatar_url":"https://avatars3.githubusercontent.com/u/13271027?v=4","gravatar_id":"","url":"https://api.github.com/users/Sotskin","html_url":"https://github.com/Sotskin","followers_url":"https://api.github.com/users/Sotskin/followers","following_url":"https://api.github.com/users/Sotskin/following{/other_user}","gists_url":"https://api.github.com/users/Sotskin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sotskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sotskin/subscriptions","organizations_url":"https://api.github.com/users/Sotskin/orgs","repos_url":"https://api.github.com/users/Sotskin/repos","events_url":"https://api.github.com/users/Sotskin/events{/privacy}","received_events_url":"https://api.github.com/users/Sotskin/received_events","type":"User","site_admin":false},"repo":{"id":136958964,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY5NTg5NjQ=","name":"incubator-mxnet","full_name":"Sotskin/incubator-mxnet","owner":{"login":"Sotskin","id":13271027,"node_id":"MDQ6VXNlcjEzMjcxMDI3","avatar_url":"https://avatars3.githubusercontent.com/u/13271027?v=4","gravatar_id":"","url":"https://api.github.com/users/Sotskin","html_url":"https://github.com/Sotskin","followers_url":"https://api.github.com/users/Sotskin/followers","following_url":"https://api.github.com/users/Sotskin/following{/other_user}","gists_url":"https://api.github.com/users/Sotskin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sotskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sotskin/subscriptions","organizations_url":"https://api.github.com/users/Sotskin/orgs","repos_url":"https://api.github.com/users/Sotskin/repos","events_url":"https://api.github.com/users/Sotskin/events{/privacy}","received_events_url":"https://api.github.com/users/Sotskin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sotskin/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/Sotskin/incubator-mxnet","forks_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/Sotskin/incubator-mxnet/deployments","created_at":"2018-06-11T17:27:57Z","updated_at":"2018-06-11T17:28:06Z","pushed_at":"2018-06-14T19:34:13Z","git_url":"git://github.com/Sotskin/incubator-mxnet.git","ssh_url":"git@github.com:Sotskin/incubator-mxnet.git","clone_url":"https://github.com/Sotskin/incubator-mxnet.git","svn_url":"https://github.com/Sotskin/incubator-mxnet","homepage":"https://mxnet.apache.org","size":37570,"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":1,"mirror_url":null,"archived":false,"open_issues_count":1,"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":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6"},"html":{"href":"https://github.com/Sotskin/incubator-mxnet/pull/6"},"issue":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/6"},"comments":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/Sotskin/incubator-mxnet/statuses/eec8d17c5116a8d988553bdad42818213dfb0334"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Sotskin"}}