I have trouble creating a check-point i.e. to restart a program from where it was if it is suddenly killed.
I output from the program in a file called "xyz.out", which has x y z (real dp) values. At the end of each output "data block" (5 xyz lines), I have a check variable which is 65e10 65e10 1000 (say) where 65e10 is a large number and 1000 is the current iteration index.
I output a file called "run.out" which has a namelist with iteration number and other details to restart the program each time I output a "data block" in xyz.out. I compare this iteration number (in run.out) with the one in the xyz.out file. If they are the same I can start my program.
To Illustrate,
xyz.out has,
.
.
.
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
650000000000 65000000000 15.000000000
and run.out has
Iteration=15.000000
Now the problem is when I suddenly kill my program, it is usually in the middle of writing either run.out or xyz.out. Also, iteration number in run.out is far ahead of xyz.out, even though xyz.out is output first in the program sequence. I need both the iteration numbers to match up to restart my program successfully.
i.e. what happens is
xyz.out has,
.
.
650000000000 65000000000 14.000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
and run.out has
Iteration=15.000000
I can backspace upto 14.00000000 and start the program from there, but, the file run.out has "Iteration=15.00000", which creates a conflict.
I tried using flush, but to no avail. It would be of great help to me if there is any simple solution to problem.
I use GFORTRAN compiler and I have coded in F90.
I output from the program in a file called "xyz.out", which has x y z (real dp) values. At the end of each output "data block" (5 xyz lines), I have a check variable which is 65e10 65e10 1000 (say) where 65e10 is a large number and 1000 is the current iteration index.
I output a file called "run.out" which has a namelist with iteration number and other details to restart the program each time I output a "data block" in xyz.out. I compare this iteration number (in run.out) with the one in the xyz.out file. If they are the same I can start my program.
To Illustrate,
xyz.out has,
.
.
.
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
650000000000 65000000000 15.000000000
and run.out has
Iteration=15.000000
Now the problem is when I suddenly kill my program, it is usually in the middle of writing either run.out or xyz.out. Also, iteration number in run.out is far ahead of xyz.out, even though xyz.out is output first in the program sequence. I need both the iteration numbers to match up to restart my program successfully.
i.e. what happens is
xyz.out has,
.
.
650000000000 65000000000 14.000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
1.0000000000 2.000000000 3.0000000000
and run.out has
Iteration=15.000000
I can backspace upto 14.00000000 and start the program from there, but, the file run.out has "Iteration=15.00000", which creates a conflict.
I tried using flush, but to no avail. It would be of great help to me if there is any simple solution to problem.
I use GFORTRAN compiler and I have coded in F90.