10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-04 21:24:02 +01:00

custom buffers in dress_zmq

This commit is contained in:
Yann Garniron 2018-03-30 18:16:00 +02:00
parent de1b5d6874
commit 4aa4c6c96e
3 changed files with 109 additions and 6 deletions

View File

@ -163,10 +163,14 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2,
integer, allocatable :: parts_to_get(:) integer, allocatable :: parts_to_get(:)
logical, allocatable :: actually_computed(:) logical, allocatable :: actually_computed(:)
integer :: total_computed integer :: total_computed
integer :: delta_loc_cur, is integer :: delta_loc_cur, is, N_buf(3)
double precision :: fac(delta_loc_N) , wei(delta_loc_N) double precision :: fac(delta_loc_N) , wei(delta_loc_N)
logical :: ok logical :: ok
integer, allocatable :: int_buf(:)
double precision, allocatable :: double_buf(:)
integer(bit_kind), allocatable :: det_buf(:,:,:)
allocate(int_buf(N_dress_int_buffer), double_buf(N_dress_double_buffer),det_buf(N_int,2,N_dress_det_buffer))
delta_loc_cur = 1 delta_loc_cur = 1
delta = 0d0 delta = 0d0
@ -206,7 +210,8 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2,
loop = .true. loop = .true.
felem = N_det+1 felem = N_det+1
pullLoop : do while (loop) pullLoop : do while (loop)
call pull_dress_results(zmq_socket_pull, ind, delta_loc(1,1,1,delta_loc_cur), task_id, felem_loc) call pull_dress_results(zmq_socket_pull, ind, delta_loc(1,1,1,delta_loc_cur), int_buf, double_buf, det_buf, N_buf, task_id, felem_loc)
call dress_pulled(int_buf, double_buf, det_buf, N_buf)
felem = min(felem_loc, felem) felem = min(felem_loc, felem)
dress_mwen(:) = 0d0 dress_mwen(:) = 0d0
@ -449,6 +454,7 @@ END_PROVIDER
done_cp_at = 0 done_cp_at = 0
comp_filler = .false. comp_filler = .false.
computed = .false. computed = .false.
cps_N = 1d0
N_dress_jobs = first_det_of_comb - 1 N_dress_jobs = first_det_of_comb - 1
do i=1, N_dress_jobs do i=1, N_dress_jobs

View File

