mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-16 17:48:32 +02:00
Merge branch 'garniron-master'
This commit is contained in:
commit
78b453eb73
@ -46,14 +46,16 @@ program fci_zmq
|
|||||||
PROVIDE psi_det_sorted
|
PROVIDE psi_det_sorted
|
||||||
|
|
||||||
call diagonalize_CI
|
call diagonalize_CI
|
||||||
|
call save_wavefunction
|
||||||
|
|
||||||
if (N_det > N_det_max) then
|
if (N_det > N_det_max) then
|
||||||
psi_det = psi_det_sorted
|
psi_det = psi_det_sorted
|
||||||
psi_coef = psi_coef_sorted
|
psi_coef = psi_coef_sorted
|
||||||
N_det = N_det_max
|
N_det = N_det_max
|
||||||
soft_touch N_det psi_det psi_coef
|
soft_touch N_det psi_det psi_coef
|
||||||
endif
|
call diagonalize_CI
|
||||||
call save_wavefunction
|
call save_wavefunction
|
||||||
|
endif
|
||||||
|
|
||||||
print *, 'N_det = ', N_det
|
print *, 'N_det = ', N_det
|
||||||
print *, 'N_states = ', N_states
|
print *, 'N_states = ', N_states
|
||||||
@ -79,11 +81,7 @@ program fci_zmq
|
|||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
||||||
call ezfio_set_full_ci_energy(CI_energy)
|
call ezfio_set_full_ci_energy(CI_energy)
|
||||||
enddo
|
enddo
|
||||||
if (N_det > N_det_max) then
|
|
||||||
N_det = N_det_max
|
|
||||||
touch N_det psi_det psi_coef
|
|
||||||
call diagonalize_CI
|
|
||||||
endif
|
|
||||||
if(do_pt2_end)then
|
if(do_pt2_end)then
|
||||||
print*,'Last iteration only to compute the PT2'
|
print*,'Last iteration only to compute the PT2'
|
||||||
threshold_selectors = 1.d0
|
threshold_selectors = 1.d0
|
||||||
|
@ -4,47 +4,44 @@
|
|||||||
use bitmasks
|
use bitmasks
|
||||||
use f77_zmq
|
use f77_zmq
|
||||||
|
|
||||||
subroutine davidson_process(blockb, blocke, vt, st)
|
subroutine davidson_process(blockb, blocke, N, idx, vt, st, bs)
|
||||||
use f77_zmq
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
|
|
||||||
integer , intent(in) :: blockb, blocke
|
integer , intent(in) :: blockb, blocke, bs
|
||||||
double precision , intent(inout) :: vt(N_states_diag, dav_size)
|
integer , intent(inout) :: N
|
||||||
double precision , intent(inout) :: st(N_states_diag, dav_size)
|
integer , intent(inout) :: idx(bs)
|
||||||
|
double precision , intent(inout) :: vt(N_states_diag, bs)
|
||||||
|
double precision , intent(inout) :: st(N_states_diag, bs)
|
||||||
|
|
||||||
integer :: i, j, sh, sh2, exa, ext, org_i, org_j, istate, ni, endi
|
integer :: i,ii, j, sh, sh2, exa, ext, org_i, org_j, istate, ni, endi
|
||||||
integer(bit_kind) :: sorted_i(N_int)
|
integer(bit_kind) :: sorted_i(N_int)
|
||||||
double precision :: s2, hij
|
double precision :: s2, hij
|
||||||
|
logical, allocatable :: wrotten(:)
|
||||||
|
|
||||||
provide dav_det dav_ut shortcut_
|
|
||||||
!useless calls not to provide in the parallel section
|
allocate(wrotten(bs))
|
||||||
call i_h_j (dav_det(1,1,1),dav_det(1,1,dav_size),n_int,hij)
|
wrotten = .false.
|
||||||
call get_s2(dav_det(1,1,1),dav_det(1,1,dav_size),n_int,s2)
|
|
||||||
!!!!!
|
|
||||||
|
|
||||||
do sh = blockb, blocke
|
do sh = blockb, blocke
|
||||||
do sh2=1,sh
|
do sh2=1,shortcut_(0,1)
|
||||||
exa = 0
|
exa = 0
|
||||||
do ni=1,N_int
|
do ni=1,N_int
|
||||||
exa = exa + popcnt(xor(version_(ni,sh,1), version_(ni,sh2,1)))
|
exa = exa + popcnt(xor(version_(ni,sh,1), version_(ni,sh2,1)))
|
||||||
end do
|
end do
|
||||||
if(exa > 2) then
|
if(exa > 2) cycle
|
||||||
cycle
|
|
||||||
end if
|
|
||||||
|
|
||||||
do i=shortcut_(sh,1),shortcut_(sh+1,1)-1
|
do i=shortcut_(sh,1),shortcut_(sh+1,1)-1
|
||||||
|
ii = i - shortcut_(blockb,1) + 1
|
||||||
|
|
||||||
org_i = sort_idx_(i,1)
|
org_i = sort_idx_(i,1)
|
||||||
if(sh==sh2) then
|
|
||||||
endi = i-1
|
|
||||||
else
|
|
||||||
endi = shortcut_(sh2+1,1)-1
|
|
||||||
end if
|
|
||||||
do ni=1,N_int
|
do ni=1,N_int
|
||||||
sorted_i(ni) = sorted_(ni,i,1)
|
sorted_i(ni) = sorted_(ni,i,1)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
do j=shortcut_(sh2,1),endi
|
do j=shortcut_(sh2,1), shortcut_(sh2+1,1)-1
|
||||||
|
if(i == j) cycle
|
||||||
org_j = sort_idx_(j,1)
|
org_j = sort_idx_(j,1)
|
||||||
ext = exa
|
ext = exa
|
||||||
do ni=1,N_int
|
do ni=1,N_int
|
||||||
@ -53,27 +50,32 @@ subroutine davidson_process(blockb, blocke, vt, st)
|
|||||||
if(ext <= 4) then
|
if(ext <= 4) then
|
||||||
call get_s2(dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,s2)
|
call get_s2(dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,s2)
|
||||||
call i_h_j (dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,hij)
|
call i_h_j (dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,hij)
|
||||||
! call daxpy(N_states_diag,hij,dav_ut(1,org_j),1,vt(1,org_i),1)
|
if(.not. wrotten(ii)) then
|
||||||
! call daxpy(N_states_diag,hij,dav_ut(1,org_i),1,vt(1,org_j),1)
|
wrotten(ii) = .true.
|
||||||
! call daxpy(N_states_diag,s2, dav_ut(1,org_j),1,st(1,org_i),1)
|
idx(ii) = org_i
|
||||||
! call daxpy(N_states_diag,s2, dav_ut(1,org_i),1,st(1,org_j),1)
|
vt (:,ii) = 0d0
|
||||||
|
st (:,ii) = 0d0
|
||||||
|
end if
|
||||||
do istate=1,N_states_diag
|
do istate=1,N_states_diag
|
||||||
vt(istate,org_i) = vt(istate,org_i) + hij*dav_ut(istate,org_j)
|
vt (istate,ii) += hij*dav_ut(istate,org_j)
|
||||||
st(istate,org_i) = st(istate,org_i) + s2 *dav_ut(istate,org_j)
|
st (istate,ii) += s2*dav_ut(istate,org_j)
|
||||||
vt(istate,org_j) = vt(istate,org_j) + hij*dav_ut(istate,org_i)
|
|
||||||
st(istate,org_j) = st(istate,org_j) + s2 *dav_ut(istate,org_i)
|
|
||||||
enddo
|
enddo
|
||||||
|
! call daxpy(N_states_diag,hij,dav_ut(1,org_j),1,vt(1,org_i),1)
|
||||||
|
! call daxpy(N_states_diag,s2, dav_ut(1,org_j),1,st(1,org_i),1)
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
|
||||||
do sh=blockb,min(blocke, shortcut_(0,2))
|
do sh=blockb,min(blocke, shortcut_(0,2))
|
||||||
do sh2=sh, shortcut_(0,2), shortcut_(0,1)
|
do sh2=sh, shortcut_(0,2), shortcut_(0,1)
|
||||||
do i=shortcut_(sh2,2),shortcut_(sh2+1,2)-1
|
do i=shortcut_(sh2,2),shortcut_(sh2+1,2)-1
|
||||||
|
ii += 1
|
||||||
org_i = sort_idx_(i,2)
|
org_i = sort_idx_(i,2)
|
||||||
do j=shortcut_(sh2,2),i-1
|
do j=shortcut_(sh2,2),shortcut_(sh2+1,2)-1
|
||||||
|
if(i == j) cycle
|
||||||
org_j = sort_idx_(j,2)
|
org_j = sort_idx_(j,2)
|
||||||
ext = 0
|
ext = 0
|
||||||
do ni=1,N_int
|
do ni=1,N_int
|
||||||
@ -82,15 +84,17 @@ subroutine davidson_process(blockb, blocke, vt, st)
|
|||||||
if(ext == 4) then
|
if(ext == 4) then
|
||||||
call i_h_j (dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,hij)
|
call i_h_j (dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,hij)
|
||||||
call get_s2(dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,s2)
|
call get_s2(dav_det(1,1,org_j),dav_det(1,1,org_i),n_int,s2)
|
||||||
|
if(.not. wrotten(ii)) then
|
||||||
|
wrotten(ii) = .true.
|
||||||
|
idx(ii) = org_i
|
||||||
|
vt (:,ii) = 0d0
|
||||||
|
st (:,ii) = 0d0
|
||||||
|
end if
|
||||||
! call daxpy(N_states_diag,hij,dav_ut(1,org_j),1,vt(1,org_i),1)
|
! call daxpy(N_states_diag,hij,dav_ut(1,org_j),1,vt(1,org_i),1)
|
||||||
! call daxpy(N_states_diag,hij,dav_ut(1,org_i),1,vt(1,org_j),1)
|
|
||||||
! call daxpy(N_states_diag,s2, dav_ut(1,org_j),1,st(1,org_i),1)
|
! call daxpy(N_states_diag,s2, dav_ut(1,org_j),1,st(1,org_i),1)
|
||||||
! call daxpy(N_states_diag,s2, dav_ut(1,org_i),1,st(1,org_j),1)
|
|
||||||
do istate=1,N_states_diag
|
do istate=1,N_states_diag
|
||||||
vt (istate,org_i) = vt (istate,org_i) + hij*dav_ut(istate,org_j)
|
vt (istate,ii) += hij*dav_ut(istate,org_j)
|
||||||
vt (istate,org_j) = vt (istate,org_j) + hij*dav_ut(istate,org_i)
|
st (istate,ii) += s2*dav_ut(istate,org_j)
|
||||||
st (istate,org_i) = st (istate,org_i) + s2*dav_ut(istate,org_j)
|
|
||||||
st (istate,org_j) = st (istate,org_j) + s2*dav_ut(istate,org_i)
|
|
||||||
enddo
|
enddo
|
||||||
end if
|
end if
|
||||||
end do
|
end do
|
||||||
@ -98,6 +102,16 @@ subroutine davidson_process(blockb, blocke, vt, st)
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
N=0
|
||||||
|
do i=1,bs
|
||||||
|
if(wrotten(i)) then
|
||||||
|
N += 1
|
||||||
|
idx(N) = idx(i)
|
||||||
|
vt(:,N) = vt(:,i)
|
||||||
|
st(:,N) = st(:,i)
|
||||||
|
end if
|
||||||
|
end do
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
@ -183,12 +197,6 @@ subroutine davidson_slave_inproc(i)
|
|||||||
call davidson_run_slave(1,i)
|
call davidson_run_slave(1,i)
|
||||||
end
|
end
|
||||||
|
|
||||||
integer function davidson_slave_inproc_omp()
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
call davidson_run_slave(1,2)
|
|
||||||
davidson_slave_inproc_omp = 0
|
|
||||||
end subroutine
|
|
||||||
|
|
||||||
subroutine davidson_slave_tcp(i)
|
subroutine davidson_slave_tcp(i)
|
||||||
implicit none
|
implicit none
|
||||||
@ -241,8 +249,7 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, worker_id)
|
|||||||
integer(ZMQ_PTR),intent(in) :: zmq_to_qp_run_socket
|
integer(ZMQ_PTR),intent(in) :: zmq_to_qp_run_socket
|
||||||
integer(ZMQ_PTR),intent(in) :: zmq_socket_push
|
integer(ZMQ_PTR),intent(in) :: zmq_socket_push
|
||||||
integer,intent(in) :: worker_id
|
integer,intent(in) :: worker_id
|
||||||
integer :: i, taskn, myTask, istate
|
integer :: task_id
|
||||||
integer, allocatable :: task_id(:)
|
|
||||||
character*(512) :: task
|
character*(512) :: task
|
||||||
|
|
||||||
|
|
||||||
@ -252,60 +259,43 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, worker_id)
|
|||||||
double precision , allocatable :: vt(:,:)
|
double precision , allocatable :: vt(:,:)
|
||||||
double precision , allocatable :: st(:,:)
|
double precision , allocatable :: st(:,:)
|
||||||
|
|
||||||
allocate(task_id(100))
|
integer :: bs, i, j
|
||||||
allocate(idx(dav_size))
|
|
||||||
allocate(vt(N_states_diag, dav_size))
|
|
||||||
allocate(st(N_states_diag, dav_size))
|
|
||||||
|
|
||||||
vt = 0d0
|
allocate(idx(1), vt(1,1), st(1,1))
|
||||||
st = 0d0
|
|
||||||
taskn = 0
|
|
||||||
|
|
||||||
do
|
do
|
||||||
call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, myTask, task)
|
call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task)
|
||||||
if(myTask /= 0) then
|
if(task_id == 0) exit
|
||||||
read (task,*) blockb, blocke
|
read (task,*) blockb, blocke
|
||||||
call davidson_process(blockb, blocke, vt, st)
|
bs = shortcut_(blocke+1,1) - shortcut_(blockb, 1)
|
||||||
taskn += 1
|
do i=blockb, shortcut_(0,2), shortcut_(0,1)
|
||||||
task_id(taskn) = myTask
|
do j=i, min(i+blocke-blockb, shortcut_(0,2))
|
||||||
|
bs += shortcut_(j+1,2) - shortcut_(j, 2)
|
||||||
|
end do
|
||||||
|
end do
|
||||||
|
if(bs > size(idx)) then
|
||||||
|
deallocate(idx, vt, st)
|
||||||
|
allocate(idx(bs))
|
||||||
|
allocate(vt(N_states_diag, bs))
|
||||||
|
allocate(st(N_states_diag, bs))
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
call davidson_process(blockb, blocke, N, idx, vt, st, bs)
|
||||||
|
|
||||||
if(myTask == 0 .or. taskn == size(task_id)) then
|
call task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id)
|
||||||
N = 0
|
call davidson_push_results(zmq_socket_push, blockb, blocke, N, idx, vt, st, task_id)
|
||||||
do i=1, dav_size
|
|
||||||
if(vt(1,i) /= 0d0 .or. st(1,i) /= 0d0) then
|
|
||||||
N = N+1
|
|
||||||
do istate=1,N_states_diag
|
|
||||||
vt (istate,N) = vt (istate,i)
|
|
||||||
st (istate,N) = st (istate,i)
|
|
||||||
idx(N) = i
|
|
||||||
enddo
|
|
||||||
end if
|
|
||||||
end do
|
|
||||||
|
|
||||||
do i = 1, taskn
|
|
||||||
call task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id(i))
|
|
||||||
end do
|
|
||||||
if(taskn /= 0) call davidson_push_results(zmq_socket_push, blockb, blocke, N, idx, vt, st, taskn, task_id)
|
|
||||||
|
|
||||||
if(myTask == 0) exit
|
|
||||||
vt = 0d0
|
|
||||||
st = 0d0
|
|
||||||
taskn = 0
|
|
||||||
end if
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subroutine davidson_push_results(zmq_socket_push, blockb, blocke, N, idx, vt, st, taskn, task_id)
|
subroutine davidson_push_results(zmq_socket_push, blockb, blocke, N, idx, vt, st, task_id)
|
||||||
use f77_zmq
|
use f77_zmq
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer(ZMQ_PTR) ,intent(in) :: zmq_socket_push
|
integer(ZMQ_PTR) ,intent(in) :: zmq_socket_push
|
||||||
integer ,intent(in) :: task_id(100), taskn
|
integer ,intent(in) :: task_id
|
||||||
|
|
||||||
integer ,intent(in) :: blockb, blocke
|
integer ,intent(in) :: blockb, blocke
|
||||||
integer ,intent(in) :: N
|
integer ,intent(in) :: N
|
||||||
@ -332,26 +322,23 @@ subroutine davidson_push_results(zmq_socket_push, blockb, blocke, N, idx, vt, st
|
|||||||
rc = f77_zmq_send( zmq_socket_push, st, 8*N_states_diag* N, ZMQ_SNDMORE)
|
rc = f77_zmq_send( zmq_socket_push, st, 8*N_states_diag* N, ZMQ_SNDMORE)
|
||||||
if(rc /= 8*N_states_diag* N) stop "davidson_push_results failed to push st"
|
if(rc /= 8*N_states_diag* N) stop "davidson_push_results failed to push st"
|
||||||
|
|
||||||
rc = f77_zmq_send( zmq_socket_push, taskn, 4, ZMQ_SNDMORE)
|
rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0)
|
||||||
if(rc /= 4) stop "davidson_push_results failed to push taskn"
|
if(rc /= 4) stop "davidson_push_results failed to push task_id"
|
||||||
|
|
||||||
rc = f77_zmq_send( zmq_socket_push, task_id, 4*taskn, 0)
|
|
||||||
if(rc /= 4*taskn) stop "davidson_push_results failed to push task_id"
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subroutine davidson_pull_results(zmq_socket_pull, blockb, blocke, N, idx, vt, st, taskn, task_id)
|
subroutine davidson_pull_results(zmq_socket_pull, blockb, blocke, N, idx, vt, st, task_id)
|
||||||
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
|
||||||
integer ,intent(out) :: task_id(100), taskn
|
integer ,intent(out) :: task_id
|
||||||
integer ,intent(out) :: blockb, blocke
|
integer ,intent(out) :: blockb, blocke
|
||||||
integer ,intent(out) :: N
|
integer ,intent(out) :: N
|
||||||
integer ,intent(out) :: idx(dav_size)
|
integer ,intent(out) :: idx(*)
|
||||||
double precision ,intent(out) :: vt(N_states_diag, dav_size)
|
double precision ,intent(out) :: vt(N_states_diag, *)
|
||||||
double precision ,intent(out) :: st(N_states_diag, dav_size)
|
double precision ,intent(out) :: st(N_states_diag, *)
|
||||||
|
|
||||||
integer :: rc
|
integer :: rc
|
||||||
|
|
||||||
@ -373,11 +360,8 @@ subroutine davidson_pull_results(zmq_socket_pull, blockb, blocke, N, idx, vt, st
|
|||||||
rc = f77_zmq_recv( zmq_socket_pull, st, 8*N_states_diag* N, 0)
|
rc = f77_zmq_recv( zmq_socket_pull, st, 8*N_states_diag* N, 0)
|
||||||
if(rc /= 8*N_states_diag* N) stop "davidson_push_results failed to pull st"
|
if(rc /= 8*N_states_diag* N) stop "davidson_push_results failed to pull st"
|
||||||
|
|
||||||
rc = f77_zmq_recv( zmq_socket_pull, taskn, 4, 0)
|
rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0)
|
||||||
if(rc /= 4) stop "davidson_pull_results failed to pull taskn"
|
if(rc /= 4) stop "davidson_pull_results failed to pull task_id"
|
||||||
|
|
||||||
rc = f77_zmq_recv( zmq_socket_pull, task_id, 4*taskn, 0)
|
|
||||||
if(rc /= 4*taskn) stop "davidson_pull_results failed to pull task_id"
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
@ -393,7 +377,7 @@ subroutine davidson_collector(zmq_to_qp_run_socket, zmq_socket_pull , v0, s0, LD
|
|||||||
double precision ,intent(inout) :: v0(LDA, N_states_diag)
|
double precision ,intent(inout) :: v0(LDA, N_states_diag)
|
||||||
double precision ,intent(inout) :: s0(LDA, N_states_diag)
|
double precision ,intent(inout) :: s0(LDA, N_states_diag)
|
||||||
|
|
||||||
integer :: more, task_id(100), taskn
|
integer :: more, task_id, taskn
|
||||||
|
|
||||||
integer :: blockb, blocke
|
integer :: blockb, blocke
|
||||||
integer :: N
|
integer :: N
|
||||||
@ -401,11 +385,12 @@ subroutine davidson_collector(zmq_to_qp_run_socket, zmq_socket_pull , v0, s0, LD
|
|||||||
double precision , allocatable :: vt(:,:), v0t(:,:), s0t(:,:)
|
double precision , allocatable :: vt(:,:), v0t(:,:), s0t(:,:)
|
||||||
double precision , allocatable :: st(:,:)
|
double precision , allocatable :: st(:,:)
|
||||||
|
|
||||||
integer :: i,j
|
integer :: msize
|
||||||
|
|
||||||
allocate(idx(dav_size))
|
msize = (max_workload + max_blocksize)*2
|
||||||
allocate(vt(N_states_diag, dav_size))
|
allocate(idx(msize))
|
||||||
allocate(st(N_states_diag, dav_size))
|
allocate(vt(N_states_diag, msize))
|
||||||
|
allocate(st(N_states_diag, msize))
|
||||||
allocate(v0t(N_states_diag, dav_size))
|
allocate(v0t(N_states_diag, dav_size))
|
||||||
allocate(s0t(N_states_diag, dav_size))
|
allocate(s0t(N_states_diag, dav_size))
|
||||||
|
|
||||||
@ -415,19 +400,14 @@ subroutine davidson_collector(zmq_to_qp_run_socket, zmq_socket_pull , v0, s0, LD
|
|||||||
more = 1
|
more = 1
|
||||||
|
|
||||||
do while (more == 1)
|
do while (more == 1)
|
||||||
call davidson_pull_results(zmq_socket_pull, blockb, blocke, N, idx, vt, st, taskn, task_id)
|
call davidson_pull_results(zmq_socket_pull, blockb, blocke, N, idx, vt, st, task_id)
|
||||||
|
|
||||||
!DIR$ FORCEINLINE
|
!DIR$ FORCEINLINE
|
||||||
call davidson_collect(blockb, blocke, N, idx, vt, st , v0t, s0t)
|
call davidson_collect(blockb, blocke, N, idx, vt, st , v0t, s0t)
|
||||||
do i=1,taskn
|
call zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more)
|
||||||
call zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id(i),more)
|
|
||||||
end do
|
|
||||||
end do
|
end do
|
||||||
deallocate(idx,vt,st)
|
deallocate(idx,vt,st)
|
||||||
|
|
||||||
! call dtranspose(v0t,size(v0t,1), v0, size(v0,1), N_states_diag, dav_size)
|
integer :: i,j
|
||||||
! call dtranspose(s0t,size(s0t,1), s0, size(s0,1), N_states_diag, dav_size)
|
|
||||||
|
|
||||||
!DIR$ IVDEP
|
!DIR$ IVDEP
|
||||||
do j=1,N_states_diag
|
do j=1,N_states_diag
|
||||||
!DIR$ IVDEP
|
!DIR$ IVDEP
|
||||||
@ -451,8 +431,6 @@ subroutine davidson_run(zmq_to_qp_run_socket , v0, s0, LDA)
|
|||||||
integer(ZMQ_PTR) :: zmq_collector
|
integer(ZMQ_PTR) :: zmq_collector
|
||||||
integer(ZMQ_PTR), external :: new_zmq_pull_socket
|
integer(ZMQ_PTR), external :: new_zmq_pull_socket
|
||||||
integer(ZMQ_PTR) :: zmq_socket_pull
|
integer(ZMQ_PTR) :: zmq_socket_pull
|
||||||
integer(ZMQ_PTR) :: pthread_slave, pthread_miniserver
|
|
||||||
|
|
||||||
|
|
||||||
integer :: i
|
integer :: i
|
||||||
integer, external :: omp_get_thread_num
|
integer, external :: omp_get_thread_num
|
||||||
@ -464,11 +442,11 @@ subroutine davidson_run(zmq_to_qp_run_socket , v0, s0, LDA)
|
|||||||
|
|
||||||
zmq_collector = new_zmq_to_qp_run_socket()
|
zmq_collector = new_zmq_to_qp_run_socket()
|
||||||
zmq_socket_pull = new_zmq_pull_socket()
|
zmq_socket_pull = new_zmq_pull_socket()
|
||||||
|
i = omp_get_thread_num()
|
||||||
|
|
||||||
|
|
||||||
PROVIDE nproc
|
PROVIDE nproc
|
||||||
|
|
||||||
|
|
||||||
!$OMP PARALLEL NUM_THREADS(nproc+2) PRIVATE(i)
|
!$OMP PARALLEL NUM_THREADS(nproc+2) PRIVATE(i)
|
||||||
i = omp_get_thread_num()
|
i = omp_get_thread_num()
|
||||||
if (i == 0 ) then
|
if (i == 0 ) then
|
||||||
@ -487,6 +465,7 @@ subroutine davidson_run(zmq_to_qp_run_socket , v0, s0, LDA)
|
|||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subroutine davidson_miniserver_run()
|
subroutine davidson_miniserver_run()
|
||||||
use f77_zmq
|
use f77_zmq
|
||||||
implicit none
|
implicit none
|
||||||
@ -591,7 +570,11 @@ END_PROVIDER
|
|||||||
&BEGIN_PROVIDER [ integer(bit_kind), version_, (N_int, dav_size, 2) ]
|
&BEGIN_PROVIDER [ integer(bit_kind), version_, (N_int, dav_size, 2) ]
|
||||||
&BEGIN_PROVIDER [ integer(bit_kind), sorted_, (N_int, dav_size, 2) ]
|
&BEGIN_PROVIDER [ integer(bit_kind), sorted_, (N_int, dav_size, 2) ]
|
||||||
&BEGIN_PROVIDER [ integer, sort_idx_, (dav_size, 2) ]
|
&BEGIN_PROVIDER [ integer, sort_idx_, (dav_size, 2) ]
|
||||||
|
&BEGIN_PROVIDER [ integer, max_blocksize ]
|
||||||
implicit none
|
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_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)
|
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)
|
||||||
|
max_blocksize = max(shortcut_(0,1), shortcut_(0,2))
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,13 +240,14 @@ subroutine H_S2_u_0_nstates(v_0,s_0,u_0,H_jj,S2_jj,n,keys_tmp,Nint,N_st,sze_8)
|
|||||||
call davidson_init(handler,n,N_st_8,ut)
|
call davidson_init(handler,n,N_st_8,ut)
|
||||||
do sh=shortcut(0,1),1,-1
|
do sh=shortcut(0,1),1,-1
|
||||||
workload += (shortcut(sh+1,1) - shortcut(sh,1))**2
|
workload += (shortcut(sh+1,1) - shortcut(sh,1))**2
|
||||||
if(workload > 1000) then
|
if(workload > max_workload) then
|
||||||
blocke = sh
|
blocke = sh
|
||||||
call davidson_add_task(handler, blocke, blockb)
|
call davidson_add_task(handler, blocke, blockb)
|
||||||
blockb = sh-1
|
blockb = sh-1
|
||||||
workload = 0
|
workload = 0
|
||||||
end if
|
end if
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
if(blockb > 0) call davidson_add_task(handler, 1, blockb)
|
if(blockb > 0) call davidson_add_task(handler, 1, blockb)
|
||||||
call davidson_run(handler, v_0, s_0, size(v_0,1))
|
call davidson_run(handler, v_0, s_0, size(v_0,1))
|
||||||
|
|
||||||
@ -260,3 +261,9 @@ subroutine H_S2_u_0_nstates(v_0,s_0,u_0,H_jj,S2_jj,n,keys_tmp,Nint,N_st,sze_8)
|
|||||||
deallocate(ut)
|
deallocate(ut)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ integer, max_workload ]
|
||||||
|
max_workload = 1000
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user