diff --git a/scripts/follow_output.py b/scripts/follow_output.py index 0eb2d269..cc3f8ca4 100755 --- a/scripts/follow_output.py +++ b/scripts/follow_output.py @@ -11,6 +11,8 @@ class OutputFollower(object): def __init__(self,filename): self.filename = filename self.dir = filename+'/output/' + while not os.path.exists(self.dir): + time.sleep(.1) self.last_time = {} self.last_line = {} self.data = {} @@ -42,7 +44,7 @@ class OutputFollower(object): def start(self): self.running = True while self.running: - time.sleep(1.) + time.sleep(.1) self.update_file_list() diff --git a/scripts/qpackage b/scripts/qpackage index d6306b6a..67304f27 100755 --- a/scripts/qpackage +++ b/scripts/qpackage @@ -88,12 +88,32 @@ function run() # run $EXE $EZFIO # Starts the executable in one process and # displays the output files in stdout + if [[ -z $1 ]] ; then + echo "Please specify which executable to run" + print_list + exit 1 + fi EXE=${EXECUTABLES[$1]} EZFIO=$2 + if [[ -z $EXE ]] ; then + echo "Executable $1 not found" + exit 1 + fi + if [[ -z $EZFIO ]] ; then + echo "Please specify an EZFIO directory" + exit 1 + fi date + rm -rf -- ${EZFIO}/output ${QPACKAGE_ROOT}/scripts/follow_output.py ${EZFIO} & + PID=$! ${EXE} ${EZFIO} - kill -2 %1 + kill -2 $PID + if [[ $(jobs | wc -l) -gt 0 ]] + then + sleep 1 + kill -9 $PID + fi wait date } @@ -101,8 +121,13 @@ function run() function reset() { # reset $EZFIO - rm -rf $1/output/*.rst - rm -rf $1/determinants/{n_det,psi_det.gz,psi_coef.gz} + EZFIO=$1 + if [[ -z ${EZFIO} ]] ; then + echo "Please specify an EZFIO directory" + exit 1 + fi + rm -rf -- ${EZFIO}/output/*.rst + rm -rf -- ${EZFIO}/determinants/{n_det,psi_det.gz,psi_coef.gz} } COMMAND=$1 diff --git a/src/Dets/H_apply_template.f b/src/Dets/H_apply_template.f index 07c45891..df47daa6 100644 --- a/src/Dets/H_apply_template.f +++ b/src/Dets/H_apply_template.f @@ -371,7 +371,7 @@ subroutine $subroutine($params_main) $decls_main integer :: i_generator, nmax - double precision :: wall_0, wall_1, wall_2 + double precision :: wall_0, wall_1 integer(omp_lock_kind) :: lck integer(bit_kind), allocatable :: mask(:,:,:) integer :: ispin, k @@ -383,8 +383,6 @@ subroutine $subroutine($params_main) PROVIDE mo_mono_elec_integral ref_bitmask_energy nmax = ( N_det_generators/nproc ) *nproc - call wall_time(wall_0) - call wall_time(wall_1) PROVIDE progress_bar @@ -392,7 +390,8 @@ subroutine $subroutine($params_main) !$ call omp_init_lock(lck) !$OMP PARALLEL DEFAULT(SHARED) & - !$OMP PRIVATE(i_generator,wall_2,ispin,k,mask,iproc) + !$OMP PRIVATE(i_generator,wall_1,wall_0,ispin,k,mask,iproc) + call wall_time(wall_0) iproc = 0 !$ iproc = omp_get_thread_num() allocate( mask(N_int,2,6) ) @@ -442,11 +441,11 @@ subroutine $subroutine($params_main) i_generator, iproc $params_post) endif !$ call omp_set_lock(lck) - call wall_time(wall_2) + call wall_time(wall_1) $printout_always - if (wall_2 - wall_0 > 2.d0) then - wall_0 = wall_2 + if (wall_1 - wall_0 > 2.d0) then $printout_now + wall_0 = wall_1 endif !$ call omp_unset_lock(lck) enddo @@ -454,6 +453,7 @@ subroutine $subroutine($params_main) deallocate( mask ) !$OMP END PARALLEL !$ call omp_destroy_lock(lck) + call wall_time(wall_0) allocate( mask(N_int,2,6) ) @@ -501,11 +501,11 @@ subroutine $subroutine($params_main) mask(1,1,s_hole ), mask(1,1,s_part ), & i_generator, 0 $params_post) endif - call wall_time(wall_2) + call wall_time(wall_1) $printout_always - if (wall_2 - wall_0 > 2.d0) then - wall_0 = wall_2 + if (wall_1 - wall_0 > 2.d0) then $printout_now + wall_0 = wall_1 endif enddo call stop_progress