@ -1,3 +1,5 @@
use bitmasks
BEGIN_PROVIDER [ integer, fragment_count ] BEGIN_PROVIDER [ integer, fragment_count ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
@ -54,7 +56,7 @@ subroutine run_dress_slave(thread,iproc,energy)
read (task,*) subset, i_generator read (task,*) subset, i_generator
delta_ij_loc = 0d0 delta_ij_loc = 0d0
call alpha_callback(delta_ij_loc, i_generator, subset, iproc) call alpha_callback(delta_ij_loc, i_generator, subset, iproc)
call generator_done(i_generator)
call task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id) call task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id)
call push_dress_results(zmq_socket_push, i_generator, delta_ij_loc, task_id) call push_dress_results(zmq_socket_push, i_generator, delta_ij_loc, task_id)
else else
@ -67,6 +69,17 @@ subroutine run_dress_slave(thread,iproc,energy)
end subroutine end subroutine
BEGIN_PROVIDER [ integer, dress_int_buffer, (N_dress_int_buffer) ]
&BEGIN_PROVIDER [ double precision, dress_double_buffer, (N_dress_double_buffer) ]
&BEGIN_PROVIDER [ integer(bit_kind), dress_det_buffer, (N_int, 2, N_dress_det_buffer) ]
implicit none
dress_int_buffer = 0
dress_double_buffer = 0d0
dress_det_buffer = 0_bit_kind
END_PROVIDER
subroutine push_dress_results(zmq_socket_push, ind, delta_loc, task_id) subroutine push_dress_results(zmq_socket_push, ind, delta_loc, task_id)
use f77_zmq use f77_zmq
implicit none implicit none
@ -99,6 +112,29 @@ subroutine push_dress_results(zmq_socket_push, ind, delta_loc, task_id)
rc = f77_zmq_send( zmq_socket_push, delta_loc(1,felem,2), 8*N_states*(N_det-felem+1), ZMQ_SNDMORE) rc = f77_zmq_send( zmq_socket_push, delta_loc(1,felem,2), 8*N_states*(N_det-felem+1), ZMQ_SNDMORE)
if(rc /= 8*N_states*(N_det+1-felem)) stop "push" if(rc /= 8*N_states*(N_det+1-felem)) stop "push"
rc = f77_zmq_send( zmq_socket_push, N_dress_int_buffer, 4, ZMQ_SNDMORE)
if(rc /= 4) stop "push"
rc = f77_zmq_send( zmq_socket_push, dress_int_buffer, 4*N_dress_int_buffer, ZMQ_SNDMORE)
if(rc /= 4*N_dress_int_buffer) stop "push"
rc = f77_zmq_send( zmq_socket_push, N_dress_double_buffer, 4, ZMQ_SNDMORE)
if(rc /= 4) stop "push"
rc = f77_zmq_send( zmq_socket_push, dress_double_buffer, 8*N_dress_double_buffer, ZMQ_SNDMORE)
if(rc /= 8*N_dress_double_buffer) stop "push"
rc = f77_zmq_send( zmq_socket_push, N_dress_det_buffer, 4, ZMQ_SNDMORE)
if(rc /= 4) stop "push"
rc = f77_zmq_send( zmq_socket_push, dress_det_buffer, 2*N_int*bit_kind*N_dress_det_buffer, ZMQ_SNDMORE)
if(rc /= 2*N_int*bit_kind*N_dress_det_buffer) stop "push"
rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0) rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0)
if(rc /= 4) stop "push" if(rc /= 4) stop "push"
@ -112,15 +148,19 @@ IRP_ENDIF
end subroutine end subroutine
subroutine pull_dress_results(zmq_socket_pull, ind, delta_loc, task_id, felem) subroutine pull_dress_results(zmq_socket_pull, ind, delta_loc, int_buf, double_buf, det_buf, N_buf, task_id, felem)
use f77_zmq use f77_zmq
implicit none implicit none
integer(ZMQ_PTR), intent(in) :: zmq_socket_pull integer(ZMQ_PTR), intent(in) :: zmq_socket_pull
double precision, intent(inout) :: delta_loc(N_states, N_det, 2) double precision, intent(inout) :: delta_loc(N_states, N_det, 2)
double precision, intent(out) :: double_buf(*)
integer, intent(out) :: int_buf(*)
integer(bit_kind), intent(out) :: det_buf(N_int, 2, *)
integer, intent(out) :: felem integer, intent(out) :: felem
integer, intent(out) :: ind integer, intent(out) :: ind
integer, intent(out) :: task_id integer, intent(out) :: task_id
integer :: rc, i integer :: rc, i
integer, intent(out) :: N_buf(3)
rc = f77_zmq_recv( zmq_socket_pull, ind, 4, 0) rc = f77_zmq_recv( zmq_socket_pull, ind, 4, 0)
@ -137,6 +177,34 @@ subroutine pull_dress_results(zmq_socket_pull, ind, delta_loc, task_id, felem)
rc = f77_zmq_recv( zmq_socket_pull, delta_loc(1,felem,2), N_states*8*(N_det+1-felem), 0) rc = f77_zmq_recv( zmq_socket_pull, delta_loc(1,felem,2), N_states*8*(N_det+1-felem), 0)
if(rc /= 8*N_states*(N_det+1-felem)) stop "pull" if(rc /= 8*N_states*(N_det+1-felem)) stop "pull"
rc = f77_zmq_recv( zmq_socket_pull, N_buf(1), 4, 0)
if(rc /= 4) stop "pull"
if(N_buf(1) > N_dress_int_buffer) stop "run_dress_slave N_buf bad size?"
rc = f77_zmq_recv( zmq_socket_pull, int_buf, 4*N_buf(1), 0)
if(rc /= 4*N_buf(1)) stop "pull1"
rc = f77_zmq_recv( zmq_socket_pull, N_buf(2), 4, 0)
if(rc /= 4) stop "pull"
if(N_buf(2) > N_dress_double_buffer) stop "run_dress_slave N_buf bad size?"
rc = f77_zmq_recv( zmq_socket_pull, double_buf, 8*N_buf(2), 0)
if(rc /= 8*N_buf(2)) stop "pull2"
rc = f77_zmq_recv( zmq_socket_pull, N_buf(3), 4, 0)
if(rc /= 4) stop "pull"
if(N_buf(3) > N_dress_det_buffer) stop "run_dress_slave N_buf bad size?"
rc = f77_zmq_recv( zmq_socket_pull, det_buf, 2*N_int*bit_kind*N_buf(3), 0)
if(rc /= 2*N_int*bit_kind*N_buf(3)) stop "pull3"
rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0) rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0)
if(rc /= 4) stop "pull" if(rc /= 4) stop "pull"

View File

@ -1,5 +1,16 @@
use selection_types use selection_types
BEGIN_PROVIDER [ integer, N_dress_int_buffer ]
&BEGIN_PROVIDER [ integer, N_dress_double_buffer ]
&BEGIN_PROVIDER [ integer, N_dress_det_buffer ]
implicit none
N_dress_int_buffer = 1
N_dress_double_buffer = 1
N_dress_det_buffer = 1
END_PROVIDER
BEGIN_PROVIDER [ double precision, fock_diag_tmp_, (2,mo_tot_num+1,Nproc) ] BEGIN_PROVIDER [ double precision, fock_diag_tmp_, (2,mo_tot_num+1,Nproc) ]
&BEGIN_PROVIDER [ integer, current_generator_, (Nproc) ] &BEGIN_PROVIDER [ integer, current_generator_, (Nproc) ]
&BEGIN_PROVIDER [ double precision, a_h_i, (N_det, Nproc) ] &BEGIN_PROVIDER [ double precision, a_h_i, (N_det, Nproc) ]
@ -21,6 +32,24 @@ use selection_types
a_s2_i = 0d0 a_s2_i = 0d0
END_PROVIDER END_PROVIDER
subroutine generator_done(i_gen)
implicit none
integer, intent(in) :: i_gen
!dress_int_buffer = ...
end subroutine
subroutine dress_pulled(int_buf, double_buf, det_buf, N_buf)
use bitmasks
implicit none
integer, intent(in) :: N_buf(3)
integer, intent(in) :: int_buf(*)
double precision, intent(in) :: double_buf(*)
integer(bit_kind), intent(in) :: det_buf(N_int,2,*)
end subroutine
subroutine delta_ij_done() subroutine delta_ij_done()