Skip to content

Multistage implementation is incorrect #66

Open
@jrmaddison

Description

@jrmaddison

In initialization of multistage checkpointing

pyrevolve/src/revolve.cpp

Lines 1170 to 1185 in 23dea91

v = get_write_and_read_counts();
sort(v.begin(),v.end());
mid=v[snaps-sn_ram];
// cout << mid << endl;
for(int i=snaps-1;i>=0;i--)
{
if(v[i]>=mid && num<sn_ram)
{
where[i]=true;
num++;
}
else
{
where[i]=false;
}
}

since v is sorted this always sets the last sn_ram elements of where to true, and the other elements to false, irrespective of the result of get_write_and_read_counts.

I think v should be copied before the sort (e.g. into w), and then the conditional replaced with

if(w[i]>=mid && num<sn_ram)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions