Write resume command even when computation concludes

This commit is contained in:
Ian Jauslin 2023-04-26 17:20:38 -04:00
parent a94c066014
commit 4436866d2f

View File

@ -159,13 +159,16 @@ int eea(
if (savefile==NULL){ if (savefile==NULL){
savefile=stderr; savefile=stderr;
} }
break;
}
}
if(savefile!=NULL){
fprintf(savefile,"# Continue computation with\n");
fprintf(savefile,"# Interrupted computation. Resume with\n");
// command to resume // command to resume
fprintf(savefile,"#! "); fprintf(savefile,"#! ");
fprintf(savefile, cmd_string); fprintf(savefile, cmd_string);
// params // params
// allocate buffer for params // allocate buffer for params
if(params_string!=NULL) { if(params_string!=NULL) {
@ -174,22 +177,18 @@ int eea(
remove_entry(params, "starting_time"); remove_entry(params, "starting_time");
remove_entry(params, "init"); remove_entry(params, "init");
remove_entry(params, "nsteps"); remove_entry(params, "nsteps");
fprintf(savefile," -p \"%s;starting_time=%lu;nsteps=%lu;init=file:%s\"", params, t+1, (nsteps == 0 ? 0 : nsteps-t-1), savefile_string); fprintf(savefile," -p \"%s;starting_time=%lu;nsteps=%lu;init=file:%s\"", params, t+1, (nsteps < t+1 ? 0 : nsteps-t-1), savefile_string);
free(params); free(params);
} }
fprintf(savefile," energy\n"); fprintf(savefile," energy\n");
break; // save final u to savefile
}
}
// save final entry to savefile
if(savefile==stderr || savefile==stdout){ if(savefile==stderr || savefile==stdout){
write_vec(u, K1, K2, savefile); write_vec(u, K1, K2, savefile);
} else { } else {
write_vec_bin(u, K1, K2, savefile); write_vec_bin(u, K1, K2, savefile);
} }
}
ns_free_tmps(u, tmp1, tmp2, tmp3, fft1, fft2, ifft); ns_free_tmps(u, tmp1, tmp2, tmp3, fft1, fft2, ifft);
return(0); return(0);