10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-28 08:02:33 +02:00

Better handling of pt2 tasks

This commit is contained in:
Anthony Scemama 2019-02-03 17:30:28 +01:00
parent ca26262907
commit dd14a4f50d
3 changed files with 26 additions and 12 deletions

View File

@ -10,13 +10,20 @@ END_PROVIDER
&BEGIN_PROVIDER [ integer, pt2_n_tasks_max ] &BEGIN_PROVIDER [ integer, pt2_n_tasks_max ]
implicit none implicit none
logical, external :: testTeethBuilding logical, external :: testTeethBuilding
integer :: i integer :: i,j
integer :: e pt2_n_tasks_max = elec_beta_num*elec_beta_num + elec_alpha_num*elec_beta_num - n_core_orb*2
e = elec_num - n_core_orb * 2 pt2_n_tasks_max = min(pt2_n_tasks_max,1+N_det_generators/10000)
pt2_n_tasks_max = 1+min((e*(e-1)), int(dsqrt(dble(N_det_selectors)))/10) call write_int(6,pt2_n_tasks_max,'pt2_n_tasks_max')
do i=1,N_det_generators
pt2_F(i) = 1 + int(dble(pt2_n_tasks_max)*dabs(maxval(psi_coef_sorted_gen(i,:)))**(0.75d0)) pt2_F(:) = int(sqrt(float(pt2_n_tasks_max)))
do i=1,pt2_n_0(pt2_N_teeth/4)
pt2_F(i) = pt2_n_tasks_max
enddo enddo
do i=pt2_n_0(pt2_N_teeth-pt2_N_teeth/4), N_det_generators
pt2_F(i) = 1
enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer, pt2_N_teeth ] BEGIN_PROVIDER [ integer, pt2_N_teeth ]
@ -29,7 +36,7 @@ END_PROVIDER
pt2_N_teeth = 1 pt2_N_teeth = 1
else else
pt2_minDetInFirstTeeth = min(5, N_det_generators) pt2_minDetInFirstTeeth = min(5, N_det_generators)
do pt2_N_teeth=100,2,-1 do pt2_N_teeth=400,2,-1
if(testTeethBuilding(pt2_minDetInFirstTeeth, pt2_N_teeth)) exit if(testTeethBuilding(pt2_minDetInFirstTeeth, pt2_N_teeth)) exit
end do end do
end if end if
@ -74,10 +81,14 @@ logical function testTeethBuilding(minF, N)
n0 = 0 n0 = 0
testTeethBuilding = .false. testTeethBuilding = .false.
double precision :: f
integer :: minFN
minFN = N_det_generators - minF * N
f = 1.d0/dble(N)
do do
u0 = tilde_cW(n0) u0 = tilde_cW(n0)
r = tilde_cW(n0 + minF) r = tilde_cW(n0 + minF)
Wt = (1d0 - u0) / dble(N) Wt = (1d0 - u0) * f
if (dabs(Wt) <= 1.d-3) then if (dabs(Wt) <= 1.d-3) then
return return
endif endif
@ -86,7 +97,8 @@ logical function testTeethBuilding(minF, N)
return return
end if end if
n0 += 1 n0 += 1
if(N_det_generators - n0 < minF * N) then ! if(N_det_generators - n0 < minF * N) then
if(n0 > minFN) then
return return
end if end if
end do end do

View File

@ -54,7 +54,6 @@ subroutine run_pt2_slave(thread,iproc,energy)
sending = .False. sending = .False.
done = .False. done = .False.
n_tasks = 1
do while (.not.done) do while (.not.done)
n_tasks = max(1,n_tasks) n_tasks = max(1,n_tasks)
@ -108,7 +107,8 @@ subroutine run_pt2_slave(thread,iproc,energy)
b%cur=0 b%cur=0
! Try to adjust n_tasks around nproc/2 seconds per job ! Try to adjust n_tasks around nproc/2 seconds per job
n_tasks = min(2*n_tasks,int( dble(n_tasks * nproc/2) / (time1 - time0 + 1.d0))) ! n_tasks = min(2*n_tasks,int( dble(n_tasks * nproc/2) / (time1 - time0 + 1.d0)))
n_tasks = 1
end do end do
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending) call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)

View File

@ -202,6 +202,8 @@ subroutine diagonalize_CI
psi_coef(i,j) = CI_eigenvectors(i,j) psi_coef(i,j) = CI_eigenvectors(i,j)
enddo enddo
enddo enddo
psi_energy(1:N_states) = CI_electronic_energy(1:N_states)
psi_s2(1:N_states) = CI_s2(1:N_states)
SOFT_TOUCH psi_coef CI_electronic_energy CI_energy CI_eigenvectors CI_s2 SOFT_TOUCH psi_coef CI_electronic_energy CI_energy CI_eigenvectors CI_s2 psi_energy psi_s2
end end