{"action":"created","comment":{"url":"https://api.github.com/repos/BVLC/caffe/pulls/comments/27228350","id":27228350,"diff_hunk":"@@ -181,6 +181,87 @@ class LMDB : public DB {\n   MDB_dbi mdb_dbi_;\n };\n \n+\n+#define MAX_BUF 10485760  // max entry size\n+class DatumFileCursor : public Cursor {\n+ public:\n+  explicit DatumFileCursor(const string& path) {\n+    this->path = path;\n+    in = NULL;\n+    SeekToFirst();\n+  }\n+  virtual ~DatumFileCursor() {","path":"include/caffe/util/db.hpp","position":13,"original_position":13,"commit_id":"bbbda4492cb3038e209560a056b51e73218b6200","original_commit_id":"bbbda4492cb3038e209560a056b51e73218b6200","user":{"login":"sguada","id":1766524,"avatar_url":"https://avatars.githubusercontent.com/u/1766524?v=3","gravatar_id":"","url":"https://api.github.com/users/sguada","html_url":"https://github.com/sguada","followers_url":"https://api.github.com/users/sguada/followers","following_url":"https://api.github.com/users/sguada/following{/other_user}","gists_url":"https://api.github.com/users/sguada/gists{/gist_id}","starred_url":"https://api.github.com/users/sguada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguada/subscriptions","organizations_url":"https://api.github.com/users/sguada/orgs","repos_url":"https://api.github.com/users/sguada/repos","events_url":"https://api.github.com/users/sguada/events{/privacy}","received_events_url":"https://api.github.com/users/sguada/received_events","type":"User","site_admin":false},"body":"Should it close the input file?","created_at":"2015-03-26T16:16:46Z","updated_at":"2015-03-26T16:16:46Z","html_url":"https://github.com/BVLC/caffe/pull/2193#discussion_r27228350","pull_request_url":"https://api.github.com/repos/BVLC/caffe/pulls/2193","_links":{"self":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/comments/27228350"},"html":{"href":"https://github.com/BVLC/caffe/pull/2193#discussion_r27228350"},"pull_request":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/2193"}}},"pull_request":{"url":"https://api.github.com/repos/BVLC/caffe/pulls/2193","id":31886246,"html_url":"https://github.com/BVLC/caffe/pull/2193","diff_url":"https://github.com/BVLC/caffe/pull/2193.diff","patch_url":"https://github.com/BVLC/caffe/pull/2193.patch","issue_url":"https://api.github.com/repos/BVLC/caffe/issues/2193","number":2193,"state":"open","locked":false,"title":"Plain Datumfile input format for minimum memory usage","user":{"login":"immars","id":1144653,"avatar_url":"https://avatars.githubusercontent.com/u/1144653?v=3","gravatar_id":"","url":"https://api.github.com/users/immars","html_url":"https://github.com/immars","followers_url":"https://api.github.com/users/immars/followers","following_url":"https://api.github.com/users/immars/following{/other_user}","gists_url":"https://api.github.com/users/immars/gists{/gist_id}","starred_url":"https://api.github.com/users/immars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immars/subscriptions","organizations_url":"https://api.github.com/users/immars/orgs","repos_url":"https://api.github.com/users/immars/repos","events_url":"https://api.github.com/users/immars/events{/privacy}","received_events_url":"https://api.github.com/users/immars/received_events","type":"User","site_admin":false},"body":"When training with leveldb/lmdb, memory increases linearly with iterations and even with Next()s for DataLayer's `rand_skip`.\r\n\r\nHere's simple plain datum file format via std::fstream to address this issue.\r\n\r\nPros\r\n\r\n* RAM usage basically stay constant (<1G, on googlenet small batches) during training as expected\r\n* datum file size between leveldb and lmdb format\r\n* no noticeable impact on training speed because of prefetch\r\n* concurrent read for multiple process\r\n\r\nCons\r\n* no random read. But caffe does not need random key-value access anyway.\r\n","created_at":"2015-03-25T01:30:39Z","updated_at":"2015-03-26T16:16:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3edd465bd283667132176b407164f8811dfebf16","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BVLC/caffe/pulls/2193/commits","review_comments_url":"https://api.github.com/repos/BVLC/caffe/pulls/2193/comments","review_comment_url":"https://api.github.com/repos/BVLC/caffe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BVLC/caffe/issues/2193/comments","statuses_url":"https://api.github.com/repos/BVLC/caffe/statuses/bbbda4492cb3038e209560a056b51e73218b6200","head":{"label":"immars:datumfile","ref":"datumfile","sha":"bbbda4492cb3038e209560a056b51e73218b6200","user":{"login":"immars","id":1144653,"avatar_url":"https://avatars.githubusercontent.com/u/1144653?v=3","gravatar_id":"","url":"https://api.github.com/users/immars","html_url":"https://github.com/immars","followers_url":"https://api.github.com/users/immars/followers","following_url":"https://api.github.com/users/immars/following{/other_user}","gists_url":"https://api.github.com/users/immars/gists{/gist_id}","starred_url":"https://api.github.com/users/immars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immars/subscriptions","organizations_url":"https://api.github.com/users/immars/orgs","repos_url":"https://api.github.com/users/immars/repos","events_url":"https://api.github.com/users/immars/events{/privacy}","received_events_url":"https://api.github.com/users/immars/received_events","type":"User","site_admin":false},"repo":{"id":28564835,"name":"caffe","full_name":"immars/caffe","owner":{"login":"immars","id":1144653,"avatar_url":"https://avatars.githubusercontent.com/u/1144653?v=3","gravatar_id":"","url":"https://api.github.com/users/immars","html_url":"https://github.com/immars","followers_url":"https://api.github.com/users/immars/followers","following_url":"https://api.github.com/users/immars/following{/other_user}","gists_url":"https://api.github.com/users/immars/gists{/gist_id}","starred_url":"https://api.github.com/users/immars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immars/subscriptions","organizations_url":"https://api.github.com/users/immars/orgs","repos_url":"https://api.github.com/users/immars/repos","events_url":"https://api.github.com/users/immars/events{/privacy}","received_events_url":"https://api.github.com/users/immars/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/immars/caffe","description":"Caffe: a fast framework for deep learning. For the most recent version checkout the dev branch. For the latest stable release checkout the master branch.","fork":true,"url":"https://api.github.com/repos/immars/caffe","forks_url":"https://api.github.com/repos/immars/caffe/forks","keys_url":"https://api.github.com/repos/immars/caffe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/immars/caffe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/immars/caffe/teams","hooks_url":"https://api.github.com/repos/immars/caffe/hooks","issue_events_url":"https://api.github.com/repos/immars/caffe/issues/events{/number}","events_url":"https://api.github.com/repos/immars/caffe/events","assignees_url":"https://api.github.com/repos/immars/caffe/assignees{/user}","branches_url":"https://api.github.com/repos/immars/caffe/branches{/branch}","tags_url":"https://api.github.com/repos/immars/caffe/tags","blobs_url":"https://api.github.com/repos/immars/caffe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/immars/caffe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/immars/caffe/git/refs{/sha}","trees_url":"https://api.github.com/repos/immars/caffe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/immars/caffe/statuses/{sha}","languages_url":"https://api.github.com/repos/immars/caffe/languages","stargazers_url":"https://api.github.com/repos/immars/caffe/stargazers","contributors_url":"https://api.github.com/repos/immars/caffe/contributors","subscribers_url":"https://api.github.com/repos/immars/caffe/subscribers","subscription_url":"https://api.github.com/repos/immars/caffe/subscription","commits_url":"https://api.github.com/repos/immars/caffe/commits{/sha}","git_commits_url":"https://api.github.com/repos/immars/caffe/git/commits{/sha}","comments_url":"https://api.github.com/repos/immars/caffe/comments{/number}","issue_comment_url":"https://api.github.com/repos/immars/caffe/issues/comments{/number}","contents_url":"https://api.github.com/repos/immars/caffe/contents/{+path}","compare_url":"https://api.github.com/repos/immars/caffe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/immars/caffe/merges","archive_url":"https://api.github.com/repos/immars/caffe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/immars/caffe/downloads","issues_url":"https://api.github.com/repos/immars/caffe/issues{/number}","pulls_url":"https://api.github.com/repos/immars/caffe/pulls{/number}","milestones_url":"https://api.github.com/repos/immars/caffe/milestones{/number}","notifications_url":"https://api.github.com/repos/immars/caffe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/immars/caffe/labels{/name}","releases_url":"https://api.github.com/repos/immars/caffe/releases{/id}","created_at":"2014-12-28T15:23:10Z","updated_at":"2015-03-21T12:56:06Z","pushed_at":"2015-03-26T05:08:45Z","git_url":"git://github.com/immars/caffe.git","ssh_url":"git@github.com:immars/caffe.git","clone_url":"https://github.com/immars/caffe.git","svn_url":"https://github.com/immars/caffe","homepage":"http://caffe.berkeleyvision.org/","size":33068,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"BVLC:master","ref":"master","sha":"de957e2457327b157d88c959704794d5500ef0a7","user":{"login":"BVLC","id":6182163,"avatar_url":"https://avatars.githubusercontent.com/u/6182163?v=3","gravatar_id":"","url":"https://api.github.com/users/BVLC","html_url":"https://github.com/BVLC","followers_url":"https://api.github.com/users/BVLC/followers","following_url":"https://api.github.com/users/BVLC/following{/other_user}","gists_url":"https://api.github.com/users/BVLC/gists{/gist_id}","starred_url":"https://api.github.com/users/BVLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BVLC/subscriptions","organizations_url":"https://api.github.com/users/BVLC/orgs","repos_url":"https://api.github.com/users/BVLC/repos","events_url":"https://api.github.com/users/BVLC/events{/privacy}","received_events_url":"https://api.github.com/users/BVLC/received_events","type":"Organization","site_admin":false},"repo":{"id":12791642,"name":"caffe","full_name":"BVLC/caffe","owner":{"login":"BVLC","id":6182163,"avatar_url":"https://avatars.githubusercontent.com/u/6182163?v=3","gravatar_id":"","url":"https://api.github.com/users/BVLC","html_url":"https://github.com/BVLC","followers_url":"https://api.github.com/users/BVLC/followers","following_url":"https://api.github.com/users/BVLC/following{/other_user}","gists_url":"https://api.github.com/users/BVLC/gists{/gist_id}","starred_url":"https://api.github.com/users/BVLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BVLC/subscriptions","organizations_url":"https://api.github.com/users/BVLC/orgs","repos_url":"https://api.github.com/users/BVLC/repos","events_url":"https://api.github.com/users/BVLC/events{/privacy}","received_events_url":"https://api.github.com/users/BVLC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BVLC/caffe","description":"Caffe: a fast open framework for deep learning.","fork":false,"url":"https://api.github.com/repos/BVLC/caffe","forks_url":"https://api.github.com/repos/BVLC/caffe/forks","keys_url":"https://api.github.com/repos/BVLC/caffe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BVLC/caffe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BVLC/caffe/teams","hooks_url":"https://api.github.com/repos/BVLC/caffe/hooks","issue_events_url":"https://api.github.com/repos/BVLC/caffe/issues/events{/number}","events_url":"https://api.github.com/repos/BVLC/caffe/events","assignees_url":"https://api.github.com/repos/BVLC/caffe/assignees{/user}","branches_url":"https://api.github.com/repos/BVLC/caffe/branches{/branch}","tags_url":"https://api.github.com/repos/BVLC/caffe/tags","blobs_url":"https://api.github.com/repos/BVLC/caffe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BVLC/caffe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BVLC/caffe/git/refs{/sha}","trees_url":"https://api.github.com/repos/BVLC/caffe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BVLC/caffe/statuses/{sha}","languages_url":"https://api.github.com/repos/BVLC/caffe/languages","stargazers_url":"https://api.github.com/repos/BVLC/caffe/stargazers","contributors_url":"https://api.github.com/repos/BVLC/caffe/contributors","subscribers_url":"https://api.github.com/repos/BVLC/caffe/subscribers","subscription_url":"https://api.github.com/repos/BVLC/caffe/subscription","commits_url":"https://api.github.com/repos/BVLC/caffe/commits{/sha}","git_commits_url":"https://api.github.com/repos/BVLC/caffe/git/commits{/sha}","comments_url":"https://api.github.com/repos/BVLC/caffe/comments{/number}","issue_comment_url":"https://api.github.com/repos/BVLC/caffe/issues/comments{/number}","contents_url":"https://api.github.com/repos/BVLC/caffe/contents/{+path}","compare_url":"https://api.github.com/repos/BVLC/caffe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BVLC/caffe/merges","archive_url":"https://api.github.com/repos/BVLC/caffe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BVLC/caffe/downloads","issues_url":"https://api.github.com/repos/BVLC/caffe/issues{/number}","pulls_url":"https://api.github.com/repos/BVLC/caffe/pulls{/number}","milestones_url":"https://api.github.com/repos/BVLC/caffe/milestones{/number}","notifications_url":"https://api.github.com/repos/BVLC/caffe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BVLC/caffe/labels{/name}","releases_url":"https://api.github.com/repos/BVLC/caffe/releases{/id}","created_at":"2013-09-12T18:39:48Z","updated_at":"2015-03-26T16:00:28Z","pushed_at":"2015-03-26T14:14:56Z","git_url":"git://github.com/BVLC/caffe.git","ssh_url":"git@github.com:BVLC/caffe.git","clone_url":"https://github.com/BVLC/caffe.git","svn_url":"https://github.com/BVLC/caffe","homepage":"http://caffe.berkeleyvision.org/","size":57086,"stargazers_count":2944,"watchers_count":2944,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1653,"mirror_url":null,"open_issues_count":311,"forks":1653,"open_issues":311,"watchers":2944,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/2193"},"html":{"href":"https://github.com/BVLC/caffe/pull/2193"},"issue":{"href":"https://api.github.com/repos/BVLC/caffe/issues/2193"},"comments":{"href":"https://api.github.com/repos/BVLC/caffe/issues/2193/comments"},"review_comments":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/2193/comments"},"review_comment":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BVLC/caffe/pulls/2193/commits"},"statuses":{"href":"https://api.github.com/repos/BVLC/caffe/statuses/bbbda4492cb3038e209560a056b51e73218b6200"}}}}