mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-24 21:41:46 +02:00
a davidson task is a range of blocks
This commit is contained in:
parent
7cc21bc38d
commit
1afee06817
@ -61,7 +61,7 @@ let bind_socket ~socket_type ~socket ~address =
|
||||
with
|
||||
| Unix.Unix_error _ -> (Time.pause @@ Time.Span.of_float 1. ; loop (i-1) )
|
||||
| other_exception -> raise other_exception
|
||||
in loop 10
|
||||
in loop 60
|
||||
|
||||
|
||||
let hostname = lazy (
|
||||
|
@ -4,12 +4,12 @@
|
||||
use bitmasks
|
||||
use f77_zmq
|
||||
|
||||
subroutine davidson_process(block, N, idx, vt, st)
|
||||
subroutine davidson_process(blockb, blocke, N, idx, vt, st)
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
integer , intent(in) :: block
|
||||
integer , intent(in) :: blockb, blocke
|
||||
integer , intent(inout) :: N
|
||||
integer , intent(inout) :: idx(dav_size)
|
||||
double precision , intent(inout) :: vt(N_states, dav_size)
|
||||
@ -22,8 +22,8 @@ subroutine davidson_process(block, N, idx, vt, st)
|
||||
|
||||
|
||||
wrotten = .false.
|
||||
sh = block
|
||||
|
||||
|
||||
do sh = blockb, blocke
|
||||
do sh2=1,sh
|
||||
exa = 0
|
||||
do ni=1,N_int
|
||||
@ -73,7 +73,8 @@ subroutine davidson_process(block, N, idx, vt, st)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
enddo
|
||||
|
||||
N = 0
|
||||
do i=1, dav_size
|
||||
if(wrotten(i)) then
|
||||
@ -90,11 +91,11 @@ end subroutine
|
||||
|
||||
|
||||
|
||||
subroutine davidson_collect(block, N, idx, vt, st , v0, s0)
|
||||
subroutine davidson_collect(blockb, blocke, N, idx, vt, st , v0, s0)
|
||||
implicit none
|
||||
|
||||
|
||||
integer , intent(in) :: block
|
||||
integer , intent(in) :: blockb, blocke
|
||||
integer , intent(in) :: N
|
||||
integer , intent(in) :: idx(N)
|
||||
double precision , intent(in) :: vt(N_states, N)
|
||||
@ -123,16 +124,16 @@ end subroutine
|
||||
|
||||
|
||||
|
||||
subroutine davidson_add_task(zmq_to_qp_run_socket, block)
|
||||
subroutine davidson_add_task(zmq_to_qp_run_socket, blockb, blocke)
|
||||
use f77_zmq
|
||||
implicit none
|
||||
|
||||
integer(ZMQ_PTR) ,intent(in) :: zmq_to_qp_run_socket
|
||||
integer ,intent(in) :: block
|
||||
integer ,intent(in) :: blockb, blocke
|
||||
character*(512) :: task
|
||||
|
||||
|
||||
write(task,*) block
|
||||
write(task,*) blockb, blocke
|
||||
call add_task_to_taskserver(zmq_to_qp_run_socket, task)
|
||||
end subroutine
|
||||
|
||||
@ -161,7 +162,7 @@ subroutine davidson_run_slave(thread,iproc)
|
||||
|
||||
integer, intent(in) :: thread, iproc
|
||||
|
||||
integer :: worker_id, task_id, block
|
||||
integer :: worker_id, task_id, blockb, blocke
|
||||
character*(512) :: task
|
||||
|
||||
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
||||
@ -203,7 +204,7 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, worker_id)
|
||||
character*(512) :: task
|
||||
|
||||
|
||||
integer :: block
|
||||
integer :: blockb, blocke
|
||||
integer :: N
|
||||
integer , allocatable :: idx(:)
|
||||
double precision , allocatable :: vt(:,:)
|
||||
@ -218,35 +219,38 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, worker_id)
|
||||
do
|
||||
call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task)
|
||||
if(task_id == 0) exit
|
||||
read (task,*) block
|
||||
read (task,*) blockb, blocke
|
||||
|
||||
call davidson_process(block,N, idx, vt, st)
|
||||
call davidson_process(blockb, blocke, N, idx, vt, st)
|
||||
|
||||
! reverse ?
|
||||
call task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id)
|
||||
call davidson_push_results(zmq_socket_push, block, N, idx, vt, st, task_id)
|
||||
call davidson_push_results(zmq_socket_push, blockb, blocke, N, idx, vt, st, task_id)
|
||||
end do
|
||||
end subroutine
|
||||
|
||||
|
||||
|
||||
subroutine davidson_push_results(zmq_socket_push, block, N, idx, vt, st, task_id)
|
||||
subroutine davidson_push_results(zmq_socket_push, blockb, blocke, N, idx, vt, st, task_id)
|
||||
use f77_zmq
|
||||
implicit none
|
||||
|
||||
integer(ZMQ_PTR) ,intent(in) :: zmq_socket_push
|
||||
integer ,intent(in) :: task_id
|
||||
|
||||
integer ,intent(in) :: block
|
||||
integer ,intent(in) :: blockb, blocke
|
||||
integer ,intent(in) :: N
|
||||
integer ,intent(in) :: idx(N)
|
||||
double precision ,intent(in) :: vt(N_states, N)
|
||||
double precision ,intent(in) :: st(N_states, N)
|
||||
integer :: rc
|
||||
|
||||
rc = f77_zmq_send( zmq_socket_push, block, 4, ZMQ_SNDMORE)
|
||||
if(rc /= 4) stop "davidson_push_results failed to push block"
|
||||
rc = f77_zmq_send( zmq_socket_push, blockb, 4, ZMQ_SNDMORE)
|
||||
if(rc /= 4) stop "davidson_push_results failed to push blockb"
|
||||
|
||||
rc = f77_zmq_send( zmq_socket_push, blocke, 4, ZMQ_SNDMORE)
|
||||
if(rc /= 4) stop "davidson_push_results failed to push blocke"
|
||||
|
||||
rc = f77_zmq_send( zmq_socket_push, N, 4, ZMQ_SNDMORE)
|
||||
if(rc /= 4) stop "davidson_push_results failed to push N"
|
||||
|
||||
@ -265,13 +269,13 @@ end subroutine
|
||||
|
||||
|
||||
|
||||
subroutine davidson_pull_results(zmq_socket_pull, block, N, idx, vt, st, task_id)
|
||||
subroutine davidson_pull_results(zmq_socket_pull, blockb, blocke, N, idx, vt, st, task_id)
|
||||
use f77_zmq
|
||||
implicit none
|
||||
|
||||
integer(ZMQ_PTR) ,intent(in) :: zmq_socket_pull
|
||||
integer ,intent(out) :: task_id
|
||||
integer ,intent(out) :: block
|
||||
integer ,intent(out) :: blockb, blocke
|
||||
integer ,intent(out) :: N
|
||||
integer ,intent(out) :: idx(dav_size)
|
||||
double precision ,intent(out) :: vt(N_states, dav_size)
|
||||
@ -279,9 +283,12 @@ subroutine davidson_pull_results(zmq_socket_pull, block, N, idx, vt, st, task_id
|
||||
|
||||
integer :: rc
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, block, 4, 0)
|
||||
if(rc /= 4) stop "davidson_push_results failed to pull block"
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, blockb, 4, 0)
|
||||
if(rc /= 4) stop "davidson_push_results failed to pull blockb"
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, blocke, 4, 0)
|
||||
if(rc /= 4) stop "davidson_push_results failed to pull blocke"
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, N, 4, 0)
|
||||
if(rc /= 4) stop "davidson_push_results failed to pull N"
|
||||
|
||||
@ -313,7 +320,7 @@ subroutine davidson_collector(zmq_to_qp_run_socket, zmq_socket_pull , v0, s0)
|
||||
integer :: more, task_id
|
||||
|
||||
|
||||
integer :: block
|
||||
integer :: blockb, blocke
|
||||
integer :: N
|
||||
integer , allocatable :: idx(:)
|
||||
double precision , allocatable :: vt(:,:)
|
||||
@ -331,8 +338,8 @@ subroutine davidson_collector(zmq_to_qp_run_socket, zmq_socket_pull , v0, s0)
|
||||
more = 1
|
||||
|
||||
do while (more == 1)
|
||||
call davidson_pull_results(zmq_socket_pull, block, N, idx, vt, st, task_id)
|
||||
call davidson_collect(block, N, idx, vt, st , v0, s0)
|
||||
call davidson_pull_results(zmq_socket_pull, blockb, blocke, N, idx, vt, st, task_id)
|
||||
call davidson_collect(blockb, blocke, N, idx, vt, st , v0, s0)
|
||||
! done(block) = .true.
|
||||
call zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more)
|
||||
deleted += 1
|
||||
@ -491,4 +498,4 @@ END_PROVIDER
|
||||
implicit none
|
||||
call sort_dets_ab_v(dav_det, sorted_(1,1,1), sort_idx_(1,1), shortcut_(0,1), version_(1,1,1), dav_size, N_int)
|
||||
call sort_dets_ba_v(dav_det, sorted_(1,1,2), sort_idx_(1,2), shortcut_(0,2), version_(1,1,2), dav_size, N_int)
|
||||
END_PROVIDER
|
||||
END_PROVIDER
|
||||
|
@ -209,6 +209,7 @@ subroutine H_S2_u_0_nstates(v_0,s_0,u_0,H_jj,S2_jj,n,keys_tmp,Nint,N_st,sze_8)
|
||||
integer :: N_st_8
|
||||
|
||||
integer, external :: align_double
|
||||
integer :: workload, blockb, blocke
|
||||
!!!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: vt, ut
|
||||
|
||||
integer(ZMQ_PTR) :: handler
|
||||
@ -242,10 +243,21 @@ subroutine H_S2_u_0_nstates(v_0,s_0,u_0,H_jj,S2_jj,n,keys_tmp,Nint,N_st,sze_8)
|
||||
dav_det = psi_det
|
||||
dav_ut = ut
|
||||
|
||||
workload = 0
|
||||
blockb = shortcut(0,1)
|
||||
blocke = blockb
|
||||
call davidson_init(handler)
|
||||
do sh=shortcut(0,1),1,-1
|
||||
call davidson_add_task(handler, sh)
|
||||
workload += (shortcut(sh+1,1) - shortcut(sh,1))**2
|
||||
if(workload > 1000) then
|
||||
blocke = sh
|
||||
call davidson_add_task(handler, blocke, blockb)
|
||||
blockb = sh-1
|
||||
workload = 0
|
||||
end if
|
||||
enddo
|
||||
|
||||
if(blockb) call davidson_add_task(handler, 1, blockb)
|
||||
|
||||
call davidson_run(handler, v_0, s_0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user