Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding util::checkpoint #2917

Merged
merged 27 commits into from Oct 5, 2017
Merged

Adding util::checkpoint #2917

merged 27 commits into from Oct 5, 2017

Conversation

aserio
Copy link
Contributor

@aserio aserio commented Sep 28, 2017

This pull request creates a new utility "checkpoint" which simplifies application checkpointing.

 - Adding an operator== overload to checkpoint
 - suppressing an unused error warning
 - Changing checkpoint test to support docs
 - Update example to use std::copy and  iterators to write to a file
        - Adding operator!=
        - Make data a private member
        - Work to remove .load()
                - Replace with a contrutor that takes a char*
        - Change empty constructors to = default
        - Adding friend classes to handle data's new private status
 - Cleaning up code
 - Fixing test/unit/util/checkpoint.cpp
 - Adding documentation for stream operators and access iterators
Updating add_checkpoint branch
@aserio aserio added this to the 1.1.0 milestone Sep 28, 2017
int const sequencer[] = {//Trick to expand the variable pack
(ar << ts,
0)...}; //Takes advantage of the comma operator
(void) sequencer; // Suppress unused param. warnings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For MSVC you'll have to write this as:

int const sequencer[] = {
    0, (ar << ts, 0)...
};

this avoids generating a possibly zero-sized array this compiler is complaining about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix!

checkpoint>::value>::type>
hpx::future<checkpoint> save_checkpoint(T&& t, Ts&&... ts)
{
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale for introducing the extra scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover code. Should I remove all of these extra scopes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed per discussion

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, LGTM, thanks! Please address the minor comments before merging.

{
data.push_back(*stream);
stream++;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should resize the vector and then memcpy the data into it here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree - the signatures of these should be:

checkpoint(std::vector<char> const& stream);
checkpoint(std::vector<char> && stream);

or if you really must,

template <typename InIter>
checkpoint(InIter begin, InIter end);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hkaiser and I are discussing options to remove/replace this construction entirely as exposing pointers in the interface is a weak design.

hpx::future<checkpoint> save_checkpoint(T&& t, Ts&&... ts)
{
{
return hpx::dataflow(detail::save_funct_obj(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use the io service pool here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use the io service pool here?

@sithhell what for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@biddisco
Copy link
Contributor

biddisco commented Oct 1, 2017

There are quite a lot of commits that only fix inspect errors / formatting / whitespace etc.
It would be nice if some of these could be squashed/merged into others.

aserio and others added 4 commits October 2, 2017 15:16
 - Fix for MSVC "zero-sized array" issue
 - Removing unnecessary scopes
 - Removing constructor with char* and replacing it with a constructor
   which takes a std::vector<char>
@aserio aserio merged commit 954818a into master Oct 5, 2017
@aserio aserio deleted the add_checkpoint branch October 5, 2017 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants