Add support for size statistics

newG2L
Salvatore Filippone 4 years ago
parent 08f3de57f0
commit 583ca19e9c

@ -43,6 +43,8 @@ module psb_base_linmap_mod
type psb_base_linmap_type type psb_base_linmap_type
integer(psb_ipk_) :: kind integer(psb_ipk_) :: kind
integer(psb_lpk_) :: nagmin, nagmax, nagtot
real(psb_dpk_) :: nagavg
integer(psb_lpk_), allocatable :: iaggr(:), naggr(:) integer(psb_lpk_), allocatable :: iaggr(:), naggr(:)
type(psb_desc_type), pointer :: p_desc_U=>null(), p_desc_V=>null() type(psb_desc_type), pointer :: p_desc_U=>null(), p_desc_V=>null()
type(psb_desc_type) :: desc_U, desc_V type(psb_desc_type) :: desc_U, desc_V
@ -162,7 +164,11 @@ contains
type(psb_base_linmap_type), intent(inout) :: mapin,mapout type(psb_base_linmap_type), intent(inout) :: mapin,mapout
integer(psb_ipk_), intent(out) :: info 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%iaggr,mapout%iaggr,info)
call psb_move_alloc(mapin%naggr,mapout%naggr,info) call psb_move_alloc(mapin%naggr,mapout%naggr,info)
mapout%p_desc_U => mapin%p_desc_U mapout%p_desc_U => mapin%p_desc_U
@ -184,7 +190,12 @@ contains
class(psb_base_linmap_type), intent(inout) :: mapout class(psb_base_linmap_type), intent(inout) :: mapout
integer(psb_ipk_) :: info 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%iaggr,mapout%iaggr,info)
call psb_safe_ab_cpy(map%naggr,mapout%naggr,info) call psb_safe_ab_cpy(map%naggr,mapout%naggr,info)
mapout%p_desc_U => map%p_desc_U mapout%p_desc_U => map%p_desc_U

@ -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_lpk_), intent(in), optional :: iaggr(:), naggr(:)
! !
integer(psb_ipk_) :: info integer(psb_ipk_) :: info
integer(psb_ipk_) :: me, np
character(len=20), parameter :: name='psb_linmap' character(len=20), parameter :: name='psb_linmap'
type(psb_ctxt_type) :: ctxt
info = psb_success_ info = psb_success_
select case(map_kind) select case(map_kind)
case (psb_map_aggr_) case (psb_map_aggr_)
! OK ! OK
if (psb_is_ok_desc(desc_U)) then if (desc_U%is_ok()) then
this%p_desc_U=>desc_U this%p_desc_U=>desc_U
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
if (psb_is_ok_desc(desc_V)) then if (desc_V%is_ok()) then
this%p_desc_V=>desc_V this%p_desc_V=>desc_V
else else
info = psb_err_invalid_cd_state_ 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 if (desc_U%is_ok()) then
call desc_U%clone(this%desc_U,info) call desc_U%clone(this%desc_U,info)
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
@ -482,4 +486,11 @@ function psb_c_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) &
return return
end if 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 end function psb_c_linmap

@ -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_lpk_), intent(in), optional :: iaggr(:), naggr(:)
! !
integer(psb_ipk_) :: info integer(psb_ipk_) :: info
integer(psb_ipk_) :: me, np
character(len=20), parameter :: name='psb_linmap' character(len=20), parameter :: name='psb_linmap'
type(psb_ctxt_type) :: ctxt
info = psb_success_ info = psb_success_
select case(map_kind) select case(map_kind)
case (psb_map_aggr_) case (psb_map_aggr_)
! OK ! OK
if (psb_is_ok_desc(desc_U)) then if (desc_U%is_ok()) then
this%p_desc_U=>desc_U this%p_desc_U=>desc_U
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
if (psb_is_ok_desc(desc_V)) then if (desc_V%is_ok()) then
this%p_desc_V=>desc_V this%p_desc_V=>desc_V
else else
info = psb_err_invalid_cd_state_ 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 if (desc_U%is_ok()) then
call desc_U%clone(this%desc_U,info) call desc_U%clone(this%desc_U,info)
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
@ -482,4 +486,11 @@ function psb_d_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) &
return return
end if 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 end function psb_d_linmap

@ -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_lpk_), intent(in), optional :: iaggr(:), naggr(:)
! !
integer(psb_ipk_) :: info integer(psb_ipk_) :: info
integer(psb_ipk_) :: me, np
character(len=20), parameter :: name='psb_linmap' character(len=20), parameter :: name='psb_linmap'
type(psb_ctxt_type) :: ctxt
info = psb_success_ info = psb_success_
select case(map_kind) select case(map_kind)
case (psb_map_aggr_) case (psb_map_aggr_)
! OK ! OK
if (psb_is_ok_desc(desc_U)) then if (desc_U%is_ok()) then
this%p_desc_U=>desc_U this%p_desc_U=>desc_U
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
if (psb_is_ok_desc(desc_V)) then if (desc_V%is_ok()) then
this%p_desc_V=>desc_V this%p_desc_V=>desc_V
else else
info = psb_err_invalid_cd_state_ 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 if (desc_U%is_ok()) then
call desc_U%clone(this%desc_U,info) call desc_U%clone(this%desc_U,info)
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
@ -482,4 +486,11 @@ function psb_s_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) &
return return
end if 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 end function psb_s_linmap

@ -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_lpk_), intent(in), optional :: iaggr(:), naggr(:)
! !
integer(psb_ipk_) :: info integer(psb_ipk_) :: info
integer(psb_ipk_) :: me, np
character(len=20), parameter :: name='psb_linmap' character(len=20), parameter :: name='psb_linmap'
type(psb_ctxt_type) :: ctxt
info = psb_success_ info = psb_success_
select case(map_kind) select case(map_kind)
case (psb_map_aggr_) case (psb_map_aggr_)
! OK ! OK
if (psb_is_ok_desc(desc_U)) then if (desc_U%is_ok()) then
this%p_desc_U=>desc_U this%p_desc_U=>desc_U
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
if (psb_is_ok_desc(desc_V)) then if (desc_V%is_ok()) then
this%p_desc_V=>desc_V this%p_desc_V=>desc_V
else else
info = psb_err_invalid_cd_state_ 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 if (desc_U%is_ok()) then
call desc_U%clone(this%desc_U,info) call desc_U%clone(this%desc_U,info)
ctxt = desc_U%get_ctxt()
else else
info = psb_err_invalid_cd_state_ info = psb_err_invalid_cd_state_
endif endif
@ -482,4 +486,11 @@ function psb_z_linmap(map_kind,desc_U, desc_V, mat_U2V, mat_V2U,iaggr,naggr) &
return return
end if 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 end function psb_z_linmap

Loading…
Cancel
Save