10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-25 05:43:47 +01:00

Adjust ntasks with time

This commit is contained in:
Anthony Scemama 2018-06-06 13:09:30 +02:00
parent c8ee603667
commit 535a3402d8
3 changed files with 22 additions and 6 deletions

View File

@ -46,13 +46,14 @@ subroutine run_pt2_slave(thread,iproc,energy)
zmq_socket_push = new_zmq_push_socket(thread)
buf%N = 0
n_tasks = 0
n_tasks = 1
call create_selection_buffer(0, 0, buf)
done = .False.
do while (.not.done)
n_tasks = min(n_tasks+1,n_tasks_max)
n_tasks = max(1,n_tasks)
n_tasks = min(n_tasks,n_tasks_max)
integer, external :: get_tasks_from_taskserver
if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then
@ -66,16 +67,23 @@ subroutine run_pt2_slave(thread,iproc,energy)
read (task(k),*) subset(k), i_generator(k)
enddo
double precision :: time0, time1
call wall_time(time0)
do k=1,n_tasks
pt2(:,k) = 0.d0
buf%cur = 0
call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k))
enddo
call wall_time(time1)
integer, external :: tasks_done_to_taskserver
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
done = .true.
endif
call push_pt2_results(zmq_socket_push, i_generator, pt2, task_id, n_tasks)
! Try to adjust n_tasks around 10 seconds per job
n_tasks = int(10.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9))+1
end do
integer, external :: disconnect_from_taskserver

View File

@ -50,12 +50,13 @@ subroutine run_selection_slave_new(thread,iproc,energy)
zmq_socket_push = new_zmq_push_socket(thread)
buf%N = 0
n_tasks = 0
n_tasks = 1
call create_selection_buffer(0, 0, buf)
done = .False.
do while (.not.done)
n_tasks = min(n_tasks+1,n_tasks_max)
n_tasks = max(1,n_tasks)
n_tasks = min(n_tasks,n_tasks_max)
integer, external :: get_tasks_from_taskserver
if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then
@ -76,11 +77,15 @@ subroutine run_selection_slave_new(thread,iproc,energy)
buffer_ready = .True.
endif
double precision :: time0, time1
call wall_time(time0)
do k=1,n_tasks
pt2(:,k) = 0.d0
buf%cur = 0
call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k))
enddo
call wall_time(time1)
integer, external :: tasks_done_to_taskserver
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
done = .true.
@ -91,6 +96,9 @@ subroutine run_selection_slave_new(thread,iproc,energy)
buf%mini = buf2%mini
pt2(:,:) = 0d0
buf%cur = 0
! Try to adjust n_tasks around 10 seconds per job
n_tasks = int(10.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9))+1
end do
integer, external :: disconnect_from_taskserver

View File

@ -72,7 +72,7 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d
call davidson_diag_hjj_sjj(dets_in,u_in,H_jj,S2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state,converged)
N_st_diag_local = N_st_diag
do while (.not.converged)
N_st_diag_local += N_states
N_st_diag_local = 2 * N_st_diag_local
allocate (energies_local(N_st_diag_local), s2_out_local(N_st_diag_local), u_in_local(sze,N_st_diag_local))
u_in_local(1:sze,1:N_st_diag) = u_in(1:sze,1:N_st_diag)
call davidson_diag_hjj_sjj(dets_in,u_in_local,H_jj,s2_out_local,energies_local,dim_in,sze,N_st,N_st_diag_local,Nint,dressing_state,converged)
@ -237,7 +237,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
do while (.not.converged)
itertot = itertot+1
if (itertot == 5) then
if (itertot == 8) then
exit
endif