From 9c989c24e979ac57e76d64116667cbf65918476d Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 27 Jul 2017 09:16:55 +0100 Subject: [PATCH] Simple caching scheme for psb_info --- base/modules/psi_penv_mod.F90 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/base/modules/psi_penv_mod.F90 b/base/modules/psi_penv_mod.F90 index 1f63b1c7..0f3c01ee 100644 --- a/base/modules/psi_penv_mod.F90 +++ b/base/modules/psi_penv_mod.F90 @@ -253,11 +253,17 @@ contains integer(psb_ipk_), intent(in) :: ictxt integer(psb_ipk_), intent(out) :: iam, np - integer(psb_mpik_) :: iictxt, iiam, inp - iictxt = ictxt - call psb_info(iictxt,iiam,inp) - iam = iiam - np = inp + ! + ! Simple caching scheme, keep track + ! of the last CTXT encountered. + ! + integer(psb_mpik_), save :: lctxt=-1, lam, lnp + if (ictxt /= lctxt) then + lctxt = ictxt + call psb_info(lctxt,lam,lnp) + end if + iam = lam + np = lnp end subroutine psb_info_ipk @@ -513,7 +519,7 @@ contains integer(psb_mpik_), intent(in) :: ictxt integer(psb_mpik_), intent(out) :: iam, np integer(psb_mpik_) :: info - + #if defined(SERIAL_MPI) iam = 0 np = 1