diff --git a/mlprec/impl/mld_c_hierarchy_bld.f90 b/mlprec/impl/mld_c_hierarchy_bld.f90 index 56c3057c..a16dd024 100644 --- a/mlprec/impl/mld_c_hierarchy_bld.f90 +++ b/mlprec/impl/mld_c_hierarchy_bld.f90 @@ -79,8 +79,9 @@ subroutine mld_c_hierarchy_bld(a,desc_a,prec,info) ! Local Variables integer(psb_ipk_) :: ictxt, me,np - integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz, casize,& - & nplevs, mxplevs, iaggsize + integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz,& + & nplevs, mxplevs + integer(psb_lpk_) :: iaggsize, casize real(psb_spk_) :: mnaggratio, sizeratio, athresh, aomega class(mld_c_base_smoother_type), allocatable :: coarse_sm, base_sm, med_sm, & & base_sm2, med_sm2, coarse_sm2 @@ -196,7 +197,15 @@ subroutine mld_c_hierarchy_bld(a,desc_a,prec,info) casize = max(casize,ione) casize = casize*40_psb_ipk_ call psb_bcast(ictxt,casize) - prec%ag_data%min_coarse_size = casize + if (casize > huge(prec%ag_data%min_coarse_size)) then + ! + ! computed coarse size does not fit in IPK_. + ! This is very unlikely, but make sure to put a positive number + ! + prec%ag_data%min_coarse_size = huge(prec%ag_data%min_coarse_size) + else + prec%ag_data%min_coarse_size = casize + end if end if nplevs = max(itwo,mxplevs) diff --git a/mlprec/impl/mld_d_hierarchy_bld.f90 b/mlprec/impl/mld_d_hierarchy_bld.f90 index 40e8f216..57cbfc05 100644 --- a/mlprec/impl/mld_d_hierarchy_bld.f90 +++ b/mlprec/impl/mld_d_hierarchy_bld.f90 @@ -79,8 +79,9 @@ subroutine mld_d_hierarchy_bld(a,desc_a,prec,info) ! Local Variables integer(psb_ipk_) :: ictxt, me,np - integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz, casize,& - & nplevs, mxplevs, iaggsize + integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz,& + & nplevs, mxplevs + integer(psb_lpk_) :: iaggsize, casize real(psb_dpk_) :: mnaggratio, sizeratio, athresh, aomega class(mld_d_base_smoother_type), allocatable :: coarse_sm, base_sm, med_sm, & & base_sm2, med_sm2, coarse_sm2 @@ -196,7 +197,15 @@ subroutine mld_d_hierarchy_bld(a,desc_a,prec,info) casize = max(casize,ione) casize = casize*40_psb_ipk_ call psb_bcast(ictxt,casize) - prec%ag_data%min_coarse_size = casize + if (casize > huge(prec%ag_data%min_coarse_size)) then + ! + ! computed coarse size does not fit in IPK_. + ! This is very unlikely, but make sure to put a positive number + ! + prec%ag_data%min_coarse_size = huge(prec%ag_data%min_coarse_size) + else + prec%ag_data%min_coarse_size = casize + end if end if nplevs = max(itwo,mxplevs) diff --git a/mlprec/impl/mld_s_hierarchy_bld.f90 b/mlprec/impl/mld_s_hierarchy_bld.f90 index e159b368..f25fc9c5 100644 --- a/mlprec/impl/mld_s_hierarchy_bld.f90 +++ b/mlprec/impl/mld_s_hierarchy_bld.f90 @@ -79,8 +79,9 @@ subroutine mld_s_hierarchy_bld(a,desc_a,prec,info) ! Local Variables integer(psb_ipk_) :: ictxt, me,np - integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz, casize,& - & nplevs, mxplevs, iaggsize + integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz,& + & nplevs, mxplevs + integer(psb_lpk_) :: iaggsize, casize real(psb_spk_) :: mnaggratio, sizeratio, athresh, aomega class(mld_s_base_smoother_type), allocatable :: coarse_sm, base_sm, med_sm, & & base_sm2, med_sm2, coarse_sm2 @@ -196,7 +197,15 @@ subroutine mld_s_hierarchy_bld(a,desc_a,prec,info) casize = max(casize,ione) casize = casize*40_psb_ipk_ call psb_bcast(ictxt,casize) - prec%ag_data%min_coarse_size = casize + if (casize > huge(prec%ag_data%min_coarse_size)) then + ! + ! computed coarse size does not fit in IPK_. + ! This is very unlikely, but make sure to put a positive number + ! + prec%ag_data%min_coarse_size = huge(prec%ag_data%min_coarse_size) + else + prec%ag_data%min_coarse_size = casize + end if end if nplevs = max(itwo,mxplevs) diff --git a/mlprec/impl/mld_z_hierarchy_bld.f90 b/mlprec/impl/mld_z_hierarchy_bld.f90 index c4dcac39..40d0b2ec 100644 --- a/mlprec/impl/mld_z_hierarchy_bld.f90 +++ b/mlprec/impl/mld_z_hierarchy_bld.f90 @@ -79,8 +79,9 @@ subroutine mld_z_hierarchy_bld(a,desc_a,prec,info) ! Local Variables integer(psb_ipk_) :: ictxt, me,np - integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz, casize,& - & nplevs, mxplevs, iaggsize + integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz,& + & nplevs, mxplevs + integer(psb_lpk_) :: iaggsize, casize real(psb_dpk_) :: mnaggratio, sizeratio, athresh, aomega class(mld_z_base_smoother_type), allocatable :: coarse_sm, base_sm, med_sm, & & base_sm2, med_sm2, coarse_sm2 @@ -196,7 +197,15 @@ subroutine mld_z_hierarchy_bld(a,desc_a,prec,info) casize = max(casize,ione) casize = casize*40_psb_ipk_ call psb_bcast(ictxt,casize) - prec%ag_data%min_coarse_size = casize + if (casize > huge(prec%ag_data%min_coarse_size)) then + ! + ! computed coarse size does not fit in IPK_. + ! This is very unlikely, but make sure to put a positive number + ! + prec%ag_data%min_coarse_size = huge(prec%ag_data%min_coarse_size) + else + prec%ag_data%min_coarse_size = casize + end if end if nplevs = max(itwo,mxplevs)