From 583ca19e9ce864761af9823d0889ef48974c546f Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 18 Feb 2021 14:59:50 +0100 Subject: [PATCH] Add support for size statistics --- base/modules/comm/psb_base_linmap_mod.f90 | 15 +++++++++++++-- base/tools/psb_c_map.f90 | 15 +++++++++++++-- base/tools/psb_d_map.f90 | 15 +++++++++++++-- base/tools/psb_s_map.f90 | 15 +++++++++++++-- base/tools/psb_z_map.f90 | 15 +++++++++++++-- 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/base/modules/comm/psb_base_linmap_mod.f90 b/base/modules/comm/psb_base_linmap_mod.f90 index a0b62d54..b06470aa 100644 --- a/base/modules/comm/psb_base_linmap_mod.f90 +++ b/base/modules/comm/psb_base_linmap_mod.f90 @@ -43,6 +43,8 @@ module psb_base_linmap_mod type psb_base_linmap_type integer(psb_ipk_) :: kind + integer(psb_lpk_) :: nagmin, nagmax, nagtot + real(psb_dpk_) :: nagavg integer(psb_lpk_), allocatable :: iaggr(:), naggr(:) type(psb_desc_type), pointer :: p_desc_U=>null(), p_desc_V=>null() type(psb_desc_type) :: desc_U, desc_V @@ -162,7 +164,11 @@ contains type(psb_base_linmap_type), intent(inout) :: mapin,mapout integer(psb_ipk_), intent(out) :: info - mapout%kind = mapin%kind + mapout%kind = mapin%kind + mapout%nagmin = mapin%nagmin + mapout%nagmax = mapin%nagmax + mapout%nagavg = mapin%nagavg + mapout%nagtot = mapin%nagtot call psb_move_alloc(mapin%iaggr,mapout%iaggr,info) call psb_move_alloc(mapin%naggr,mapout%naggr,info) mapout%p_desc_U => mapin%p_desc_U @@ -184,7 +190,12 @@ contains class(psb_base_linmap_type), intent(inout) :: mapout integer(psb_ipk_) :: info - mapout%kind = map%kind + mapout%kind = map%kind + mapout%nagmin = map%nagmin + mapout%nagmax = map%nagmax + mapout%nagavg = map%nagavg + mapout%nagtot = map%nagtot + call psb_safe_ab_cpy(map%iaggr,mapout%iaggr,info) call psb_safe_ab_cpy(map%naggr,mapout%naggr,info) mapout%p_desc_U => map%p_desc_U diff --git a/base/tools/psb_c_map.f90 b/base/tools/psb_c_map.f90 index 2761205d..1cfb9272 100644 --- a/base/tools/psb_c_map.f90 +++ b/base/tools/psb_c_map.f90 @@ -407,19 +407,22 @@ function psb_c_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & integer(psb_lpk_), intent(in), optional :: iaggr(:), naggr(:) ! integer(psb_ipk_) :: info + integer(psb_ipk_) :: me, np character(len=20), parameter :: name='psb_linmap' + type(psb_ctxt_type) :: ctxt info = psb_success_ select case(map_kind) case (psb_map_aggr_) ! OK - if (psb_is_ok_desc(desc_U)) then + if (desc_U%is_ok()) then this%p_desc_U=>desc_U + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif - if (psb_is_ok_desc(desc_V)) then + if (desc_V%is_ok()) then this%p_desc_V=>desc_V else info = psb_err_invalid_cd_state_ @@ -443,6 +446,7 @@ function psb_c_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & if (desc_U%is_ok()) then call desc_U%clone(this%desc_U,info) + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif @@ -482,4 +486,11 @@ function psb_c_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & return end if + call psb_info(ctxt,me,np) + this%nagmin = minval(this%naggr) + this%nagmax = maxval(this%naggr) + this%nagtot = sum(this%naggr) + this%nagavg = this%nagtot + this%nagavg = this%nagavg/np + end function psb_c_linmap diff --git a/base/tools/psb_d_map.f90 b/base/tools/psb_d_map.f90 index 9fdebb4d..d1a02fdf 100644 --- a/base/tools/psb_d_map.f90 +++ b/base/tools/psb_d_map.f90 @@ -407,19 +407,22 @@ function psb_d_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & integer(psb_lpk_), intent(in), optional :: iaggr(:), naggr(:) ! integer(psb_ipk_) :: info + integer(psb_ipk_) :: me, np character(len=20), parameter :: name='psb_linmap' + type(psb_ctxt_type) :: ctxt info = psb_success_ select case(map_kind) case (psb_map_aggr_) ! OK - if (psb_is_ok_desc(desc_U)) then + if (desc_U%is_ok()) then this%p_desc_U=>desc_U + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif - if (psb_is_ok_desc(desc_V)) then + if (desc_V%is_ok()) then this%p_desc_V=>desc_V else info = psb_err_invalid_cd_state_ @@ -443,6 +446,7 @@ function psb_d_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & if (desc_U%is_ok()) then call desc_U%clone(this%desc_U,info) + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif @@ -482,4 +486,11 @@ function psb_d_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & return end if + call psb_info(ctxt,me,np) + this%nagmin = minval(this%naggr) + this%nagmax = maxval(this%naggr) + this%nagtot = sum(this%naggr) + this%nagavg = this%nagtot + this%nagavg = this%nagavg/np + end function psb_d_linmap diff --git a/base/tools/psb_s_map.f90 b/base/tools/psb_s_map.f90 index 6b6b09aa..e6c6d445 100644 --- a/base/tools/psb_s_map.f90 +++ b/base/tools/psb_s_map.f90 @@ -407,19 +407,22 @@ function psb_s_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & integer(psb_lpk_), intent(in), optional :: iaggr(:), naggr(:) ! integer(psb_ipk_) :: info + integer(psb_ipk_) :: me, np character(len=20), parameter :: name='psb_linmap' + type(psb_ctxt_type) :: ctxt info = psb_success_ select case(map_kind) case (psb_map_aggr_) ! OK - if (psb_is_ok_desc(desc_U)) then + if (desc_U%is_ok()) then this%p_desc_U=>desc_U + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif - if (psb_is_ok_desc(desc_V)) then + if (desc_V%is_ok()) then this%p_desc_V=>desc_V else info = psb_err_invalid_cd_state_ @@ -443,6 +446,7 @@ function psb_s_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & if (desc_U%is_ok()) then call desc_U%clone(this%desc_U,info) + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif @@ -482,4 +486,11 @@ function psb_s_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & return end if + call psb_info(ctxt,me,np) + this%nagmin = minval(this%naggr) + this%nagmax = maxval(this%naggr) + this%nagtot = sum(this%naggr) + this%nagavg = this%nagtot + this%nagavg = this%nagavg/np + end function psb_s_linmap diff --git a/base/tools/psb_z_map.f90 b/base/tools/psb_z_map.f90 index eea44099..0aba3e3e 100644 --- a/base/tools/psb_z_map.f90 +++ b/base/tools/psb_z_map.f90 @@ -407,19 +407,22 @@ function psb_z_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & integer(psb_lpk_), intent(in), optional :: iaggr(:), naggr(:) ! integer(psb_ipk_) :: info + integer(psb_ipk_) :: me, np character(len=20), parameter :: name='psb_linmap' + type(psb_ctxt_type) :: ctxt info = psb_success_ select case(map_kind) case (psb_map_aggr_) ! OK - if (psb_is_ok_desc(desc_U)) then + if (desc_U%is_ok()) then this%p_desc_U=>desc_U + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif - if (psb_is_ok_desc(desc_V)) then + if (desc_V%is_ok()) then this%p_desc_V=>desc_V else info = psb_err_invalid_cd_state_ @@ -443,6 +446,7 @@ function psb_z_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & if (desc_U%is_ok()) then call desc_U%clone(this%desc_U,info) + ctxt = desc_U%get_ctxt() else info = psb_err_invalid_cd_state_ endif @@ -482,4 +486,11 @@ function psb_z_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) & return end if + call psb_info(ctxt,me,np) + this%nagmin = minval(this%naggr) + this%nagmax = maxval(this%naggr) + this%nagtot = sum(this%naggr) + this%nagavg = this%nagtot + this%nagavg = this%nagavg/np + end function psb_z_linmap