10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-22 18:57:31 +02:00

Improved qpackage command

This commit is contained in:
Anthony Scemama 2014-10-08 22:56:35 +02:00
parent 692eba018d
commit 0ee2a47d2e
3 changed files with 41 additions and 14 deletions

View File

@ -11,6 +11,8 @@ class OutputFollower(object):
def __init__(self,filename): def __init__(self,filename):
self.filename = filename self.filename = filename
self.dir = filename+'/output/' self.dir = filename+'/output/'
while not os.path.exists(self.dir):
time.sleep(.1)
self.last_time = {} self.last_time = {}
self.last_line = {} self.last_line = {}
self.data = {} self.data = {}
@ -42,7 +44,7 @@ class OutputFollower(object):
def start(self): def start(self):
self.running = True self.running = True
while self.running: while self.running:
time.sleep(1.) time.sleep(.1)
self.update_file_list() self.update_file_list()

View File

@ -88,12 +88,32 @@ function run()
# run $EXE $EZFIO # run $EXE $EZFIO
# Starts the executable in one process and # Starts the executable in one process and
# displays the output files in stdout # 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]} EXE=${EXECUTABLES[$1]}
EZFIO=$2 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 date
rm -rf -- ${EZFIO}/output
${QPACKAGE_ROOT}/scripts/follow_output.py ${EZFIO} & ${QPACKAGE_ROOT}/scripts/follow_output.py ${EZFIO} &
PID=$!
${EXE} ${EZFIO} ${EXE} ${EZFIO}
kill -2 %1 kill -2 $PID
if [[ $(jobs | wc -l) -gt 0 ]]
then
sleep 1
kill -9 $PID
fi
wait wait
date date
} }
@ -101,8 +121,13 @@ function run()
function reset() function reset()
{ {
# reset $EZFIO # reset $EZFIO
rm -rf $1/output/*.rst EZFIO=$1
rm -rf $1/determinants/{n_det,psi_det.gz,psi_coef.gz} 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 COMMAND=$1

View File

@ -371,7 +371,7 @@ subroutine $subroutine($params_main)
$decls_main $decls_main
integer :: i_generator, nmax integer :: i_generator, nmax
double precision :: wall_0, wall_1, wall_2 double precision :: wall_0, wall_1
integer(omp_lock_kind) :: lck integer(omp_lock_kind) :: lck
integer(bit_kind), allocatable :: mask(:,:,:) integer(bit_kind), allocatable :: mask(:,:,:)
integer :: ispin, k integer :: ispin, k
@ -383,8 +383,6 @@ subroutine $subroutine($params_main)
PROVIDE mo_mono_elec_integral ref_bitmask_energy PROVIDE mo_mono_elec_integral ref_bitmask_energy
nmax = ( N_det_generators/nproc ) *nproc nmax = ( N_det_generators/nproc ) *nproc
call wall_time(wall_0)
call wall_time(wall_1)
PROVIDE progress_bar PROVIDE progress_bar
@ -392,7 +390,8 @@ subroutine $subroutine($params_main)
!$ call omp_init_lock(lck) !$ call omp_init_lock(lck)
!$OMP PARALLEL DEFAULT(SHARED) & !$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 = 0
!$ iproc = omp_get_thread_num() !$ iproc = omp_get_thread_num()
allocate( mask(N_int,2,6) ) allocate( mask(N_int,2,6) )
@ -442,11 +441,11 @@ subroutine $subroutine($params_main)
i_generator, iproc $params_post) i_generator, iproc $params_post)
endif endif
!$ call omp_set_lock(lck) !$ call omp_set_lock(lck)
call wall_time(wall_2) call wall_time(wall_1)
$printout_always $printout_always
if (wall_2 - wall_0 > 2.d0) then if (wall_1 - wall_0 > 2.d0) then
wall_0 = wall_2
$printout_now $printout_now
wall_0 = wall_1
endif endif
!$ call omp_unset_lock(lck) !$ call omp_unset_lock(lck)
enddo enddo
@ -454,6 +453,7 @@ subroutine $subroutine($params_main)
deallocate( mask ) deallocate( mask )
!$OMP END PARALLEL !$OMP END PARALLEL
!$ call omp_destroy_lock(lck) !$ call omp_destroy_lock(lck)
call wall_time(wall_0)
allocate( mask(N_int,2,6) ) allocate( mask(N_int,2,6) )
@ -501,11 +501,11 @@ subroutine $subroutine($params_main)
mask(1,1,s_hole ), mask(1,1,s_part ), & mask(1,1,s_hole ), mask(1,1,s_part ), &
i_generator, 0 $params_post) i_generator, 0 $params_post)
endif endif
call wall_time(wall_2) call wall_time(wall_1)
$printout_always $printout_always
if (wall_2 - wall_0 > 2.d0) then if (wall_1 - wall_0 > 2.d0) then
wall_0 = wall_2
$printout_now $printout_now
wall_0 = wall_1
endif endif
enddo enddo
call stop_progress call stop_progress