Commit 2617c594 authored by Victor Yu's avatar Victor Yu
Browse files

Add an option to control Wstat restart output

Restart info was written out in every Davidson iteration. Now this can
be changed by setting the `n_steps_write_restart` keyword. Default is 1,
i.e. same behavior as before.
parent 1e98e7f1
...@@ -159,6 +159,23 @@ wstat_control ...@@ -159,6 +159,23 @@ wstat_control
- Number of PDEP eigenpotentials that can be read from file. - Number of PDEP eigenpotentials that can be read from file.
.. data:: n_steps_write_restart
.. list-table::
:widths: 10 90
:stub-columns: 0
* - **Type**
- int
* - **Default**
- 1
* - **Description**
- Available options are:
- If ( n_steps_write_restart > 0 ) A checkpoint is written every n_steps_write_restart iterations in the PDEP loop.
- If ( n_steps_write_restart <= 0 ) A checkpoint is NEVER written in the PDEP loop. Restart will not be possible.
.. data:: trev_pdep .. data:: trev_pdep
.. list-table:: .. list-table::
......
...@@ -36,6 +36,7 @@ default["wstat_control"]["n_pdep_times"] = 4 ...@@ -36,6 +36,7 @@ default["wstat_control"]["n_pdep_times"] = 4
default["wstat_control"]["n_pdep_maxiter"] = 100 default["wstat_control"]["n_pdep_maxiter"] = 100
default["wstat_control"]["n_dfpt_maxiter"] = 250 default["wstat_control"]["n_dfpt_maxiter"] = 250
default["wstat_control"]["n_pdep_read_from_file"] = 0 default["wstat_control"]["n_pdep_read_from_file"] = 0
default["wstat_control"]["n_steps_write_restart"] = 1
default["wstat_control"]["trev_pdep"] = 1.e-3 default["wstat_control"]["trev_pdep"] = 1.e-3
default["wstat_control"]["trev_pdep_rel"] = 1.e-1 default["wstat_control"]["trev_pdep_rel"] = 1.e-1
default["wstat_control"]["tr2_dfpt"] = 1.e-12 default["wstat_control"]["tr2_dfpt"] = 1.e-12
......
...@@ -50,6 +50,7 @@ SUBROUTINE add_intput_parameters_to_json_file( num_drivers, driver, json ) ...@@ -50,6 +50,7 @@ SUBROUTINE add_intput_parameters_to_json_file( num_drivers, driver, json )
CALL json%add('input.wstat_control.n_pdep_maxiter',n_pdep_maxiter) CALL json%add('input.wstat_control.n_pdep_maxiter',n_pdep_maxiter)
CALL json%add('input.wstat_control.n_dfpt_maxiter',n_dfpt_maxiter) CALL json%add('input.wstat_control.n_dfpt_maxiter',n_dfpt_maxiter)
CALL json%add('input.wstat_control.n_pdep_read_from_file',n_pdep_read_from_file) CALL json%add('input.wstat_control.n_pdep_read_from_file',n_pdep_read_from_file)
CALL json%add('input.wstat_control.n_steps_write_restart',n_steps_write_restart)
CALL json%add('input.wstat_control.trev_pdep',trev_pdep) CALL json%add('input.wstat_control.trev_pdep',trev_pdep)
CALL json%add('input.wstat_control.trev_pdep_rel',trev_pdep_rel) CALL json%add('input.wstat_control.trev_pdep_rel',trev_pdep_rel)
CALL json%add('input.wstat_control.tr2_dfpt',tr2_dfpt) CALL json%add('input.wstat_control.tr2_dfpt',tr2_dfpt)
...@@ -213,6 +214,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug ) ...@@ -213,6 +214,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
IERR = return_dict%get(n_pdep_maxiter, "n_pdep_maxiter", DUMMY_DEFAULT) IERR = return_dict%get(n_pdep_maxiter, "n_pdep_maxiter", DUMMY_DEFAULT)
IERR = return_dict%get(n_dfpt_maxiter, "n_dfpt_maxiter", DUMMY_DEFAULT) IERR = return_dict%get(n_dfpt_maxiter, "n_dfpt_maxiter", DUMMY_DEFAULT)
IERR = return_dict%get(n_pdep_read_from_file, "n_pdep_read_from_file", DUMMY_DEFAULT) IERR = return_dict%get(n_pdep_read_from_file, "n_pdep_read_from_file", DUMMY_DEFAULT)
IERR = return_dict%get(n_steps_write_restart, "n_steps_write_restart", DUMMY_DEFAULT)
IERR = return_dict%getitem(trev_pdep, "trev_pdep") IERR = return_dict%getitem(trev_pdep, "trev_pdep")
IERR = return_dict%getitem(trev_pdep_rel, "trev_pdep_rel") IERR = return_dict%getitem(trev_pdep_rel, "trev_pdep_rel")
IERR = return_dict%getitem(tr2_dfpt, "tr2_dfpt") IERR = return_dict%getitem(tr2_dfpt, "tr2_dfpt")
...@@ -368,6 +370,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug ) ...@@ -368,6 +370,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
CALL mp_bcast(n_pdep_maxiter,root,world_comm) CALL mp_bcast(n_pdep_maxiter,root,world_comm)
CALL mp_bcast(n_dfpt_maxiter,root,world_comm) CALL mp_bcast(n_dfpt_maxiter,root,world_comm)
CALL mp_bcast(n_pdep_read_from_file,root,world_comm) CALL mp_bcast(n_pdep_read_from_file,root,world_comm)
CALL mp_bcast(n_steps_write_restart,root,world_comm)
CALL mp_bcast(trev_pdep,root,world_comm) CALL mp_bcast(trev_pdep,root,world_comm)
CALL mp_bcast(trev_pdep_rel,root,world_comm) CALL mp_bcast(trev_pdep_rel,root,world_comm)
CALL mp_bcast(tr2_dfpt,root,world_comm) CALL mp_bcast(tr2_dfpt,root,world_comm)
...@@ -399,6 +402,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug ) ...@@ -399,6 +402,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
IF( n_pdep_maxiter == DUMMY_DEFAULT ) CALL errore('fetch_input','Err: cannot read n_pdep_maxiter') IF( n_pdep_maxiter == DUMMY_DEFAULT ) CALL errore('fetch_input','Err: cannot read n_pdep_maxiter')
IF( n_dfpt_maxiter == DUMMY_DEFAULT ) CALL errore('fetch_input','Err: cannot read n_dfpt_maxiter') IF( n_dfpt_maxiter == DUMMY_DEFAULT ) CALL errore('fetch_input','Err: cannot read n_dfpt_maxiter')
IF( n_pdep_read_from_file == DUMMY_DEFAULT ) CALL errore('fetch_input','Err: cannot read n_pdep_read_from_file') IF( n_pdep_read_from_file == DUMMY_DEFAULT ) CALL errore('fetch_input','Err: cannot read n_pdep_read_from_file')
IF( n_steps_write_restart == DUMMY_DEFAULT ) CALL errore('fetch_input','Err: cannot read n_steps_write_restart')
IF(gamma_only) THEN IF(gamma_only) THEN
IF (SIZE(qlist)/=1) CALL errore('fetch_input','Err: SIZE(qlist)/=1.',1) IF (SIZE(qlist)/=1) CALL errore('fetch_input','Err: SIZE(qlist)/=1.',1)
ELSE ELSE
...@@ -520,13 +524,14 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug ) ...@@ -520,13 +524,14 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
! !
CALL io_push_title('I/O Summary : wstat_control') CALL io_push_title('I/O Summary : wstat_control')
! !
numsp=30 numsp = 30
CALL io_push_value('wstat_calculation',wstat_calculation,numsp) CALL io_push_value('wstat_calculation',wstat_calculation,numsp)
CALL io_push_value('n_pdep_eigen',n_pdep_eigen,numsp) CALL io_push_value('n_pdep_eigen',n_pdep_eigen,numsp)
CALL io_push_value('n_pdep_times',n_pdep_times,numsp) CALL io_push_value('n_pdep_times',n_pdep_times,numsp)
CALL io_push_value('n_pdep_maxiter',n_pdep_maxiter,numsp) CALL io_push_value('n_pdep_maxiter',n_pdep_maxiter,numsp)
CALL io_push_value('n_dfpt_maxiter',n_dfpt_maxiter,numsp) CALL io_push_value('n_dfpt_maxiter',n_dfpt_maxiter,numsp)
CALL io_push_value('n_pdep_read_from_file',n_pdep_read_from_file,numsp) CALL io_push_value('n_pdep_read_from_file',n_pdep_read_from_file,numsp)
CALL io_push_value('n_steps_write_restart',n_steps_write_restart,numsp)
CALL io_push_es0('trev_pdep',trev_pdep,numsp) CALL io_push_es0('trev_pdep',trev_pdep,numsp)
CALL io_push_es0('trev_pdep_rel',trev_pdep_rel,numsp) CALL io_push_es0('trev_pdep_rel',trev_pdep_rel,numsp)
CALL io_push_es0('tr2_dfpt',tr2_dfpt,numsp) CALL io_push_es0('tr2_dfpt',tr2_dfpt,numsp)
...@@ -547,7 +552,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug ) ...@@ -547,7 +552,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
! !
CALL io_push_title('I/O Summary : wfreq_control') CALL io_push_title('I/O Summary : wfreq_control')
! !
numsp=40 numsp = 40
CALL io_push_value('wfreq_calculation',wfreq_calculation,numsp) CALL io_push_value('wfreq_calculation',wfreq_calculation,numsp)
CALL io_push_value('n_pdep_eigen_to_use',n_pdep_eigen_to_use,numsp) CALL io_push_value('n_pdep_eigen_to_use',n_pdep_eigen_to_use,numsp)
CALL io_push_value('qp_bandrange(1)',qp_bandrange(1),numsp) CALL io_push_value('qp_bandrange(1)',qp_bandrange(1),numsp)
...@@ -578,7 +583,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug ) ...@@ -578,7 +583,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
! !
CALL io_push_title('I/O Summary : westpp_control') CALL io_push_title('I/O Summary : westpp_control')
! !
numsp=40 numsp = 40
CALL io_push_value('westpp_calculation',westpp_calculation,numsp) CALL io_push_value('westpp_calculation',westpp_calculation,numsp)
CALL io_push_value('westpp_range(1)',westpp_range(1),numsp) CALL io_push_value('westpp_range(1)',westpp_range(1),numsp)
CALL io_push_value('westpp_range(2)',westpp_range(2),numsp) CALL io_push_value('westpp_range(2)',westpp_range(2),numsp)
...@@ -602,7 +607,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug ) ...@@ -602,7 +607,7 @@ SUBROUTINE fetch_input_yml( num_drivers, driver, verbose, debug )
! !
CALL io_push_title('I/O Summary : server_control') CALL io_push_title('I/O Summary : server_control')
! !
numsp=40 numsp = 40
CALL io_push_value('document',document,numsp) CALL io_push_value('document',document,numsp)
! !
CALL io_push_bar() CALL io_push_bar()
......
...@@ -194,7 +194,7 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -194,7 +194,7 @@ SUBROUTINE davidson_diago_gamma ( )
pccg_res_tr2 = -1._DP pccg_res_tr2 = -1._DP
CALL apply_operator ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2, 1 ) CALL apply_operator ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2, 1 )
dav_iter = -1 dav_iter = -1
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) IF(n_steps_write_restart == 1) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr )
! !
ENDIF ENDIF
! !
...@@ -246,7 +246,7 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -246,7 +246,7 @@ SUBROUTINE davidson_diago_gamma ( )
! !
CALL output_ev_and_time(nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv) CALL output_ev_and_time(nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv)
dav_iter = 0 dav_iter = 0
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) IF(n_steps_write_restart == 1) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr )
! !
ENDIF ENDIF
! !
...@@ -421,7 +421,8 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -421,7 +421,8 @@ SUBROUTINE davidson_diago_gamma ( )
! !
END IF END IF
! !
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) IF(n_steps_write_restart > 0 .AND. MOD(dav_iter,n_steps_write_restart) == 0) &
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr )
!CALL output_a_report(dav_iter) !CALL output_a_report(dav_iter)
! !
END DO iterate END DO iterate
...@@ -664,7 +665,7 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -664,7 +665,7 @@ SUBROUTINE davidson_diago_k ( )
! !
CALL apply_operator ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2, iq ) CALL apply_operator ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2, iq )
dav_iter = -1 dav_iter = -1
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, iq) IF(n_steps_write_restart == 1) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, iq )
! !
ENDIF ENDIF
! !
...@@ -717,7 +718,7 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -717,7 +718,7 @@ SUBROUTINE davidson_diago_k ( )
! !
CALL output_ev_and_time_q( nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv,iq ) CALL output_ev_and_time_q( nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv,iq )
dav_iter = 0 dav_iter = 0
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, iq ) IF(n_steps_write_restart == 1) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, iq )
! !
ENDIF ENDIF
! !
...@@ -893,8 +894,9 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -893,8 +894,9 @@ SUBROUTINE davidson_diago_k ( )
! !
END IF END IF
! !
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, iq) IF(n_steps_write_restart > 0 .AND. MOD(dav_iter,n_steps_write_restart) == 0) &
!!CALL output_a_report(dav_iter) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr, iq )
!CALL output_a_report(dav_iter)
! !
END DO iterate END DO iterate
! !
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment