Skip to content

Commit b1cc268

Browse files
author
Thomas L. Clune
committed
Workaround for profile copy issue.
Have not verified that this workaraound is successful for Intel or GFortran. Only NAG so far.
1 parent 2428319 commit b1cc268

File tree

8 files changed

+42
-37
lines changed

8 files changed

+42
-37
lines changed

profiler/AbstractMeterNode.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function i_get_inclusive(this) result(inclusive)
153153
use, intrinsic :: iso_fortran_env, only: REAL64
154154
import AbstractMeterNode
155155
real(kind=REAL64) :: inclusive
156-
class(AbstractMeterNode), intent(in) :: this
156+
class(AbstractMeterNode), target, intent(in) :: this
157157
end function i_get_inclusive
158158

159159
subroutine i_reset(this)

profiler/BaseProfiler.F90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module mapl_BaseProfiler
2626
private
2727
type(MeterNode) :: root_node
2828
type(MeterNodeStack) :: stack
29-
integer :: status = 0
29+
integer :: status
3030
integer :: comm_world
3131
contains
3232
procedure :: start_name
@@ -53,8 +53,8 @@ module mapl_BaseProfiler
5353
procedure :: get_root_node
5454
procedure :: get_status
5555
procedure :: copy_profiler
56-
procedure(copy_profiler), deferred :: copy
57-
generic :: assignment(=) => copy
56+
!# procedure(copy_profiler), deferred :: copy
57+
!# generic :: assignment(=) => copy
5858

5959
procedure :: reset
6060
procedure :: accumulate
@@ -102,6 +102,7 @@ subroutine start_self(this, unusable, rc)
102102

103103
logical :: empty_stack
104104

105+
this%status = 0
105106
empty_stack = .true.
106107
!$omp master
107108
if (this%stack%size()/= 0) this%status = INCORRECTLY_NESTED_METERS

profiler/DistributedProfiler.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "MAPL.h"
12
module MAPL_DistributedProfiler
23
use MAPL_AbstractMeter
34
use MAPL_AbstractGauge
@@ -20,7 +21,7 @@ module MAPL_DistributedProfiler
2021
contains
2122
procedure :: make_meter
2223
procedure :: reduce
23-
procedure :: copy
24+
!# procedure :: copy
2425
end type DistributedProfiler
2526

2627
interface DistributedProfiler

profiler/MemoryProfiler.F90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "MAPL_ErrLog.h"
1+
#include "MAPL.h"
22
module MAPL_MemoryProfiler_private
33
use MAPL_BaseProfiler, only: BaseProfiler
44
use MAPL_BaseProfiler, only: MemoryProfilerIterator => BaseProfilerIterator
@@ -53,7 +53,8 @@ subroutine copy(new, old)
5353
class(MemoryProfiler), target, intent(inout) :: new
5454
class(BaseProfiler), target, intent(in) :: old
5555

56-
call new%copy_profiler(old)
56+
_HERE
57+
!# call new%copy_profiler(old)
5758

5859
end subroutine copy
5960

profiler/MeterNode.F90

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ module MAPL_MeterNode
3737
procedure :: accumulate
3838
procedure :: reset
3939

40-
procedure :: begin
41-
procedure :: end
40+
procedure :: begin => node_begin
41+
procedure :: end => node_end
4242
end type MeterNode
4343

4444

@@ -56,7 +56,7 @@ module MAPL_MeterNode
5656
procedure :: get_meter => get_meter_iter
5757
procedure :: equals
5858
procedure :: not_equals
59-
procedure :: next
59+
procedure :: next => node_next
6060
end type MeterNodeIterator
6161

6262

@@ -110,14 +110,14 @@ end function get_name
110110

111111
function get_inclusive(this) result(inclusive)
112112
real(kind=REAL64) :: inclusive
113-
class (MeterNode), intent(in) :: this
113+
class (MeterNode), target, intent(in) :: this
114114
inclusive = this%meter%get_total()
115115
end function get_inclusive
116116

117117

118118
function get_exclusive(this) result(exclusive)
119119
real(kind=REAL64) :: exclusive
120-
class (MeterNode), intent(in) :: this
120+
class (MeterNode), target, intent(in) :: this
121121

122122
type (MeterNodevectorIterator) :: iter
123123
class (AbstractMeterNode), pointer :: child
@@ -133,7 +133,7 @@ function get_exclusive(this) result(exclusive)
133133

134134
iter = this%children%begin()
135135
do while (iter /= this%children%end())
136-
child => iter%get()
136+
child => iter%of()
137137
tmp = tmp - child%get_inclusive()
138138
call iter%next()
139139
end do
@@ -239,7 +239,7 @@ recursive integer function get_num_nodes(this) result(num_nodes)
239239
num_nodes = 1
240240
iter = this%children%begin()
241241
do while (iter /= this%children%end())
242-
child => iter%get()
242+
child => iter%of()
243243
num_nodes = num_nodes + child%get_num_nodes()
244244
call iter%next()
245245
end do
@@ -266,18 +266,18 @@ function new_MeterNodeIterator(meter_node) result(iterator)
266266
end function new_MeterNodeIterator
267267

