-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Checkpointing" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
uuid = "eb46d486-4f9c-4c3d-b445-a617f2a2f1ca" | ||
authors = ["Michel Schanen <[email protected]>", "Sri Hari Krishna Narayanan <[email protected]>"] | ||
version = "0.9.6" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
version = "0.9.7" | ||
|
||
[deps] | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
struct ChkpDump | ||
steps::Int64 | ||
period::Int64 | ||
filename::String | ||
end | ||
|
||
ChkpDump(steps, ::Val{false}, period = 1, filename = "chkp") = nothing | ||
|
||
function ChkpDump(steps, ::Val{true}, period = 1, filename = "chkp") | ||
return ChkpDump(steps, period, filename) | ||
end | ||
|
||
dump_prim(::Nothing, _, _) = nothing | ||
|
||
function dump_prim(chkp::ChkpDump, step, primal) | ||
if (step - 1) % chkp.period == 0 | ||
blob = serialize(primal) | ||
open("prim_$(chkp.filename)_$step.chkp", "w") do file | ||
write(file, blob) | ||
end | ||
end | ||
end | ||
|
||
dump_adj(::Nothing, _, _) = nothing | ||
|
||
function dump_adj(chkp::ChkpDump, step, adjoint) | ||
@show step | ||
@show chkp.period | ||
@show step % chkp.period | ||
if (step - 1) % chkp.period == 0 | ||
blob = serialize(adjoint) | ||
open("adj_$(chkp.filename)_$step.chkp", "w") do file | ||
write(file, blob) | ||
end | ||
end | ||
end | ||
|
||
read_chkp_file(filename) = deserialize(read(filename)) |
2 comments
on commit df996d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/120163
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
@JuliaRegistrator register
Release notes:
## Breaking changes
- blah
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:
git tag -a v0.9.7 -m "<description of version>" df996d0526d5f52cda6c9a58de91469269391d15
git push origin v0.9.7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request updated: JuliaRegistries/General/120163
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
@JuliaRegistrator register
Release notes:
## Breaking changes
- blah
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:
git tag -a v0.9.7 -m "<description of version>" df996d0526d5f52cda6c9a58de91469269391d15
git push origin v0.9.7
@JuliaRegistrator register