9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-02 02:35:18 +02:00

Fixed memory in pt2 slaves

This commit is contained in:
Anthony Scemama 2019-01-26 10:56:39 +01:00
parent 263b724e1a
commit de1ea90b1e
3 changed files with 37 additions and 14 deletions

View File

@ -15,7 +15,7 @@ END_PROVIDER
e = elec_num - n_core_orb * 2
pt2_n_tasks_max = 1+min((e*(e-1))/2, int(dsqrt(dble(N_det_selectors)))/4)
do i=1,N_det_generators
pt2_F(i) = 1 + int(dble(pt2_n_tasks_max)*maxval(dsqrt(dabs(psi_coef_sorted_gen(i,1:N_states)))))
pt2_F(i) = 1 + int(dble(pt2_n_tasks_max)*dsqrt(dabs(psi_coef_sorted_gen(i,pt2_stoch_istate))))
enddo
END_PROVIDER

View File

@ -161,19 +161,6 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp
ii = min(N_det,(elec_alpha_num*(mo_num-elec_alpha_num))**2)
rss = memory_of_double( &
2*N_int*2*ii & ! minilist, fullminilist
+ N_states*mo_num*mo_num & ! mat
) + memory_of_int( &
+ 2*ii & ! preinteresting, prefullinteresting,
+ 2*ii & ! interesting, fullinteresting
+ mo_num*mo_num/2 & ! banned
+ mo_num/2 & ! bannedOrb
)
call check_mem(rss,irp_here)
monoAdo = .true.
monoBdo = .true.

View File

@ -245,6 +245,42 @@ subroutine run_slave_main
call mpi_print('Entering OpenMP section')
IRP_ENDIF
if (.true.) then
integer :: nproc_target, ii
double precision :: mem_collector, mem, rss
call resident_memory(rss)
nproc_target = nthreads_pt2
ii = min(N_det, (elec_alpha_num*(mo_num-elec_alpha_num))**2)
do
mem = rss + & !
nproc_target * 8.d0 * & ! bytes
( 0.5d0*pt2_n_tasks_max & ! task_id
+ 64.d0*pt2_n_tasks_max & ! task
+ 3.d0*pt2_n_tasks_max*N_states & ! pt2, variance, norm
+ 1.d0*pt2_n_tasks_max & ! i_generator, subset
+ 2.d0*(N_int*2.d0*N_det+ N_det) & ! selection buffers
+ 1.d0*(N_int*2.d0*N_det+ N_det) & ! sort/merge selection buffers
+ 2.0d0*(ii) & ! preinteresting, interesting,
! prefullinteresting, fullinteresting
+ 2.0d0*(N_int*2*ii) & ! minilist, fullminilist
+ 1.0d0*(N_states*mo_num*mo_num) & ! mat
) / 1024.d0**3
if (nproc_target == 0) then
call check_mem(mem,irp_here)
nproc_target = 1
exit
endif
if (mem+rss < qp_max_mem) then
exit
endif
nproc_target = nproc_target - 1
enddo
!$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num()
call run_pt2_slave(0,i,pt2_e0_denominator)