From ecef7d86539ae6696830a12eb0c0b2bee4700943 Mon Sep 17 00:00:00 2001 From: sfilippone Date: Wed, 26 Mar 2025 16:37:28 +0100 Subject: [PATCH] Improve communication and speed between cd_inloc and hash_init --- base/modules/desc/psb_hash_map_mod.F90 | 42 +++----------------------- base/tools/psb_cd_inloc.f90 | 1 - 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/base/modules/desc/psb_hash_map_mod.F90 b/base/modules/desc/psb_hash_map_mod.F90 index 9c1b40bc..85000533 100644 --- a/base/modules/desc/psb_hash_map_mod.F90 +++ b/base/modules/desc/psb_hash_map_mod.F90 @@ -1217,11 +1217,9 @@ contains ! To be implemented integer(psb_ipk_) :: iam, np integer(psb_ipk_) :: i, nlu, nl, int_err(5) - integer(psb_lpk_) :: m, nrt - integer(psb_lpk_), allocatable :: vlu(:) - integer(psb_lpk_), allocatable :: ix(:) + integer(psb_lpk_) :: m, nrt character(len=20), parameter :: name='hash_map_init_vl' - + real(psb_dpk_) :: t0, t1, t2,t3, t4, t5 info = 0 call psb_info(ctxt,iam,np) if (np < 0) then @@ -1229,7 +1227,6 @@ contains info = -1 return end if - nl = size(vl) m = maxval(vl(1:nl)) @@ -1237,46 +1234,15 @@ contains call psb_sum(ctxt,nrt) 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 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),& & ' : in the global sizes!',m,nrt end if - - 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_) + call hash_init_vlu(idxmap,ctxt,m,nl,vl,info) - nlu = nl - call hash_init_vlu(idxmap,ctxt,m,nlu,vlu,info) - end subroutine hash_init_vl subroutine hash_init_vg(idxmap,ctxt,vg,info) diff --git a/base/tools/psb_cd_inloc.f90 b/base/tools/psb_cd_inloc.f90 index 30c3e9b3..3f2b2e08 100644 --- a/base/tools/psb_cd_inloc.f90 +++ b/base/tools/psb_cd_inloc.f90 @@ -163,7 +163,6 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) ! 3. any overlap? ! Checks 2 and 3 are controlled by globalcheck ! - if (check_.or.(.not.islarge)) then if (debug_size) & & write(debug_unit,*) me,' ',trim(name),': Going for global checks'