{"action":"created","comment":{"url":"https://api.github.com/repos/opesci/devito/pulls/comments/146842396","pull_request_review_id":71843875,"id":146842396,"diff_hunk":"@@ -149,8 +150,8 @@ def GradientOperator(model, source, receiver, time_order=2, space_order=4, **kwa\n \n     # Gradient symbol and wavefield symbols\n     grad = Function(name='grad', grid=model.grid)\n-    u = TimeFunction(name='u', grid=model.grid, save=True, time_dim=source.nt,\n-                     time_order=2, space_order=space_order)\n+    u = TimeFunction(name='u', grid=model.grid, save=save, time_dim=source.nt if save","path":"examples/seismic/acoustic/operators.py","position":16,"original_position":16,"commit_id":"9869a72f64e065af2c3ea2f9444f893edde0ed6e","original_commit_id":"9869a72f64e065af2c3ea2f9444f893edde0ed6e","user":{"login":"navjotk","id":679809,"avatar_url":"https://avatars0.githubusercontent.com/u/679809?v=4","gravatar_id":"","url":"https://api.github.com/users/navjotk","html_url":"https://github.com/navjotk","followers_url":"https://api.github.com/users/navjotk/followers","following_url":"https://api.github.com/users/navjotk/following{/other_user}","gists_url":"https://api.github.com/users/navjotk/gists{/gist_id}","starred_url":"https://api.github.com/users/navjotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navjotk/subscriptions","organizations_url":"https://api.github.com/users/navjotk/orgs","repos_url":"https://api.github.com/users/navjotk/repos","events_url":"https://api.github.com/users/navjotk/events{/privacy}","received_events_url":"https://api.github.com/users/navjotk/received_events","type":"User","site_admin":false},"body":"It wasn't possible to calculate the gradient without having `u(..., save=True...)` before. This ability is being brought in by this PR (or was brought in by the previous PR, depending on how you want to look at it).","created_at":"2017-10-25T12:40:21Z","updated_at":"2017-10-25T12:40:21Z","html_url":"https://github.com/opesci/devito/pull/386#discussion_r146842396","pull_request_url":"https://api.github.com/repos/opesci/devito/pulls/386","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/opesci/devito/pulls/comments/146842396"},"html":{"href":"https://github.com/opesci/devito/pull/386#discussion_r146842396"},"pull_request":{"href":"https://api.github.com/repos/opesci/devito/pulls/386"}},"in_reply_to_id":146834449},"pull_request":{"url":"https://api.github.com/repos/opesci/devito/pulls/386","id":148169238,"html_url":"https://github.com/opesci/devito/pull/386","diff_url":"https://github.com/opesci/devito/pull/386.diff","patch_url":"https://github.com/opesci/devito/pull/386.patch","issue_url":"https://api.github.com/repos/opesci/devito/issues/386","number":386,"state":"open","locked":false,"title":"Add example of checkpointing using pyrevolve","user":{"login":"navjotk","id":679809,"avatar_url":"https://avatars0.githubusercontent.com/u/679809?v=4","gravatar_id":"","url":"https://api.github.com/users/navjotk","html_url":"https://github.com/navjotk","followers_url":"https://api.github.com/users/navjotk/followers","following_url":"https://api.github.com/users/navjotk/following{/other_user}","gists_url":"https://api.github.com/users/navjotk/gists{/gist_id}","starred_url":"https://api.github.com/users/navjotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navjotk/subscriptions","organizations_url":"https://api.github.com/users/navjotk/orgs","repos_url":"https://api.github.com/users/navjotk/repos","events_url":"https://api.github.com/users/navjotk/events{/privacy}","received_events_url":"https://api.github.com/users/navjotk/received_events","type":"User","site_admin":false},"body":"PR 3/3. This is the last in the checkpointing series of PRs. Here we add an example of using pyrevolve in combination with devito to use checkpointing based on the revolve algorithm. \r\n\r\nIn more detail, this PR:\r\n- Updates the `gradient_example.py` to more recent API conventions and adds it to travis\r\n- Adds a new example called `checkpointing_example.py`, based on the above, which reproduces the same result while respecting a limit on the maximum memory consumption\r\n- Adds a `size` property to Devito types so they report their size in memory (this is the only change in the core of devito that this PR has)\r\n- Updates the `GradientOperator` to have a `save=False` mode\r\n- Adds 2 new tests that use and test the checkpointing infrastructure\r\n\r\nAlthough this might be the first time most of you are seeing the code for the checkpointing implementation, we have already discussed this to the point of knowing that this a suboptimal implementation. In particular:\r\n- The load and save procedures violate the zero-cost-checkpointing assumption of Revolve (this possibly requires a complete re-think of the checkpointing implementation and maybe even the pyRevolve API)\r\n- In the \"worst case\" where checkpointed steps are far away, we would store 2 timesteps (for a second-order-in-time formulation) per checkpoint. This implementation stores 3, i.e. an extra timestep per checkpoint. This can be fixed relatively easily. \r\n- In the \"best case\", where consecutive steps are being checkpointed, storing 2 timesteps per checkpoint (remember this implementation stores 3 timesteps/checkpoint) involves storing multiple copies of the same timestep, another wasteful side-effect of the current implementation. I'm currently in the process of resolving this but it's quite complex, requiring work on the theory as well as the implementation.\r\n- Of course, all this is still in memory and more work needs to go into pyRevolve to support multi-stage checkpointing. That is another parallel WIP. This, however, depends on the solution to 1. above. \r\n\r\nDespite the shortcomings, having an(y) implementation of checkpointing means that it is now possible to solve a new set of problems that we couldn't before. \r\n","created_at":"2017-10-23T15:48:11Z","updated_at":"2017-10-25T12:40:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d18f06a10d8ac08506738fe1218aab13a1329c1a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/opesci/devito/pulls/386/commits","review_comments_url":"https://api.github.com/repos/opesci/devito/pulls/386/comments","review_comment_url":"https://api.github.com/repos/opesci/devito/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opesci/devito/issues/386/comments","statuses_url":"https://api.github.com/repos/opesci/devito/statuses/9869a72f64e065af2c3ea2f9444f893edde0ed6e","head":{"label":"opesci:introduce_pyrevolve","ref":"introduce_pyrevolve","sha":"9869a72f64e065af2c3ea2f9444f893edde0ed6e","user":{"login":"opesci","id":10018551,"avatar_url":"https://avatars1.githubusercontent.com/u/10018551?v=4","gravatar_id":"","url":"https://api.github.com/users/opesci","html_url":"https://github.com/opesci","followers_url":"https://api.github.com/users/opesci/followers","following_url":"https://api.github.com/users/opesci/following{/other_user}","gists_url":"https://api.github.com/users/opesci/gists{/gist_id}","starred_url":"https://api.github.com/users/opesci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opesci/subscriptions","organizations_url":"https://api.github.com/users/opesci/orgs","repos_url":"https://api.github.com/users/opesci/repos","events_url":"https://api.github.com/users/opesci/events{/privacy}","received_events_url":"https://api.github.com/users/opesci/received_events","type":"Organization","site_admin":false},"repo":{"id":54585666,"name":"devito","full_name":"opesci/devito","owner":{"login":"opesci","id":10018551,"avatar_url":"https://avatars1.githubusercontent.com/u/10018551?v=4","gravatar_id":"","url":"https://api.github.com/users/opesci","html_url":"https://github.com/opesci","followers_url":"https://api.github.com/users/opesci/followers","following_url":"https://api.github.com/users/opesci/following{/other_user}","gists_url":"https://api.github.com/users/opesci/gists{/gist_id}","starred_url":"https://api.github.com/users/opesci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opesci/subscriptions","organizations_url":"https://api.github.com/users/opesci/orgs","repos_url":"https://api.github.com/users/opesci/repos","events_url":"https://api.github.com/users/opesci/events{/privacy}","received_events_url":"https://api.github.com/users/opesci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opesci/devito","description":"Code generation framework for automated finite difference computation","fork":false,"url":"https://api.github.com/repos/opesci/devito","forks_url":"https://api.github.com/repos/opesci/devito/forks","keys_url":"https://api.github.com/repos/opesci/devito/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opesci/devito/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opesci/devito/teams","hooks_url":"https://api.github.com/repos/opesci/devito/hooks","issue_events_url":"https://api.github.com/repos/opesci/devito/issues/events{/number}","events_url":"https://api.github.com/repos/opesci/devito/events","assignees_url":"https://api.github.com/repos/opesci/devito/assignees{/user}","branches_url":"https://api.github.com/repos/opesci/devito/branches{/branch}","tags_url":"https://api.github.com/repos/opesci/devito/tags","blobs_url":"https://api.github.com/repos/opesci/devito/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opesci/devito/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opesci/devito/git/refs{/sha}","trees_url":"https://api.github.com/repos/opesci/devito/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opesci/devito/statuses/{sha}","languages_url":"https://api.github.com/repos/opesci/devito/languages","stargazers_url":"https://api.github.com/repos/opesci/devito/stargazers","contributors_url":"https://api.github.com/repos/opesci/devito/contributors","subscribers_url":"https://api.github.com/repos/opesci/devito/subscribers","subscription_url":"https://api.github.com/repos/opesci/devito/subscription","commits_url":"https://api.github.com/repos/opesci/devito/commits{/sha}","git_commits_url":"https://api.github.com/repos/opesci/devito/git/commits{/sha}","comments_url":"https://api.github.com/repos/opesci/devito/comments{/number}","issue_comment_url":"https://api.github.com/repos/opesci/devito/issues/comments{/number}","contents_url":"https://api.github.com/repos/opesci/devito/contents/{+path}","compare_url":"https://api.github.com/repos/opesci/devito/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opesci/devito/merges","archive_url":"https://api.github.com/repos/opesci/devito/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opesci/devito/downloads","issues_url":"https://api.github.com/repos/opesci/devito/issues{/number}","pulls_url":"https://api.github.com/repos/opesci/devito/pulls{/number}","milestones_url":"https://api.github.com/repos/opesci/devito/milestones{/number}","notifications_url":"https://api.github.com/repos/opesci/devito/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opesci/devito/labels{/name}","releases_url":"https://api.github.com/repos/opesci/devito/releases{/id}","deployments_url":"https://api.github.com/repos/opesci/devito/deployments","created_at":"2016-03-23T18:59:49Z","updated_at":"2017-10-21T08:04:10Z","pushed_at":"2017-10-25T12:22:32Z","git_url":"git://github.com/opesci/devito.git","ssh_url":"git@github.com:opesci/devito.git","clone_url":"https://github.com/opesci/devito.git","svn_url":"https://github.com/opesci/devito","homepage":"http://www.opesci.org/devito-public","size":51262,"stargazers_count":30,"watchers_count":30,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":32,"forks":4,"open_issues":32,"watchers":30,"default_branch":"master"}},"base":{"label":"opesci:master","ref":"master","sha":"6e8a390df7f41f0441bb8a8ed254154004aba094","user":{"login":"opesci","id":10018551,"avatar_url":"https://avatars1.githubusercontent.com/u/10018551?v=4","gravatar_id":"","url":"https://api.github.com/users/opesci","html_url":"https://github.com/opesci","followers_url":"https://api.github.com/users/opesci/followers","following_url":"https://api.github.com/users/opesci/following{/other_user}","gists_url":"https://api.github.com/users/opesci/gists{/gist_id}","starred_url":"https://api.github.com/users/opesci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opesci/subscriptions","organizations_url":"https://api.github.com/users/opesci/orgs","repos_url":"https://api.github.com/users/opesci/repos","events_url":"https://api.github.com/users/opesci/events{/privacy}","received_events_url":"https://api.github.com/users/opesci/received_events","type":"Organization","site_admin":false},"repo":{"id":54585666,"name":"devito","full_name":"opesci/devito","owner":{"login":"opesci","id":10018551,"avatar_url":"https://avatars1.githubusercontent.com/u/10018551?v=4","gravatar_id":"","url":"https://api.github.com/users/opesci","html_url":"https://github.com/opesci","followers_url":"https://api.github.com/users/opesci/followers","following_url":"https://api.github.com/users/opesci/following{/other_user}","gists_url":"https://api.github.com/users/opesci/gists{/gist_id}","starred_url":"https://api.github.com/users/opesci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opesci/subscriptions","organizations_url":"https://api.github.com/users/opesci/orgs","repos_url":"https://api.github.com/users/opesci/repos","events_url":"https://api.github.com/users/opesci/events{/privacy}","received_events_url":"https://api.github.com/users/opesci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opesci/devito","description":"Code generation framework for automated finite difference computation","fork":false,"url":"https://api.github.com/repos/opesci/devito","forks_url":"https://api.github.com/repos/opesci/devito/forks","keys_url":"https://api.github.com/repos/opesci/devito/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opesci/devito/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opesci/devito/teams","hooks_url":"https://api.github.com/repos/opesci/devito/hooks","issue_events_url":"https://api.github.com/repos/opesci/devito/issues/events{/number}","events_url":"https://api.github.com/repos/opesci/devito/events","assignees_url":"https://api.github.com/repos/opesci/devito/assignees{/user}","branches_url":"https://api.github.com/repos/opesci/devito/branches{/branch}","tags_url":"https://api.github.com/repos/opesci/devito/tags","blobs_url":"https://api.github.com/repos/opesci/devito/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opesci/devito/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opesci/devito/git/refs{/sha}","trees_url":"https://api.github.com/repos/opesci/devito/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opesci/devito/statuses/{sha}","languages_url":"https://api.github.com/repos/opesci/devito/languages","stargazers_url":"https://api.github.com/repos/opesci/devito/stargazers","contributors_url":"https://api.github.com/repos/opesci/devito/contributors","subscribers_url":"https://api.github.com/repos/opesci/devito/subscribers","subscription_url":"https://api.github.com/repos/opesci/devito/subscription","commits_url":"https://api.github.com/repos/opesci/devito/commits{/sha}","git_commits_url":"https://api.github.com/repos/opesci/devito/git/commits{/sha}","comments_url":"https://api.github.com/repos/opesci/devito/comments{/number}","issue_comment_url":"https://api.github.com/repos/opesci/devito/issues/comments{/number}","contents_url":"https://api.github.com/repos/opesci/devito/contents/{+path}","compare_url":"https://api.github.com/repos/opesci/devito/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opesci/devito/merges","archive_url":"https://api.github.com/repos/opesci/devito/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opesci/devito/downloads","issues_url":"https://api.github.com/repos/opesci/devito/issues{/number}","pulls_url":"https://api.github.com/repos/opesci/devito/pulls{/number}","milestones_url":"https://api.github.com/repos/opesci/devito/milestones{/number}","notifications_url":"https://api.github.com/repos/opesci/devito/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opesci/devito/labels{/name}","releases_url":"https://api.github.com/repos/opesci/devito/releases{/id}","deployments_url":"https://api.github.com/repos/opesci/devito/deployments","created_at":"2016-03-23T18:59:49Z","updated_at":"2017-10-21T08:04:10Z","pushed_at":"2017-10-25T12:22:32Z","git_url":"git://github.com/opesci/devito.git","ssh_url":"git@github.com:opesci/devito.git","clone_url":"https://github.com/opesci/devito.git","svn_url":"https://github.com/opesci/devito","homepage":"http://www.opesci.org/devito-public","size":51262,"stargazers_count":30,"watchers_count":30,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":32,"forks":4,"open_issues":32,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opesci/devito/pulls/386"},"html":{"href":"https://github.com/opesci/devito/pull/386"},"issue":{"href":"https://api.github.com/repos/opesci/devito/issues/386"},"comments":{"href":"https://api.github.com/repos/opesci/devito/issues/386/comments"},"review_comments":{"href":"https://api.github.com/repos/opesci/devito/pulls/386/comments"},"review_comment":{"href":"https://api.github.com/repos/opesci/devito/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opesci/devito/pulls/386/commits"},"statuses":{"href":"https://api.github.com/repos/opesci/devito/statuses/9869a72f64e065af2c3ea2f9444f893edde0ed6e"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"navjotk"}}