268268

269-
function begin(this) result(iterator)
269+
function node_begin(this) result(iterator)
270270
class (AbstractMeterNodeIterator), allocatable :: iterator
271271
class (MeterNode), target, intent(in) :: this
272272

273273
!!$ iterator = MeterNodeIterator(this)
274274
allocate(iterator, source=MeterNodeIterator(this))
275275

276-
end function begin
276+
end function node_begin
277277

278278

279279

280-
function end(this) result(iterator)
280+
function node_end(this) result(iterator)
281281
class (AbstractMeterNodeIterator), allocatable :: iterator
282282
class (MeterNode), target, intent(in) :: this
283283

@@ -294,10 +294,10 @@ function end(this) result(iterator)
294294
print*,'uh oh'
295295
end select
296296

297-
end function end
297+
end function node_end
298298

299299

300-
recursive subroutine next(this)
300+
recursive subroutine node_next(this)
301301
class (MeterNodeIterator), intent(inout) :: this
302302
class (AbstractMeterNode), pointer :: current_child
303303

@@ -307,7 +307,7 @@ recursive subroutine next(this)
307307
if (.not. allocated(this%iterator_over_children)) then
308308
this%iterator_over_children = this%reference%children%begin()
309309
if (this%iterator_over_children /= this%reference%children%end()) then
310-
current_child => this%iterator_over_children%get()
310+
current_child => this%iterator_over_children%of()
311311
this%iterator_of_current_child = current_child%begin()
312312
this%current => this%iterator_of_current_child%get()
313313
else
@@ -323,14 +323,14 @@ recursive subroutine next(this)
323323
if (this%iterator_over_children == this%reference%children%end()) then ! done
324324
deallocate(this%iterator_over_children)
325325
else
326-
current_child => this%iterator_over_children%get()
326+
current_child => this%iterator_over_children%of()
327327
this%iterator_of_current_child = current_child%begin() ! always at least one node
328328
this%current => this%iterator_of_current_child%get()
329329
end if
330330
end if
331331
end if
332332

333-
end subroutine next
333+
end subroutine node_next
334334

335335

336336
function get(this) result(tree)
@@ -395,7 +395,7 @@ recursive subroutine reset(this)
395395

396396
iter = this%children%begin()
397397
do while (iter /= this%children%end())
398-
child => iter%get()
398+
child => iter%of()
399399
call child%reset()
400400
call iter%next()
401401
end do

profiler/MeterNodeVector.F90

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
module MAPL_MeterNodeVector
22
use MAPL_AbstractMeterNode
33

4-
#define _type class (AbstractMeterNode)
5-
#define _allocatable
6-
#define _vector MeterNodeVector
7-
#define _iterator MeterNodeVectorIterator
8-
#include "templates/vector.inc"
4+
#define T AbstractMeterNode
5+
#define T_polymorphic
6+
#define Vector MeterNodeVector
7+
#define VectorIterator MeterNodeVectorIterator
98

10-
#undef _iterator
11-
#undef _vector
12-
#undef _pointer
13-
#undef _type
9+
#include "vector/template.inc"
10+
11+
#undef VectorIterator
12+
#undef Vector
13+
#undef T_polymorphic
14+
#undef T
1415

1516
end module MAPL_MeterNodeVector

profiler/StubProfiler.F90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "MAPL_ErrLog.h"
1+
#include "MAPL.h"
22
module MAPL_StubProfiler
33
use MAPL_BaseProfiler, only: BaseProfiler
44
use MAPL_DistributedProfiler
@@ -62,7 +62,8 @@ subroutine copy(new, old)
6262
class(StubProfiler), target, intent(inout) :: new
6363
class(BaseProfiler), target, intent(in) :: old
6464

65-
call new%copy_profiler(old)
65+
_HERE
66+
!# call new%copy_profiler(old)
6667

6768
end subroutine copy
6869

profiler/TimeProfiler.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#include "unused_dummy.H"
2-
#include "MAPL_ErrLog.h"
1+
#include "MAPL.h"
32

43
module mapl_TimeProfiler_private
54
use mapl_BaseProfiler, only: BaseProfiler
@@ -49,7 +48,8 @@ subroutine copy(new, old)
4948
class(TimeProfiler), target, intent(inout) :: new
5049
class(BaseProfiler), target, intent(in) :: old
5150

52-
call new%copy_profiler(old)
51+
_HERE
52+
!# call new%copy_profiler(old)
5353

5454
end subroutine copy
5555

0 commit comments

Comments
 (0)