From 2bd9e4ffa6eb66211ce761f4d8d69542ae590945 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 4 Jul 2019 13:38:59 +0100 Subject: [PATCH] Print_timers: check for allocated timers. --- base/modules/psb_timers_mod.f90 | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/base/modules/psb_timers_mod.f90 b/base/modules/psb_timers_mod.f90 index 8119d24d..1fe11162 100644 --- a/base/modules/psb_timers_mod.f90 +++ b/base/modules/psb_timers_mod.f90 @@ -127,17 +127,19 @@ contains end if if (global_) then - allocate(ptimers(timer_entries_,size(timers,2)),stat=info) - if (info /= 0) then - write(0,*) 'Error while trying to allocate temporary ',info - call psb_abort(ictxt) - end if - ptimers = timers - call psb_max(ictxt,ptimers) - if (me == psb_root_) then - do i=idxmin_, idxmax_ - call print_timer(me, ptimers(:,i), timers_descr(i), iout) - end do + if (allocated(timers)) then + allocate(ptimers(timer_entries_,size(timers,2)),stat=info) + if (info /= 0) then + write(0,*) 'Error while trying to allocate temporary ',info + call psb_abort(ictxt) + end if + ptimers = timers + call psb_max(ictxt,ptimers) + if (me == psb_root_) then + do i=idxmin_, idxmax_ + call print_timer(me, ptimers(:,i), timers_descr(i), iout) + end do + end if end if else if ((proc_ == -1).or.(me==proc_)) then