mirror of
https://github.com/nwchemgit/nwchem.git
synced 2026-07-29 06:35:39 -04:00
check memory for mirroring
This commit is contained in:
parent
222f9a0aad
commit
b556e5f295
2 changed files with 56 additions and 7 deletions
|
|
@ -54,6 +54,8 @@ c
|
|||
integer g_ta_mirr,g_tb_mirr,g_ta_org,g_tb_org
|
||||
logical util_mirrmat,tuhfreplicated
|
||||
external util_mirrmat
|
||||
integer util_mirrmem,mem_mirr
|
||||
external util_mirrmem
|
||||
c
|
||||
integer l_ia_uv, k_ia_uv, l_tmp, k_tmp, l_ia_jb, k_ia_jb
|
||||
double precision ddot
|
||||
|
|
@ -89,14 +91,23 @@ c
|
|||
$ call errquit('could not alloc ga for T_b',1, GA_ERR)
|
||||
if (.not.rtdb_get(rtdb, 'mp2:tuhfreplicated', mt_log, 1,
|
||||
T tuhfreplicated)) tuhfreplicated=.true.
|
||||
do_mirra=.false.
|
||||
do_mirrb=.false.
|
||||
if(tuhfreplicated) then
|
||||
do_mirra=util_mirrmat(1,g_t_a,g_ta_mirr,
|
||||
D .false., .true.)
|
||||
do_mirrb=util_mirrmat(1,g_t_b,g_tb_mirr,
|
||||
D .false., .true.)
|
||||
else
|
||||
do_mirra=.false.
|
||||
do_mirrb=.false.
|
||||
mem_mirr=
|
||||
M util_mirrmem(1,g_t_a)+
|
||||
M util_mirrmem(1,g_t_b)
|
||||
if(ga_nodeid().eq.0) then
|
||||
write(6,14) ' needed by mirroring: ', mem_mirr
|
||||
write(6,14) ' ga_memory_avail() : ', ga_memory_avail()
|
||||
endif
|
||||
14 format(a,i10,' bytes')
|
||||
if(ga_memory_avail().gt. mem_mirr) then
|
||||
do_mirra=util_mirrmat(1,g_t_a,g_ta_mirr,
|
||||
D .false., .true.)
|
||||
do_mirrb=util_mirrmat(1,g_t_b,g_tb_mirr,
|
||||
D .false., .true.)
|
||||
endif
|
||||
endif
|
||||
if(do_mirra.and.do_mirrb) then
|
||||
if(ga_nodeid().eq.0)
|
||||
|
|
|
|||
|
|
@ -136,3 +136,41 @@ c
|
|||
call util_mirrstop(g_densdis)
|
||||
return
|
||||
end
|
||||
integer function util_mirrmem(nmat,g_a)
|
||||
implicit none
|
||||
#include "global.fh"
|
||||
#include "mafdecls.fh"
|
||||
integer g_a(*)
|
||||
integer nmat
|
||||
c
|
||||
integer ppn
|
||||
integer nbytes,i,imat
|
||||
integer maxdim
|
||||
parameter(maxdim=10)
|
||||
integer type, dims(maxdim),ndim
|
||||
util_mirrmem=0
|
||||
call util_getppn(ppn)
|
||||
do imat=1,nmat
|
||||
call nga_inquire(g_a(imat), type, ndim, dims)
|
||||
if(ndim.gt.maxdim) call errquit(
|
||||
Q ' mirrmem: increase maxdim to ',ndim,0)
|
||||
#if 1
|
||||
if(ga_nodeid().eq.0) then
|
||||
write(0,123) ga_nodeid(), ' ndim ',ndim,' dims ',
|
||||
D (dims(i),i=1,ndim)
|
||||
endif
|
||||
123 format(I2,A,I2,A,3I4)
|
||||
#endif
|
||||
nbytes=1
|
||||
do i=1,ndim
|
||||
nbytes=nbytes*dims(i)
|
||||
enddo
|
||||
nbytes=ma_sizeof(mt_dbl,1,mt_byte)*nbytes
|
||||
util_mirrmem=util_mirrmem+nbytes
|
||||
enddo
|
||||
if(ga_nnodes().ne.1) then
|
||||
c divide by ppn & round it by 30%
|
||||
util_mirrmem=(util_mirrmem*130)/(ppn*100)
|
||||
endif
|
||||
return
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue