-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathfield_statistics_module.F90
70 lines (40 loc) · 1.78 KB
/
field_statistics_module.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
MODULE FIELD_STATISTICS_MODULE
USE PARKIND1, ONLY : JPIB, JPIM
IMPLICIT NONE
TYPE FIELD_STATISTICS_TYPE
INTEGER (KIND=JPIB) :: MEMORY_HOST_CUR = 0
INTEGER (KIND=JPIB) :: MEMORY_HOST_MAX = 0
INTEGER (KIND=JPIB) :: MEMORY_DEVICE_CUR = 0
INTEGER (KIND=JPIB) :: MEMORY_DEVICE_MAX = 0
INTEGER (KIND=JPIB) :: NFIELDS_CUR = 0
INTEGER (KIND=JPIB) :: NFIELDS_MAX = 0
END TYPE
LOGICAL, SAVE :: FIELD_STATISTICS_ENABLE = .FALSE.
TYPE (FIELD_STATISTICS_TYPE), SAVE :: FIELD_STATISTICS
CONTAINS
SUBROUTINE FIELD_STATISTICS_NEW ()
FIELD_STATISTICS%NFIELDS_CUR = FIELD_STATISTICS%NFIELDS_CUR+1
FIELD_STATISTICS%NFIELDS_MAX = MAX(FIELD_STATISTICS%NFIELDS_CUR,FIELD_STATISTICS%NFIELDS_MAX)
END SUBROUTINE
SUBROUTINE FIELD_STATISTICS_DELETE ()
FIELD_STATISTICS%NFIELDS_CUR = FIELD_STATISTICS%NFIELDS_CUR-1
END SUBROUTINE
SUBROUTINE FIELD_STATISTICS_HOST_ALLOCATE (KSIZE)
INTEGER (KIND=JPIB), INTENT (IN) :: KSIZE
FIELD_STATISTICS%MEMORY_HOST_CUR = FIELD_STATISTICS%MEMORY_HOST_CUR+KSIZE
FIELD_STATISTICS%MEMORY_HOST_MAX = MAX(FIELD_STATISTICS%MEMORY_HOST_CUR,FIELD_STATISTICS%MEMORY_HOST_MAX)
END SUBROUTINE
SUBROUTINE FIELD_STATISTICS_HOST_DEALLOCATE (KSIZE)
INTEGER (KIND=JPIB), INTENT (IN) :: KSIZE
FIELD_STATISTICS%MEMORY_HOST_CUR = FIELD_STATISTICS%MEMORY_HOST_CUR-KSIZE
END SUBROUTINE
SUBROUTINE FIELD_STATISTICS_DEVICE_ALLOCATE (KSIZE)
INTEGER (KIND=JPIB), INTENT (IN) :: KSIZE
FIELD_STATISTICS%MEMORY_DEVICE_CUR = FIELD_STATISTICS%MEMORY_DEVICE_CUR+KSIZE
FIELD_STATISTICS%MEMORY_DEVICE_MAX = MAX(FIELD_STATISTICS%MEMORY_DEVICE_CUR,FIELD_STATISTICS%MEMORY_DEVICE_MAX)
END SUBROUTINE
SUBROUTINE FIELD_STATISTICS_DEVICE_DEALLOCATE (KSIZE)
INTEGER (KIND=JPIB), INTENT (IN) :: KSIZE
FIELD_STATISTICS%MEMORY_DEVICE_CUR = FIELD_STATISTICS%MEMORY_DEVICE_CUR-KSIZE
END SUBROUTINE
END MODULE