From fb422be9f4acf364bf7b35c668133cb0ea1f95bb Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Sun, 8 Nov 2020 12:38:15 +0100 Subject: [PATCH] Change interface of X_REMAP to include isrc/nrsrc --- base/modules/tools/psb_c_tools_mod.F90 | 5 +++-- base/modules/tools/psb_d_tools_mod.F90 | 5 +++-- base/modules/tools/psb_s_tools_mod.F90 | 5 +++-- base/modules/tools/psb_z_tools_mod.F90 | 5 +++-- base/tools/psb_c_remap.F90 | 8 ++++++-- base/tools/psb_d_remap.F90 | 8 ++++++-- base/tools/psb_s_remap.F90 | 8 ++++++-- base/tools/psb_z_remap.F90 | 8 ++++++-- 8 files changed, 36 insertions(+), 16 deletions(-) diff --git a/base/modules/tools/psb_c_tools_mod.F90 b/base/modules/tools/psb_c_tools_mod.F90 index 6a7f91af..dc41128d 100644 --- a/base/modules/tools/psb_c_tools_mod.F90 +++ b/base/modules/tools/psb_c_tools_mod.F90 @@ -432,8 +432,8 @@ Module psb_c_tools_mod end interface interface psb_remap - subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, a_out, info) - import + subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) + import implicit none !....parameters... integer(psb_ipk_), intent(in) :: np_remap @@ -441,6 +441,7 @@ Module psb_c_tools_mod type(psb_cspmat_type), intent(inout) :: a_in type(psb_cspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info end subroutine psb_c_remap end interface psb_remap diff --git a/base/modules/tools/psb_d_tools_mod.F90 b/base/modules/tools/psb_d_tools_mod.F90 index da24e552..4d262cf4 100644 --- a/base/modules/tools/psb_d_tools_mod.F90 +++ b/base/modules/tools/psb_d_tools_mod.F90 @@ -432,8 +432,8 @@ Module psb_d_tools_mod end interface interface psb_remap - subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, a_out, info) - import + subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) + import implicit none !....parameters... integer(psb_ipk_), intent(in) :: np_remap @@ -441,6 +441,7 @@ Module psb_d_tools_mod type(psb_dspmat_type), intent(inout) :: a_in type(psb_dspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info end subroutine psb_d_remap end interface psb_remap diff --git a/base/modules/tools/psb_s_tools_mod.F90 b/base/modules/tools/psb_s_tools_mod.F90 index 754b6062..969df083 100644 --- a/base/modules/tools/psb_s_tools_mod.F90 +++ b/base/modules/tools/psb_s_tools_mod.F90 @@ -432,8 +432,8 @@ Module psb_s_tools_mod end interface interface psb_remap - subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, a_out, info) - import + subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) + import implicit none !....parameters... integer(psb_ipk_), intent(in) :: np_remap @@ -441,6 +441,7 @@ Module psb_s_tools_mod type(psb_sspmat_type), intent(inout) :: a_in type(psb_sspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info end subroutine psb_s_remap end interface psb_remap diff --git a/base/modules/tools/psb_z_tools_mod.F90 b/base/modules/tools/psb_z_tools_mod.F90 index ca73ab72..2a28fc04 100644 --- a/base/modules/tools/psb_z_tools_mod.F90 +++ b/base/modules/tools/psb_z_tools_mod.F90 @@ -432,8 +432,8 @@ Module psb_z_tools_mod end interface interface psb_remap - subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, a_out, info) - import + subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) + import implicit none !....parameters... integer(psb_ipk_), intent(in) :: np_remap @@ -441,6 +441,7 @@ Module psb_z_tools_mod type(psb_zspmat_type), intent(inout) :: a_in type(psb_zspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info end subroutine psb_z_remap end interface psb_remap diff --git a/base/tools/psb_c_remap.F90 b/base/tools/psb_c_remap.F90 index 54cc90df..710f1719 100644 --- a/base/tools/psb_c_remap.F90 +++ b/base/tools/psb_c_remap.F90 @@ -36,7 +36,7 @@ ! desc_in - type(psb_desc_type). The communication descriptor to be cloned. ! desc_out - type(psb_desc_type). The output communication descriptor. ! info - integer. Return code. -subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, a_out, info) +subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) use psb_base_mod, psb_protect_name => psb_c_remap @@ -47,6 +47,7 @@ subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, a_out, info) type(psb_cspmat_type), intent(inout) :: a_in type(psb_cspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info @@ -54,7 +55,7 @@ subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, a_out, info) integer(psb_ipk_) :: np, me, ictxt, err_act integer(psb_ipk_) :: rnp, rme, newctxt integer(psb_ipk_) :: ipdest, ipd, id1, id2, imd, i, nsrc - integer(psb_ipk_), allocatable :: newnl(:), isrc(:), nzsrc(:), ids(:) + integer(psb_ipk_), allocatable :: newnl(:), nzsrc(:), ids(:) type(psb_lc_coo_sparse_mat) :: acoo_snd, acoo_rcv integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -183,6 +184,7 @@ subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, a_out, info) call a_in%cp_to(acoo_snd) nzsnd = acoo_snd%get_nzeros() call psb_snd(ictxt,nzsnd,ipd) + call psb_snd(ictxt,desc_in%get_local_rows(),ipd) ! Convert to global numbering call psb_loc_to_glob(acoo_snd%ia(1:nzsnd),desc_in,info) call psb_loc_to_glob(acoo_snd%ja(1:nzsnd),desc_in,info) @@ -194,9 +196,11 @@ subroutine psb_c_remap(np_remap, desc_in, a_in, desc_out, a_out, info) if (rme>=0) then ! prepare to receive nzsrc = isrc + nrsrc = isrc nzl = 0 do ip=1, nsrc call psb_rcv(ictxt,nzsrc(ip),isrc(ip)) + call psb_rcv(ictxt,nrsrc(ip),isrc(ip)) nzl = nzl + nzsrc(ip) end do call acoo_rcv%allocate(newnl(rme+1),newnl(rme+1),nzl) diff --git a/base/tools/psb_d_remap.F90 b/base/tools/psb_d_remap.F90 index e55626c5..384485a4 100644 --- a/base/tools/psb_d_remap.F90 +++ b/base/tools/psb_d_remap.F90 @@ -36,7 +36,7 @@ ! desc_in - type(psb_desc_type). The communication descriptor to be cloned. ! desc_out - type(psb_desc_type). The output communication descriptor. ! info - integer. Return code. -subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, a_out, info) +subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) use psb_base_mod, psb_protect_name => psb_d_remap @@ -47,6 +47,7 @@ subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, a_out, info) type(psb_dspmat_type), intent(inout) :: a_in type(psb_dspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info @@ -54,7 +55,7 @@ subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, a_out, info) integer(psb_ipk_) :: np, me, ictxt, err_act integer(psb_ipk_) :: rnp, rme, newctxt integer(psb_ipk_) :: ipdest, ipd, id1, id2, imd, i, nsrc - integer(psb_ipk_), allocatable :: newnl(:), isrc(:), nzsrc(:), ids(:) + integer(psb_ipk_), allocatable :: newnl(:), nzsrc(:), ids(:) type(psb_ld_coo_sparse_mat) :: acoo_snd, acoo_rcv integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -183,6 +184,7 @@ subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, a_out, info) call a_in%cp_to(acoo_snd) nzsnd = acoo_snd%get_nzeros() call psb_snd(ictxt,nzsnd,ipd) + call psb_snd(ictxt,desc_in%get_local_rows(),ipd) ! Convert to global numbering call psb_loc_to_glob(acoo_snd%ia(1:nzsnd),desc_in,info) call psb_loc_to_glob(acoo_snd%ja(1:nzsnd),desc_in,info) @@ -194,9 +196,11 @@ subroutine psb_d_remap(np_remap, desc_in, a_in, desc_out, a_out, info) if (rme>=0) then ! prepare to receive nzsrc = isrc + nrsrc = isrc nzl = 0 do ip=1, nsrc call psb_rcv(ictxt,nzsrc(ip),isrc(ip)) + call psb_rcv(ictxt,nrsrc(ip),isrc(ip)) nzl = nzl + nzsrc(ip) end do call acoo_rcv%allocate(newnl(rme+1),newnl(rme+1),nzl) diff --git a/base/tools/psb_s_remap.F90 b/base/tools/psb_s_remap.F90 index 6fa33223..199317ff 100644 --- a/base/tools/psb_s_remap.F90 +++ b/base/tools/psb_s_remap.F90 @@ -36,7 +36,7 @@ ! desc_in - type(psb_desc_type). The communication descriptor to be cloned. ! desc_out - type(psb_desc_type). The output communication descriptor. ! info - integer. Return code. -subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, a_out, info) +subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) use psb_base_mod, psb_protect_name => psb_s_remap @@ -47,6 +47,7 @@ subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, a_out, info) type(psb_sspmat_type), intent(inout) :: a_in type(psb_sspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info @@ -54,7 +55,7 @@ subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, a_out, info) integer(psb_ipk_) :: np, me, ictxt, err_act integer(psb_ipk_) :: rnp, rme, newctxt integer(psb_ipk_) :: ipdest, ipd, id1, id2, imd, i, nsrc - integer(psb_ipk_), allocatable :: newnl(:), isrc(:), nzsrc(:), ids(:) + integer(psb_ipk_), allocatable :: newnl(:), nzsrc(:), ids(:) type(psb_ls_coo_sparse_mat) :: acoo_snd, acoo_rcv integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -183,6 +184,7 @@ subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, a_out, info) call a_in%cp_to(acoo_snd) nzsnd = acoo_snd%get_nzeros() call psb_snd(ictxt,nzsnd,ipd) + call psb_snd(ictxt,desc_in%get_local_rows(),ipd) ! Convert to global numbering call psb_loc_to_glob(acoo_snd%ia(1:nzsnd),desc_in,info) call psb_loc_to_glob(acoo_snd%ja(1:nzsnd),desc_in,info) @@ -194,9 +196,11 @@ subroutine psb_s_remap(np_remap, desc_in, a_in, desc_out, a_out, info) if (rme>=0) then ! prepare to receive nzsrc = isrc + nrsrc = isrc nzl = 0 do ip=1, nsrc call psb_rcv(ictxt,nzsrc(ip),isrc(ip)) + call psb_rcv(ictxt,nrsrc(ip),isrc(ip)) nzl = nzl + nzsrc(ip) end do call acoo_rcv%allocate(newnl(rme+1),newnl(rme+1),nzl) diff --git a/base/tools/psb_z_remap.F90 b/base/tools/psb_z_remap.F90 index 3802ec3d..fa3b67c9 100644 --- a/base/tools/psb_z_remap.F90 +++ b/base/tools/psb_z_remap.F90 @@ -36,7 +36,7 @@ ! desc_in - type(psb_desc_type). The communication descriptor to be cloned. ! desc_out - type(psb_desc_type). The output communication descriptor. ! info - integer. Return code. -subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, a_out, info) +subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, isrc, nrsrc, a_out, info) use psb_base_mod, psb_protect_name => psb_z_remap @@ -47,6 +47,7 @@ subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, a_out, info) type(psb_zspmat_type), intent(inout) :: a_in type(psb_zspmat_type), intent(out) :: a_out type(psb_desc_type), intent(out) :: desc_out + integer(psb_ipk_), allocatable, intent(out) :: isrc(:), nrsrc(:) integer(psb_ipk_), intent(out) :: info @@ -54,7 +55,7 @@ subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, a_out, info) integer(psb_ipk_) :: np, me, ictxt, err_act integer(psb_ipk_) :: rnp, rme, newctxt integer(psb_ipk_) :: ipdest, ipd, id1, id2, imd, i, nsrc - integer(psb_ipk_), allocatable :: newnl(:), isrc(:), nzsrc(:), ids(:) + integer(psb_ipk_), allocatable :: newnl(:), nzsrc(:), ids(:) type(psb_lz_coo_sparse_mat) :: acoo_snd, acoo_rcv integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -183,6 +184,7 @@ subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, a_out, info) call a_in%cp_to(acoo_snd) nzsnd = acoo_snd%get_nzeros() call psb_snd(ictxt,nzsnd,ipd) + call psb_snd(ictxt,desc_in%get_local_rows(),ipd) ! Convert to global numbering call psb_loc_to_glob(acoo_snd%ia(1:nzsnd),desc_in,info) call psb_loc_to_glob(acoo_snd%ja(1:nzsnd),desc_in,info) @@ -194,9 +196,11 @@ subroutine psb_z_remap(np_remap, desc_in, a_in, desc_out, a_out, info) if (rme>=0) then ! prepare to receive nzsrc = isrc + nrsrc = isrc nzl = 0 do ip=1, nsrc call psb_rcv(ictxt,nzsrc(ip),isrc(ip)) + call psb_rcv(ictxt,nrsrc(ip),isrc(ip)) nzl = nzl + nzsrc(ip) end do call acoo_rcv%allocate(newnl(rme+1),newnl(rme+1),nzl)