2018-03-30 18:16:00 +02:00
|
|
|
use bitmasks
|
|
|
|
|
2017-12-15 16:21:04 +01:00
|
|
|
BEGIN_PROVIDER [ integer, fragment_count ]
|
|
|
|
implicit none
|
|
|
|
BEGIN_DOC
|
|
|
|
! Number of fragments for the deterministic part
|
|
|
|
END_DOC
|
|
|
|
fragment_count = 1
|
|
|
|
END_PROVIDER
|
|
|
|
|
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
subroutine run_dress_slave(thread,iproce,energy)
|
2017-12-15 16:21:04 +01:00
|
|
|
use f77_zmq
|
2018-05-01 17:43:46 +02:00
|
|
|
use omp_lib
|
2017-12-15 16:21:04 +01:00
|
|
|
implicit none
|
|
|
|
|
|
|
|
double precision, intent(in) :: energy(N_states_diag)
|
2018-05-01 13:16:10 +02:00
|
|
|
integer, intent(in) :: thread, iproce
|
2017-12-15 16:21:04 +01:00
|
|
|
integer :: rc, i, subset, i_generator
|
|
|
|
|
|
|
|
integer :: worker_id, task_id, ctask, ltask
|
2018-04-27 12:41:39 +02:00
|
|
|
character*(5120) :: task
|
2017-12-15 16:21:04 +01:00
|
|
|
|
|
|
|
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
|
|
|
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
|
|
|
|
|
|
|
integer(ZMQ_PTR), external :: new_zmq_push_socket
|
|
|
|
integer(ZMQ_PTR) :: zmq_socket_push
|
|
|
|
|
|
|
|
logical :: done
|
|
|
|
|
|
|
|
double precision,allocatable :: dress_detail(:)
|
|
|
|
integer :: ind
|
|
|
|
|
2018-02-16 11:50:49 +01:00
|
|
|
double precision,allocatable :: delta_ij_loc(:,:,:)
|
|
|
|
integer :: h,p,n,i_state
|
2017-12-15 16:21:04 +01:00
|
|
|
logical :: ok
|
|
|
|
|
2018-04-04 11:32:27 +02:00
|
|
|
integer, allocatable :: int_buf(:)
|
|
|
|
double precision, allocatable :: double_buf(:)
|
|
|
|
integer(bit_kind), allocatable :: det_buf(:,:,:)
|
|
|
|
integer :: N_buf(3)
|
2018-04-27 12:41:39 +02:00
|
|
|
logical :: last
|
2018-05-01 17:43:46 +02:00
|
|
|
!integer, external :: omp_get_thread_num
|
2018-05-01 13:16:10 +02:00
|
|
|
double precision, allocatable :: delta_det(:,:,:,:), cp(:,:,:,:)
|
|
|
|
integer :: toothMwen
|
|
|
|
logical :: fracted
|
|
|
|
double precision :: fac
|
2018-05-02 14:32:41 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
|
2018-05-22 19:11:10 +02:00
|
|
|
! if(iproce /= 0) stop "RUN DRESS SLAVE is OMP"
|
2018-05-01 13:16:10 +02:00
|
|
|
|
|
|
|
allocate(delta_det(N_states, N_det, 0:comb_teeth+1, 2))
|
|
|
|
allocate(cp(N_states, N_det, N_cp, 2))
|
|
|
|
delta_det = 0d9
|
|
|
|
cp = 0d0
|
|
|
|
|
2018-04-27 12:41:39 +02:00
|
|
|
|
|
|
|
task(:) = CHAR(0)
|
2018-04-04 11:32:27 +02:00
|
|
|
|
2017-12-15 16:21:04 +01:00
|
|
|
|
2018-05-01 17:43:46 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
integer :: iproc, cur_cp, done_for(0:N_cp)
|
|
|
|
integer, allocatable :: tasks(:)
|
2018-05-01 15:08:41 +02:00
|
|
|
integer :: lastCp(Nproc)
|
|
|
|
integer :: lastSent, lastSendable
|
|
|
|
logical :: send
|
2018-05-01 17:43:46 +02:00
|
|
|
integer(kind=OMP_LOCK_KIND) :: lck_det(0:comb_teeth+1)
|
|
|
|
integer(kind=OMP_LOCK_KIND) :: lck_sto(0:N_cp+1)
|
|
|
|
|
|
|
|
do i=0,N_cp+1
|
|
|
|
call omp_init_lock(lck_sto(i))
|
|
|
|
end do
|
|
|
|
do i=0,comb_teeth+1
|
|
|
|
call omp_init_lock(lck_det(i))
|
|
|
|
end do
|
2017-12-15 16:21:04 +01:00
|
|
|
|
2018-05-01 15:08:41 +02:00
|
|
|
lastCp = 0
|
|
|
|
lastSent = 0
|
|
|
|
send = .false.
|
2018-05-01 13:16:10 +02:00
|
|
|
done_for = 0
|
|
|
|
|
2018-05-02 14:32:41 +02:00
|
|
|
double precision :: hij, sij
|
2018-05-14 13:00:04 +02:00
|
|
|
!call i_h_j_s2(psi_det(1,1,1),psi_det(1,1,2),N_int,hij, sij)
|
|
|
|
|
2018-05-17 18:27:06 +02:00
|
|
|
hij = dress_E0_denominator(1) !PROVIDE BEFORE OMP PARALLEL
|
2018-05-14 13:00:04 +02:00
|
|
|
|
2018-05-01 15:08:41 +02:00
|
|
|
!$OMP PARALLEL DEFAULT(SHARED) &
|
|
|
|
!$OMP PRIVATE(int_buf, double_buf, det_buf, delta_ij_loc, task, task_id) &
|
2018-05-01 17:43:46 +02:00
|
|
|
!$OMP PRIVATE(lastSendable, toothMwen, fracted, fac) &
|
|
|
|
!$OMP PRIVATE(i, cur_cp, send, i_generator, subset, iproc, N_buf) &
|
|
|
|
!$OMP PRIVATE(zmq_to_qp_run_socket, zmq_socket_push, worker_id)
|
|
|
|
|
2017-12-15 16:21:04 +01:00
|
|
|
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
|
|
|
zmq_socket_push = new_zmq_push_socket(thread)
|
|
|
|
call connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread)
|
|
|
|
if(worker_id == -1) then
|
|
|
|
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
|
|
|
call end_zmq_push_socket(zmq_socket_push,thread)
|
2018-05-01 17:43:46 +02:00
|
|
|
stop "WORKER -1"
|
2017-12-15 16:21:04 +01:00
|
|
|
end if
|
2018-05-01 17:43:46 +02:00
|
|
|
|
|
|
|
|
2018-05-01 15:08:41 +02:00
|
|
|
iproc = omp_get_thread_num()+1
|
|
|
|
allocate(int_buf(N_dress_int_buffer))
|
|
|
|
allocate(double_buf(N_dress_double_buffer))
|
|
|
|
allocate(det_buf(N_int, 2, N_dress_det_buffer))
|
|
|
|
allocate(delta_ij_loc(N_states,N_det,2))
|
2017-12-15 16:21:04 +01:00
|
|
|
do
|
|
|
|
call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task)
|
2018-05-01 15:08:41 +02:00
|
|
|
task = task//" 0"
|
2018-05-14 13:00:04 +02:00
|
|
|
if(task_id == 0) exit
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
2017-12-15 16:21:04 +01:00
|
|
|
if(task_id /= 0) then
|
|
|
|
read (task,*) subset, i_generator
|
2018-05-14 13:00:04 +02:00
|
|
|
|
|
|
|
!$OMP ATOMIC
|
|
|
|
done_for(done_cp_at_det(i_generator)) += 1
|
2018-05-17 16:02:51 +02:00
|
|
|
! print *, "IGEN", i_generator, done_cp_at_det(i_generator)
|
2018-05-14 13:00:04 +02:00
|
|
|
delta_ij_loc(:,:,:) = 0d0
|
|
|
|
call generator_start(i_generator, iproc)
|
2018-02-20 17:34:51 +01:00
|
|
|
call alpha_callback(delta_ij_loc, i_generator, subset, iproc)
|
2018-05-14 13:00:04 +02:00
|
|
|
call generator_done(i_generator, int_buf, double_buf, det_buf, N_buf, iproc)
|
|
|
|
|
|
|
|
do i=1,N_cp
|
|
|
|
fac = cps(i_generator, i) * dress_weight_inv(i_generator) * comb_step
|
|
|
|
if(fac == 0d0) cycle
|
|
|
|
call omp_set_lock(lck_sto(i))
|
|
|
|
cp(:,:,i,1) += (delta_ij_loc(:,:,1) * fac)
|
|
|
|
cp(:,:,i,2) += (delta_ij_loc(:,:,2) * fac)
|
|
|
|
call omp_unset_lock(lck_sto(i))
|
|
|
|
end do
|
|
|
|
|
2018-02-16 11:50:49 +01:00
|
|
|
|
2018-05-14 13:00:04 +02:00
|
|
|
toothMwen = tooth_of_det(i_generator)
|
|
|
|
fracted = (toothMwen /= 0)
|
|
|
|
if(fracted) fracted = (i_generator == first_det_of_teeth(toothMwen))
|
|
|
|
if(fracted) then
|
|
|
|
call omp_set_lock(lck_det(toothMwen))
|
|
|
|
call omp_set_lock(lck_det(toothMwen-1))
|
|
|
|
delta_det(:,:,toothMwen-1, 1) += delta_ij_loc(:,:,1) * (1d0-fractage(toothMwen))
|
|
|
|
delta_det(:,:,toothMwen-1, 2) += delta_ij_loc(:,:,2) * (1d0-fractage(toothMwen))
|
|
|
|
delta_det(:,:,toothMwen , 1) += delta_ij_loc(:,:,1) * (fractage(toothMwen))
|
|
|
|
delta_det(:,:,toothMwen , 2) += delta_ij_loc(:,:,2) * (fractage(toothMwen))
|
|
|
|
call omp_unset_lock(lck_det(toothMwen))
|
|
|
|
call omp_unset_lock(lck_det(toothMwen-1))
|
|
|
|
else
|
|
|
|
call omp_set_lock(lck_det(toothMwen))
|
|
|
|
delta_det(:,:,toothMwen , 1) += delta_ij_loc(:,:,1)
|
|
|
|
delta_det(:,:,toothMwen , 2) += delta_ij_loc(:,:,2)
|
|
|
|
call omp_unset_lock(lck_det(toothMwen))
|
|
|
|
end if
|
|
|
|
call push_dress_results(zmq_socket_push, i_generator, -1, delta_ij_loc, int_buf, double_buf, det_buf, N_buf, task_id)
|
2017-12-15 16:21:04 +01:00
|
|
|
call task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id)
|
2018-05-14 13:00:04 +02:00
|
|
|
lastCp(iproc) = done_cp_at_det(i_generator)
|
2018-05-01 15:08:41 +02:00
|
|
|
end if
|
2018-05-14 13:00:04 +02:00
|
|
|
|
2018-05-01 15:08:41 +02:00
|
|
|
!$OMP CRITICAL
|
|
|
|
send = .false.
|
|
|
|
lastSendable = N_cp*2
|
|
|
|
do i=1,Nproc
|
2018-05-01 17:43:46 +02:00
|
|
|
lastSendable = min(lastCp(i), lastSendable)
|
2018-05-01 15:08:41 +02:00
|
|
|
end do
|
|
|
|
lastSendable -= 1
|
2018-05-14 13:00:04 +02:00
|
|
|
if(lastSendable > lastSent .or. (lastSendable == N_cp-1 .and. lastSent /= N_cp-1)) then
|
2018-05-01 15:08:41 +02:00
|
|
|
lastSent = lastSendable
|
2018-05-14 13:00:04 +02:00
|
|
|
cur_cp = lastSent
|
2018-05-01 15:08:41 +02:00
|
|
|
send = .true.
|
|
|
|
end if
|
|
|
|
!$OMP END CRITICAL
|
2018-05-14 13:00:04 +02:00
|
|
|
|
2018-05-01 15:08:41 +02:00
|
|
|
if(send) then
|
|
|
|
N_buf = (/0,1,0/)
|
2018-05-14 13:00:04 +02:00
|
|
|
|
2018-05-01 15:08:41 +02:00
|
|
|
delta_ij_loc = 0d0
|
|
|
|
if(cur_cp < 1) stop "cur_cp < 1"
|
2018-05-01 13:16:10 +02:00
|
|
|
do i=1,cur_cp
|
2018-05-17 16:02:51 +02:00
|
|
|
delta_ij_loc(:,:,1) += cp(:,:,i,1)
|
|
|
|
delta_ij_loc(:,:,2) += cp(:,:,i,2)
|
2018-05-01 13:16:10 +02:00
|
|
|
end do
|
|
|
|
|
|
|
|
delta_ij_loc(:,:,:) = delta_ij_loc(:,:,:) / cps_N(cur_cp)
|
|
|
|
do i=cp_first_tooth(cur_cp)-1,0,-1
|
2018-05-17 16:02:51 +02:00
|
|
|
delta_ij_loc(:,:,1) = delta_ij_loc(:,:,1) +delta_det(:,:,i,1)
|
|
|
|
delta_ij_loc(:,:,2) = delta_ij_loc(:,:,2) +delta_det(:,:,i,2)
|
2018-05-01 13:16:10 +02:00
|
|
|
end do
|
2018-05-01 15:08:41 +02:00
|
|
|
call push_dress_results(zmq_socket_push, done_for(cur_cp), cur_cp, delta_ij_loc, int_buf, double_buf, det_buf, N_buf, -1)
|
2017-12-15 16:21:04 +01:00
|
|
|
end if
|
2018-05-01 15:08:41 +02:00
|
|
|
|
2018-05-14 13:00:04 +02:00
|
|
|
if(task_id == 0) exit
|
2017-12-15 16:21:04 +01:00
|
|
|
end do
|
2018-05-01 13:16:10 +02:00
|
|
|
|
2018-03-23 13:37:03 +01:00
|
|
|
call disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id)
|
|
|
|
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
2017-12-15 16:21:04 +01:00
|
|
|
call end_zmq_push_socket(zmq_socket_push,thread)
|
2018-05-01 17:43:46 +02:00
|
|
|
!$OMP END PARALLEL
|
|
|
|
|
|
|
|
do i=0,N_cp+1
|
|
|
|
call omp_destroy_lock(lck_sto(i))
|
|
|
|
end do
|
|
|
|
do i=0,comb_teeth+1
|
|
|
|
call omp_destroy_lock(lck_det(i))
|
2018-05-02 14:32:41 +02:00
|
|
|
end do
|
2017-12-15 16:21:04 +01:00
|
|
|
end subroutine
|
|
|
|
|
|
|
|
|
2018-03-30 18:16:00 +02:00
|
|
|
|
2018-05-02 14:32:41 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
subroutine push_dress_results(zmq_socket_push, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_bufi, task_id)
|
2017-12-15 16:21:04 +01:00
|
|
|
use f77_zmq
|
|
|
|
implicit none
|
2018-05-14 13:00:04 +02:00
|
|
|
|
|
|
|
integer, parameter :: sendt = 4
|
2017-12-15 16:21:04 +01:00
|
|
|
integer(ZMQ_PTR), intent(in) :: zmq_socket_push
|
2018-04-29 17:09:46 +02:00
|
|
|
double precision, intent(inout) :: delta_loc(N_states, N_det, 2)
|
2018-04-30 09:33:25 +02:00
|
|
|
real(kind=4), allocatable :: delta_loc4(:,:,:)
|
2018-04-04 11:32:27 +02:00
|
|
|
double precision, intent(in) :: double_buf(*)
|
|
|
|
integer, intent(in) :: int_buf(*)
|
|
|
|
integer(bit_kind), intent(in) :: det_buf(N_int, 2, *)
|
2018-04-27 12:41:39 +02:00
|
|
|
integer, intent(in) :: N_bufi(3)
|
|
|
|
integer :: N_buf(3)
|
2018-05-01 13:16:10 +02:00
|
|
|
integer, intent(in) :: ind, cur_cp, task_id
|
2018-04-30 09:33:25 +02:00
|
|
|
integer :: rc, i, j, k, l
|
2018-04-29 17:09:46 +02:00
|
|
|
double precision :: contrib(N_states)
|
2018-05-14 13:00:04 +02:00
|
|
|
real(sendt), allocatable :: r4buf(:,:,:)
|
2017-12-15 16:21:04 +01:00
|
|
|
|
2018-05-02 14:32:41 +02:00
|
|
|
rc = f77_zmq_send( zmq_socket_push, ind, 4, ZMQ_SNDMORE)
|
2017-12-15 16:21:04 +01:00
|
|
|
if(rc /= 4) stop "push"
|
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
rc = f77_zmq_send( zmq_socket_push, cur_cp, 4, ZMQ_SNDMORE)
|
2017-12-15 16:21:04 +01:00
|
|
|
if(rc /= 4) stop "push"
|
|
|
|
|
2018-04-29 17:09:46 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
if(cur_cp /= -1) then
|
2018-05-02 14:32:41 +02:00
|
|
|
allocate(r4buf(N_states, N_det, 2))
|
|
|
|
do i=1,2
|
|
|
|
do j=1,N_det
|
|
|
|
do k=1,N_states
|
2018-05-14 13:00:04 +02:00
|
|
|
r4buf(k,j,i) = real(delta_loc(k,j,i), sendt)
|
2018-05-02 14:32:41 +02:00
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
2018-05-01 13:16:10 +02:00
|
|
|
|
2018-05-14 13:00:04 +02:00
|
|
|
rc = f77_zmq_send( zmq_socket_push, r4buf(1,1,1), sendt*N_states*N_det, ZMQ_SNDMORE)
|
|
|
|
if(rc /= sendt*N_states*N_det) stop "push"
|
2018-05-02 14:32:41 +02:00
|
|
|
|
2018-05-14 13:00:04 +02:00
|
|
|
rc = f77_zmq_send( zmq_socket_push, r4buf(1,1,2), sendt*N_states*N_det, ZMQ_SNDMORE)
|
|
|
|
if(rc /= sendt*N_states*N_det) stop "push"
|
2018-05-01 13:16:10 +02:00
|
|
|
else
|
|
|
|
contrib = 0d0
|
2018-04-29 17:09:46 +02:00
|
|
|
do i=1,N_det
|
2018-05-01 13:16:10 +02:00
|
|
|
contrib(:) += delta_loc(:,i, 1) * psi_coef(i, :)
|
2018-04-29 17:09:46 +02:00
|
|
|
end do
|
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
rc = f77_zmq_send( zmq_socket_push, contrib, 8*N_states, ZMQ_SNDMORE)
|
|
|
|
if(rc /= 8*N_states) stop "push"
|
2018-04-30 13:25:58 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
N_buf = N_bufi
|
2018-05-14 13:00:04 +02:00
|
|
|
!N_buf = (/0,1,0/)
|
2018-04-29 17:09:46 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
rc = f77_zmq_send( zmq_socket_push, N_buf, 4*3, ZMQ_SNDMORE)
|
|
|
|
if(rc /= 4*3) stop "push5"
|
|
|
|
|
|
|
|
if(N_buf(1) > N_dress_int_buffer) stop "run_dress_slave N_buf bad size?"
|
|
|
|
if(N_buf(2) > N_dress_double_buffer) stop "run_dress_slave N_buf bad size?"
|
|
|
|
if(N_buf(3) > N_dress_det_buffer) stop "run_dress_slave N_buf bad size?"
|
2018-04-29 17:09:46 +02:00
|
|
|
|
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
if(N_buf(1) > 0) then
|
|
|
|
rc = f77_zmq_send( zmq_socket_push, int_buf, 4*N_buf(1), ZMQ_SNDMORE)
|
|
|
|
if(rc /= 4*N_buf(1)) stop "push6"
|
|
|
|
end if
|
|
|
|
|
|
|
|
if(N_buf(2) > 0) then
|
|
|
|
rc = f77_zmq_send( zmq_socket_push, double_buf, 8*N_buf(2), ZMQ_SNDMORE)
|
|
|
|
if(rc /= 8*N_buf(2)) stop "push8"
|
2018-04-29 17:09:46 +02:00
|
|
|
end if
|
2018-04-27 12:41:39 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
if(N_buf(3) > 0) then
|
|
|
|
rc = f77_zmq_send( zmq_socket_push, det_buf, 2*N_int*bit_kind*N_buf(3), ZMQ_SNDMORE)
|
|
|
|
if(rc /= 2*N_int*bit_kind*N_buf(3)) stop "push10"
|
|
|
|
end if
|
2018-04-04 11:32:27 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0)
|
|
|
|
if(rc /= 4) stop "push11"
|
2018-04-04 11:32:27 +02:00
|
|
|
end if
|
2017-12-15 16:21:04 +01:00
|
|
|
|
|
|
|
! Activate is zmq_socket_push is a REQ
|
|
|
|
IRP_IF ZMQ_PUSH
|
|
|
|
IRP_ELSE
|
|
|
|
character*(2) :: ok
|
|
|
|
rc = f77_zmq_recv( zmq_socket_push, ok, 2, 0)
|
|
|
|
IRP_ENDIF
|
|
|
|
|
|
|
|
end subroutine
|
|
|
|
|
|
|
|
|
2018-05-02 14:32:41 +02:00
|
|
|
BEGIN_PROVIDER [ real(4), real4buf, (N_states, N_det, 2) ]
|
|
|
|
|
|
|
|
END_PROVIDER
|
|
|
|
|
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
subroutine pull_dress_results(zmq_socket_pull, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_buf, task_id, contrib)
|
2017-12-15 16:21:04 +01:00
|
|
|
use f77_zmq
|
|
|
|
implicit none
|
2018-05-14 13:00:04 +02:00
|
|
|
integer, parameter :: sendt = 4
|
2017-12-15 16:21:04 +01:00
|
|
|
integer(ZMQ_PTR), intent(in) :: zmq_socket_pull
|
2018-05-01 13:16:10 +02:00
|
|
|
integer, intent(out) :: cur_cp
|
2018-02-14 10:33:11 +01:00
|
|
|
double precision, intent(inout) :: delta_loc(N_states, N_det, 2)
|
2018-04-29 17:09:46 +02:00
|
|
|
double precision, intent(out) :: double_buf(*), contrib(N_states)
|
2018-03-30 18:16:00 +02:00
|
|
|
integer, intent(out) :: int_buf(*)
|
|
|
|
integer(bit_kind), intent(out) :: det_buf(N_int, 2, *)
|
2017-12-15 16:21:04 +01:00
|
|
|
integer, intent(out) :: ind
|
|
|
|
integer, intent(out) :: task_id
|
2018-05-01 13:16:10 +02:00
|
|
|
integer :: rc, i, j, k
|
2018-03-30 18:16:00 +02:00
|
|
|
integer, intent(out) :: N_buf(3)
|
2017-12-15 16:21:04 +01:00
|
|
|
|
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, ind, 4, 0)
|
2018-04-04 11:32:27 +02:00
|
|
|
if(rc /= 4) stop "pulla"
|
2018-04-27 12:41:39 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, cur_cp, 4, 0)
|
|
|
|
if(rc /= 4) stop "pulla"
|
2017-12-15 16:21:04 +01:00
|
|
|
|
2018-03-27 16:22:14 +02:00
|
|
|
|
2018-04-29 17:09:46 +02:00
|
|
|
|
2018-04-30 09:33:25 +02:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
if(cur_cp /= -1) then
|
2018-05-02 14:32:41 +02:00
|
|
|
|
2018-05-14 13:00:04 +02:00
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, real4buf(1,1,1), N_states*sendt*N_det, 0)
|
|
|
|
if(rc /= sendt*N_states*N_det) stop "pullc"
|
2018-03-30 18:16:00 +02:00
|
|
|
|
2018-05-14 13:00:04 +02:00
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, real4buf(1,1,2), N_states*sendt*N_det, 0)
|
|
|
|
if(rc /= sendt*N_states*N_det) stop "pulld"
|
2018-05-02 14:32:41 +02:00
|
|
|
|
|
|
|
do i=1,2
|
|
|
|
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(j,k)
|
|
|
|
do j=1,N_det
|
|
|
|
do k=1,N_states
|
|
|
|
delta_loc(k,j,i) = real(real4buf(k,j,i), 8)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
end do
|
2018-05-01 13:16:10 +02:00
|
|
|
else
|
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, contrib, 8*N_states, 0)
|
|
|
|
if(rc /= 8*N_states) stop "pullc"
|
2017-12-15 16:21:04 +01:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, N_buf, 4*3, 0)
|
|
|
|
if(rc /= 4*3) stop "pull"
|
|
|
|
if(N_buf(1) > N_dress_int_buffer) stop "run_dress_slave N_buf bad size?"
|
|
|
|
if(N_buf(2) > N_dress_double_buffer) stop "run_dress_slave N_buf bad size?"
|
|
|
|
if(N_buf(3) > N_dress_det_buffer) stop "run_dress_slave N_buf bad size?"
|
2017-12-15 16:21:04 +01:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
|
|
|
|
if(N_buf(1) > 0) then
|
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, int_buf, 4*N_buf(1), 0)
|
|
|
|
if(rc /= 4*N_buf(1)) stop "pull1"
|
|
|
|
end if
|
|
|
|
|
|
|
|
if(N_buf(2) > 0) then
|
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, double_buf, 8*N_buf(2), 0)
|
|
|
|
if(rc /= 8*N_buf(2)) stop "pull2"
|
|
|
|
end if
|
|
|
|
|
|
|
|
if(N_buf(3) > 0) then
|
|
|
|
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"
|
|
|
|
end if
|
2017-12-15 16:21:04 +01:00
|
|
|
|
2018-05-01 13:16:10 +02:00
|
|
|
rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0)
|
|
|
|
if(rc /= 4) stop "pull4"
|
|
|
|
end if
|
2017-12-15 16:21:04 +01:00
|
|
|
! Activate is zmq_socket_pull is a REP
|
|
|
|
IRP_IF ZMQ_PUSH
|
|
|
|
IRP_ELSE
|
|
|
|
rc = f77_zmq_send( zmq_socket_pull, 'ok', 2, 0)
|
|
|
|
IRP_ENDIF
|
|
|
|
|
|
|
|
end subroutine
|
|
|
|
|
|
|
|
|
|
|
|
|