Tuned pt2_F

This commit is contained in:
Anthony Scemama 2019-01-28 11:51:38 +01:00
parent 89d3f6312d
commit 0c88a04ec8
7 changed files with 24 additions and 8 deletions

View File

@ -50,7 +50,7 @@ let zmq_context =
Zmq.Context.create ()
let () =
Zmq.Context.set_io_threads zmq_context 8
Zmq.Context.set_io_threads zmq_context 16
let bind_socket ~socket_type ~socket ~port =

View File

@ -13,9 +13,9 @@ END_PROVIDER
integer :: i
integer :: e
e = elec_num - n_core_orb * 2
pt2_n_tasks_max = 1+min((e*(e-1))/2, int(dsqrt(dble(N_det_selectors)))/4)
pt2_n_tasks_max = 1+min((e*(e-1)), int(dsqrt(dble(N_det_selectors)))/10)
do i=1,N_det_generators
pt2_F(i) = 1 + int(dble(pt2_n_tasks_max)*dsqrt(dabs(psi_coef_sorted_gen(i,pt2_stoch_istate))))
pt2_F(i) = 1 + int(dble(pt2_n_tasks_max)*dabs(maxval(psi_coef_sorted_gen(i,:)))**(0.75d0))
enddo
END_PROVIDER
@ -120,7 +120,11 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp psi_det_sorted
PROVIDE psi_det_hii
if (s2_eig) then
PROVIDE psi_occ_pattern_hii det_to_occ_pattern
endif
if (N_det < max(10,N_states)) then
pt2=0.d0

View File

@ -93,7 +93,7 @@ subroutine run_pt2_slave(thread,iproc,energy)
!print *, i_generator(1), time1-time2, n_tasks, pt2_F(i_generator(1))
enddo
call wall_time(time1)
!print *, i_generator(1), time1-time0, n_tasks
!print *, '-->', i_generator(1), time1-time0, n_tasks
integer, external :: tasks_done_to_taskserver
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then

View File

@ -1266,4 +1266,4 @@ subroutine bitstring_to_list_in_selection( string, list, n_elements, Nint)
enddo
end
!

View File

@ -279,6 +279,11 @@ subroutine run_slave_main
print *, 'pt2_stoch_istate', pt2_stoch_istate
print *, 'state_average_weight', state_average_weight
print *, 'Number of threads', nproc_target
PROVIDE psi_det_hii
if (s2_eig) then
PROVIDE psi_occ_pattern_hii det_to_occ_pattern
endif
endif
!$OMP PARALLEL PRIVATE(i) NUM_THREADS(nproc_target+1)

View File

@ -877,9 +877,11 @@ BEGIN_PROVIDER [ double precision, psi_det_Hii, (N_det) ]
END_DOC
integer :: i,j
double precision, external :: diag_H_mat_elem
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i)
do i=1,N_det
psi_det_Hii(i) = diag_H_mat_elem(psi_det(1,1,i),N_int)
enddo
!$OMP END PARALLEL DO
END_PROVIDER

View File

@ -408,11 +408,13 @@ subroutine make_s2_eigenfunction
integer :: N_det_new, ithread, omp_get_thread_num
integer, parameter :: bufsze = 1000
logical, external :: is_in_wavefunction
logical :: update
update=.False.
call write_int(6,N_occ_pattern,'Number of occupation patterns')
!$OMP PARALLEL DEFAULT(NONE) &
!$OMP SHARED(N_occ_pattern, psi_occ_pattern, elec_alpha_num,N_int) &
!$OMP SHARED(N_occ_pattern, psi_occ_pattern, elec_alpha_num,N_int,update) &
!$OMP PRIVATE(s,ithread, d, det_buffer, smax, N_det_new,i,j,k)
N_det_new = 0
call occ_pattern_to_dets_size(psi_occ_pattern(1,1,1),s,elec_alpha_num,N_int)
@ -434,6 +436,7 @@ subroutine make_s2_eigenfunction
if ( is_in_wavefunction(d(1,1,j), N_int) ) then
cycle
endif
update = .true.
N_det_new += 1
det_buffer(:,:,N_det_new) = d(:,:,j)
if (N_det_new == bufsze) then
@ -451,8 +454,10 @@ subroutine make_s2_eigenfunction
deallocate(d,det_buffer)
!$OMP END PARALLEL
call copy_H_apply_buffer_to_wf
SOFT_TOUCH N_det psi_coef psi_det psi_occ_pattern N_occ_pattern
if (update) then
call copy_H_apply_buffer_to_wf
TOUCH N_det psi_coef psi_det psi_occ_pattern N_occ_pattern
endif
call write_time(6)
end