Improve communication and speed between cd_inloc and hash_init

fix-hash
sfilippone 1 year ago
parent f5b1661e14
commit ecef7d8653

@ -1218,10 +1218,8 @@ contains
integer(psb_ipk_) :: iam, np integer(psb_ipk_) :: iam, np
integer(psb_ipk_) :: i, nlu, nl, int_err(5) integer(psb_ipk_) :: i, nlu, nl, int_err(5)
integer(psb_lpk_) :: m, nrt integer(psb_lpk_) :: m, nrt
integer(psb_lpk_), allocatable :: vlu(:)
integer(psb_lpk_), allocatable :: ix(:)
character(len=20), parameter :: name='hash_map_init_vl' character(len=20), parameter :: name='hash_map_init_vl'
real(psb_dpk_) :: t0, t1, t2,t3, t4, t5
info = 0 info = 0
call psb_info(ctxt,iam,np) call psb_info(ctxt,iam,np)
if (np < 0) then if (np < 0) then
@ -1229,7 +1227,6 @@ contains
info = -1 info = -1
return return
end if end if
nl = size(vl) nl = size(vl)
m = maxval(vl(1:nl)) m = maxval(vl(1:nl))
@ -1237,45 +1234,14 @@ contains
call psb_sum(ctxt,nrt) call psb_sum(ctxt,nrt)
call psb_max(ctxt,m) call psb_max(ctxt,m)
allocate(vlu(nl), ix(nl), stat=info)
if (info /= 0) then
info = -1
return
end if
do i=1,nl
if ((vl(i)<1).or.(vl(i)>m)) then
info = psb_err_entry_out_of_bounds_
int_err(1) = i
int_err(2) = vl(i)
int_err(3) = nl
int_err(4) = m
exit
endif
vlu(i) = vl(i)
end do
if ((m /= nrt).and.(iam == psb_root_)) then if ((m /= nrt).and.(iam == psb_root_)) then
write(psb_err_unit,*) trim(name),& write(psb_err_unit,*) trim(name),&
& ' Warning: globalcheck=.false., but there is a mismatch' & ' Warning: we got to hash_init_vl but there is a mismatch'
write(psb_err_unit,*) trim(name),& write(psb_err_unit,*) trim(name),&
& ' : in the global sizes!',m,nrt & ' : in the global sizes!',m,nrt
end if end if
call hash_init_vlu(idxmap,ctxt,m,nl,vl,info)
call psb_msort(vlu,ix)
nlu = 1
do i=2,nl
if (vlu(i) /= vlu(nlu)) then
nlu = nlu + 1
vlu(nlu) = vlu(i)
ix(nlu) = ix(i)
end if
end do
call psb_msort(ix(1:nlu),vlu(1:nlu),flag=psb_sort_keep_idx_)
nlu = nl
call hash_init_vlu(idxmap,ctxt,m,nlu,vlu,info)
end subroutine hash_init_vl end subroutine hash_init_vl

@ -163,7 +163,6 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash)
! 3. any overlap? ! 3. any overlap?
! Checks 2 and 3 are controlled by globalcheck ! Checks 2 and 3 are controlled by globalcheck
! !
if (check_.or.(.not.islarge)) then if (check_.or.(.not.islarge)) then
if (debug_size) & if (debug_size) &
& write(debug_unit,*) me,' ',trim(name),': Going for global checks' & write(debug_unit,*) me,' ',trim(name),': Going for global checks'

Loading…
Cancel
Save