9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 11:03:29 +01:00

Improving PT2

This commit is contained in:
Anthony Scemama 2022-03-09 10:23:27 +01:00
parent 0c8f5e5f0b
commit 25c50aab59
5 changed files with 30 additions and 24 deletions

View File

@ -291,7 +291,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
print '(A)', '========== ======================= ===================== ===================== ===========' print '(A)', '========== ======================= ===================== ===================== ==========='
print '(A)', ' Samples Energy Variance Norm^2 Seconds' print '(A)', ' Samples Energy Variance Norm^2 Seconds'
print '(A)', '========== ======================= ===================== ===================== ===========' print '(A)', '========== ======================= ===================== ===================== ==========='
PROVIDE global_selection_buffer PROVIDE global_selection_buffer
@ -537,7 +537,7 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2_data, pt2_data_
if ((time - time1 > 1.d0) .or. (n==N_det_generators)) then if ((time - time1 > 1.d0) .or. (n==N_det_generators)) then
time1 = time time1 = time
print '(I10, X, F12.6, X, G10.3, X, F10.6, X, G10.3, X, F10.6, X, G10.3, X, F10.4)', c, & print '(I10, X, F12.6, X, G10.3, X, F10.6, X, G10.3, X, F10.6, X, G10.3, X, F10.1)', c, &
pt2_data % pt2(pt2_stoch_istate) +E, & pt2_data % pt2(pt2_stoch_istate) +E, &
pt2_data_err % pt2(pt2_stoch_istate), & pt2_data_err % pt2(pt2_stoch_istate), &
pt2_data % variance(pt2_stoch_istate), & pt2_data % variance(pt2_stoch_istate), &

View File

@ -190,8 +190,12 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
integer :: bsize ! Size of selection buffers integer :: bsize ! Size of selection buffers
logical :: sending logical :: sending
double precision :: time_shift
PROVIDE global_selection_buffer global_selection_buffer_lock PROVIDE global_selection_buffer global_selection_buffer_lock
call random_number(time_shift)
time_shift = time_shift*15.d0
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
@ -209,6 +213,9 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
sending = .False. sending = .False.
done = .False. done = .False.
double precision :: time0, time1
call wall_time(time0)
time0 = time0+time_shift
do while (.not.done) do while (.not.done)
integer, external :: get_tasks_from_taskserver integer, external :: get_tasks_from_taskserver
@ -244,20 +251,25 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
done = .true. done = .true.
endif endif
call sort_selection_buffer(b) call sort_selection_buffer(b)
call omp_set_lock(global_selection_buffer_lock)
global_selection_buffer%mini = b%mini call wall_time(time1)
call merge_selection_buffers(b,global_selection_buffer) if (time1-time0 > 15.d0) then
b%cur=0
call omp_unset_lock(global_selection_buffer_lock)
if ( iproc == 1 .or. i_generator < 100 .or. done) then
call omp_set_lock(global_selection_buffer_lock) call omp_set_lock(global_selection_buffer_lock)
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending) global_selection_buffer%mini = b%mini
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), global_selection_buffer, (/task_id/), 1,sending) call merge_selection_buffers(b,global_selection_buffer)
global_selection_buffer%cur = 0 b%cur=0
call omp_unset_lock(global_selection_buffer_lock) call omp_unset_lock(global_selection_buffer_lock)
else call wall_time(time0)
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending) if ( iproc == 1 .or. i_generator < 100 .or. done) then
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), b, (/task_id/), 1,sending) call omp_set_lock(global_selection_buffer_lock)
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), global_selection_buffer, (/task_id/), 1,sending)
global_selection_buffer%cur = 0
call omp_unset_lock(global_selection_buffer_lock)
else
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), b, (/task_id/), 1,sending)
endif
endif endif
call pt2_dealloc(pt2_data) call pt2_dealloc(pt2_data)

View File

@ -474,17 +474,11 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
! endif ! endif
do i=1,fullinteresting(0) do i=1,fullinteresting(0)
do k=1,N_int fullminilist(:,:,i) = psi_det_sorted(:,:,fullinteresting(i))
fullminilist(k,1,i) = psi_det_sorted(k,1,fullinteresting(i))
fullminilist(k,2,i) = psi_det_sorted(k,2,fullinteresting(i))
enddo
enddo enddo
do i=1,interesting(0) do i=1,interesting(0)
do k=1,N_int minilist(:,:,i) = psi_det_sorted(:,:,interesting(i))
minilist(k,1,i) = psi_det_sorted(k,1,interesting(i))
minilist(k,2,i) = psi_det_sorted(k,2,interesting(i))
enddo
enddo enddo
do s2=s1,2 do s2=s1,2

View File

@ -25,7 +25,7 @@ subroutine write_time(iunit)
ct = ct - output_cpu_time_0 ct = ct - output_cpu_time_0
call wall_time(wt) call wall_time(wt)
wt = wt - output_wall_time_0 wt = wt - output_wall_time_0
write(6,'(A,F14.6,A,F14.6,A)') & write(6,'(A,F14.2,A,F14.2,A)') &
'.. >>>>> [ WALL TIME: ', wt, ' s ] [ CPU TIME: ', ct, ' s ] <<<<< ..' '.. >>>>> [ WALL TIME: ', wt, ' s ] [ CPU TIME: ', ct, ' s ] <<<<< ..'
write(6,*) write(6,*)
end end

View File

@ -114,7 +114,7 @@ subroutine print_memory_usage()
call resident_memory(rss) call resident_memory(rss)
call total_memory(mem) call total_memory(mem)
write(*,'(A,F14.6,A,F14.6,A)') & write(*,'(A,F14.3,A,F14.3,A)') &
'.. >>>>> [ RES MEM : ', rss , & '.. >>>>> [ RES MEM : ', rss , &
' GB ] [ VIRT MEM : ', mem, ' GB ] <<<<< ..' ' GB ] [ VIRT MEM : ', mem, ' GB ] <<<<< ..'
end end