Skip to content
Snippets Groups Projects
Commit 2b0dfb5f authored by Christopher Baker's avatar Christopher Baker
Browse files

added rollback so indecies of summa_struct can be rewriten when partition is full (not 100% stable)

parent cb5ac757
No related branches found
No related tags found
1 merge request!8reimplmented checkpoining based on work from the main-chris branch. restart...
...@@ -178,7 +178,7 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, ...@@ -178,7 +178,7 @@ behavior file_access_actor(stateful_actor<file_access_state>* self,
self->state.file_access_timing.updateEndPoint("write_duration"); self->state.file_access_timing.updateEndPoint("write_duration");
}, },
[=] (write_restart, int gru, int gru_timestep, int gru_checkpoint, int year, int month, int day, int hour){ [=] (write_restart, int gru, int gru_timestep, int gru_checkpoint, int output_stucture_index, int year, int month, int day, int hour){
// update hru progress vecs // update hru progress vecs
int gru_index = abs(self->state.start_gru - gru); int gru_index = abs(self->state.start_gru - gru);
self->state.hru_timesteps[gru_index] = gru_timestep; self->state.hru_timesteps[gru_index] = gru_timestep;
...@@ -191,7 +191,7 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, ...@@ -191,7 +191,7 @@ behavior file_access_actor(stateful_actor<file_access_state>* self,
// if the slowest hru is past the ith checkpoint (current threshold) // if the slowest hru is past the ith checkpoint (current threshold)
if ( slowest_checkpoint >= (self->state.completed_checkpoints)){// temp for dubuging if ( slowest_checkpoint >= (self->state.completed_checkpoints)){// temp for dubuging
Output_Partition *output_partition = self->state.output_container->getOutputPartition(gru-1); Output_Partition *output_partition = self->state.output_container->getOutputPartition(gru-1);
writeRestart(self, output_partition, self->state.start_gru, self->state.hru_timesteps.size(), gru_checkpoint, writeRestart(self, output_partition, self->state.start_gru, self->state.hru_timesteps.size(), output_stucture_index,
year, month, day, hour); year, month, day, hour);
// update checkpint counter // update checkpint counter
self->state.completed_checkpoints++; self->state.completed_checkpoints++;
......
...@@ -442,9 +442,10 @@ int Run_HRU(stateful_actor<hru_state>* self) { ...@@ -442,9 +442,10 @@ int Run_HRU(stateful_actor<hru_state>* self) {
// send an update to the FAA // send an update to the FAA
if (isCheckpoint(self)){ if (isCheckpoint(self)){
self->state.checkpoint++; self->state.checkpoint++;
hru_writeRestart(&self->state.indxHRU, hru_writeRestart(&self->state.indxHRU,
&self->state.indxGRU, &self->state.indxGRU,
&self->state.checkpoint, &self->state.output_structure_step_index,
&self->state.output_structure_step_index, //unused &self->state.output_structure_step_index, //unused
self->state.hru_data, self->state.hru_data,
&self->state.err); &self->state.err);
...@@ -454,6 +455,7 @@ int Run_HRU(stateful_actor<hru_state>* self) { ...@@ -454,6 +455,7 @@ int Run_HRU(stateful_actor<hru_state>* self) {
self->state.refGRU, self->state.refGRU,
self->state.timestep, self->state.timestep,
self->state.checkpoint, self->state.checkpoint,
self->state.output_structure_step_index,
self->state.currentDate.y, self->state.currentDate.y,
self->state.currentDate.m, self->state.currentDate.m,
self->state.currentDate.d, self->state.currentDate.d,
...@@ -471,8 +473,8 @@ bool isCheckpoint(stateful_actor<hru_state>* self){ ...@@ -471,8 +473,8 @@ bool isCheckpoint(stateful_actor<hru_state>* self){
switch(self->state.restartFrequency){ switch(self->state.restartFrequency){
case 0: // restart not enabled case 0: // restart not enabled
break; break;
case 1: // hourly, not supported, would need to extract minute info from hru_data case 1: // every timestep
break; return true;
case 2: // daily case 2: // daily
if (self->state.startDate.h == self->state.currentDate.h){ if (self->state.startDate.h == self->state.currentDate.h){
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment