mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 20:34:58 +01:00
Merging TC with cipsi
This commit is contained in:
parent
ce43b16fc0
commit
30096e07ea
@ -31,11 +31,12 @@ subroutine run_pt2_slave(thread,iproc,energy)
|
|||||||
|
|
||||||
double precision, intent(in) :: energy(N_states_diag)
|
double precision, intent(in) :: energy(N_states_diag)
|
||||||
integer, intent(in) :: thread, iproc
|
integer, intent(in) :: thread, iproc
|
||||||
if (N_det > 100000 ) then
|
call run_pt2_slave_large(thread,iproc,energy)
|
||||||
call run_pt2_slave_large(thread,iproc,energy)
|
! if (N_det > 100000 ) then
|
||||||
else
|
! call run_pt2_slave_large(thread,iproc,energy)
|
||||||
call run_pt2_slave_small(thread,iproc,energy)
|
! else
|
||||||
endif
|
! call run_pt2_slave_small(thread,iproc,energy)
|
||||||
|
! endif
|
||||||
end
|
end
|
||||||
|
|
||||||
subroutine run_pt2_slave_small(thread,iproc,energy)
|
subroutine run_pt2_slave_small(thread,iproc,energy)
|
||||||
@ -178,15 +179,12 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
type(pt2_type) :: pt2_data
|
type(pt2_type) :: pt2_data
|
||||||
integer :: n_tasks, k, N
|
integer :: n_tasks, k, N
|
||||||
integer :: i_generator, subset
|
integer :: i_generator, subset
|
||||||
|
integer :: ifirst
|
||||||
|
|
||||||
integer :: bsize ! Size of selection buffers
|
integer :: bsize ! Size of selection buffers
|
||||||
logical :: sending
|
logical :: sending
|
||||||
double precision :: time_shift
|
|
||||||
|
|
||||||
PROVIDE global_selection_buffer global_selection_buffer_lock
|
PROVIDE global_selection_buffer global_selection_buffer_lock
|
||||||
|
|
||||||
call random_number(time_shift)
|
|
||||||
time_shift = time_shift*15.d0
|
|
||||||
|
|
||||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||||
|
|
||||||
@ -198,15 +196,13 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
|
|
||||||
zmq_socket_push = new_zmq_push_socket(thread)
|
zmq_socket_push = new_zmq_push_socket(thread)
|
||||||
|
|
||||||
|
ifirst = 0
|
||||||
b%N = 0
|
b%N = 0
|
||||||
buffer_ready = .False.
|
buffer_ready = .False.
|
||||||
n_tasks = 1
|
n_tasks = 1
|
||||||
|
|
||||||
sending = .False.
|
sending = .False.
|
||||||
done = .False.
|
done = .False.
|
||||||
double precision :: time0, time1
|
|
||||||
call wall_time(time0)
|
|
||||||
time0 = time0+time_shift
|
|
||||||
do while (.not.done)
|
do while (.not.done)
|
||||||
|
|
||||||
integer, external :: get_tasks_from_taskserver
|
integer, external :: get_tasks_from_taskserver
|
||||||
@ -233,28 +229,29 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
ASSERT (b%N == bsize)
|
ASSERT (b%N == bsize)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
double precision :: time0, time1
|
||||||
|
call wall_time(time0)
|
||||||
call pt2_alloc(pt2_data,N_states)
|
call pt2_alloc(pt2_data,N_states)
|
||||||
b%cur = 0
|
b%cur = 0
|
||||||
call select_connected(i_generator,energy,pt2_data,b,subset,pt2_F(i_generator))
|
call select_connected(i_generator,energy,pt2_data,b,subset,pt2_F(i_generator))
|
||||||
|
call wall_time(time1)
|
||||||
|
|
||||||
integer, external :: tasks_done_to_taskserver
|
integer, external :: tasks_done_to_taskserver
|
||||||
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
|
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
|
||||||
done = .true.
|
done = .true.
|
||||||
endif
|
endif
|
||||||
call sort_selection_buffer(b)
|
call sort_selection_buffer(b)
|
||||||
|
|
||||||
call wall_time(time1)
|
|
||||||
! if (time1-time0 > 15.d0) then
|
|
||||||
call omp_set_lock(global_selection_buffer_lock)
|
|
||||||
global_selection_buffer%mini = b%mini
|
|
||||||
call merge_selection_buffers(b,global_selection_buffer)
|
|
||||||
b%cur=0
|
|
||||||
call omp_unset_lock(global_selection_buffer_lock)
|
|
||||||
call wall_time(time0)
|
|
||||||
! endif
|
|
||||||
|
|
||||||
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)
|
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)
|
||||||
if ( iproc == 1 .or. i_generator < 100 .or. done) then
|
call omp_set_lock(global_selection_buffer_lock)
|
||||||
|
global_selection_buffer%mini = b%mini
|
||||||
|
call merge_selection_buffers(b,global_selection_buffer)
|
||||||
|
if (ifirst /= 0 ) then
|
||||||
|
b%cur=0
|
||||||
|
else
|
||||||
|
ifirst = 1
|
||||||
|
endif
|
||||||
|
call omp_unset_lock(global_selection_buffer_lock)
|
||||||
|
if ( iproc == 1 ) then
|
||||||
call omp_set_lock(global_selection_buffer_lock)
|
call omp_set_lock(global_selection_buffer_lock)
|
||||||
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), global_selection_buffer, (/task_id/), 1,sending)
|
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), global_selection_buffer, (/task_id/), 1,sending)
|
||||||
global_selection_buffer%cur = 0
|
global_selection_buffer%cur = 0
|
||||||
|
@ -5,19 +5,22 @@ subroutine run_selection_slave(thread, iproc, energy)
|
|||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
double precision, intent(in) :: energy(N_states)
|
double precision, intent(in) :: energy(N_states)
|
||||||
integer, intent(in) :: thread, iproc
|
integer, intent(in) :: thread, iproc
|
||||||
|
integer :: rc, i
|
||||||
|
|
||||||
integer :: rc, i
|
integer :: worker_id, task_id(1), ctask, ltask
|
||||||
integer :: worker_id, task_id(1), ctask, ltask
|
character*(512) :: task
|
||||||
character*(512) :: task
|
|
||||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
||||||
integer(ZMQ_PTR) :: zmq_socket_push
|
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
||||||
integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket
|
|
||||||
integer(ZMQ_PTR), external :: new_zmq_push_socket
|
integer(ZMQ_PTR), external :: new_zmq_push_socket
|
||||||
type(selection_buffer) :: buf, buf2
|
integer(ZMQ_PTR) :: zmq_socket_push
|
||||||
type(pt2_type) :: pt2_data
|
|
||||||
logical :: done, buffer_ready
|
type(selection_buffer) :: buf, buf2
|
||||||
|
logical :: done, buffer_ready
|
||||||
|
type(pt2_type) :: pt2_data
|
||||||
|
|
||||||
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
|
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
|
||||||
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_tc_order psi_bilinear_matrix_order
|
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_tc_order psi_bilinear_matrix_order
|
||||||
@ -64,7 +67,7 @@ subroutine run_selection_slave(thread, iproc, energy)
|
|||||||
stop '-1'
|
stop '-1'
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
call select_connected(i_generator, energy, pt2_data, buf,subset, pt2_F(i_generator))
|
call select_connected(i_generator, energy, pt2_data, buf, subset, pt2_F(i_generator))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
integer, external :: task_done_to_taskserver
|
integer, external :: task_done_to_taskserver
|
||||||
|
@ -11,7 +11,7 @@ subroutine ZMQ_selection(N_in, pt2_data)
|
|||||||
integer, external :: omp_get_thread_num
|
integer, external :: omp_get_thread_num
|
||||||
type(pt2_type), intent(inout) :: pt2_data
|
type(pt2_type), intent(inout) :: pt2_data
|
||||||
|
|
||||||
PROVIDE psi_det psi_coef N_det qp_max_mem N_states pt2_F s2_eig N_det_generators
|
! PROVIDE psi_det psi_coef N_det qp_max_mem N_states pt2_F s2_eig N_det_generators
|
||||||
|
|
||||||
N = max(N_in,1)
|
N = max(N_in,1)
|
||||||
N = min(N, (elec_alpha_num * (mo_num-elec_alpha_num))**2)
|
N = min(N, (elec_alpha_num * (mo_num-elec_alpha_num))**2)
|
||||||
@ -61,7 +61,6 @@ subroutine ZMQ_selection(N_in, pt2_data)
|
|||||||
ipos=1
|
ipos=1
|
||||||
task = ' '
|
task = ' '
|
||||||
|
|
||||||
|
|
||||||
do i= 1, N_det_generators
|
do i= 1, N_det_generators
|
||||||
do j=1,pt2_F(i)
|
do j=1,pt2_F(i)
|
||||||
write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, i, N
|
write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, i, N
|
||||||
|
@ -65,7 +65,7 @@ subroutine run_selection_slave(thread,iproc,energy)
|
|||||||
stop '-1'
|
stop '-1'
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
call select_connected(i_generator,energy,pt2_data,buf,subset,pt2_F(i_generator))
|
call select_connected(i_generator, energy, pt2_data, buf, subset, pt2_F(i_generator))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
integer, external :: task_done_to_taskserver
|
integer, external :: task_done_to_taskserver
|
||||||
|
Loading…
Reference in New Issue
Block a user