Line data Source code
1 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3 : !!!! !!!!
4 : !!!! ParaMonte: Parallel Monte Carlo and Machine Learning Library. !!!!
5 : !!!! !!!!
6 : !!!! Copyright (C) 2012-present, The Computational Data Science Lab !!!!
7 : !!!! !!!!
8 : !!!! This file is part of the ParaMonte library. !!!!
9 : !!!! !!!!
10 : !!!! LICENSE !!!!
11 : !!!! !!!!
12 : !!!! https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md !!!!
13 : !!!! !!!!
14 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16 :
17 : !> \brief
18 : !> This file contains procedure implementations of [pm_bench](@ref pm_bench).
19 : !>
20 : !> \finmain
21 : !>
22 : !> \author
23 : !> \AmirShahmoradi, Saturday 1:30 AM, August 20, 2016, Institute for Computational Engineering and Sciences, UT Austin, TX
24 :
25 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 :
27 : #if getTiming_ENABLED || setTiming_ENABLED
28 : #if getTiming_ENABLED
29 : #define TIMING timing
30 : #elif setTiming_ENABLED
31 : #define TIMING self%timing
32 : #endif
33 : integer(IK) :: lenTime
34 : integer(IK) :: counter
35 : integer(IK) :: miniter_def
36 : real(RKD) :: minsec_def
37 46 : if (present(miniter)) then
38 9 : miniter_def = miniter
39 : else
40 37 : miniter_def = self%miniter
41 : end if
42 46 : if (present(minsec)) then
43 4 : minsec_def = minsec
44 : else
45 42 : minsec_def = self%minsec
46 : !if (present(miniter) .and. miniter_def > 1_IK) then
47 : ! minsec_def = 0._RKD
48 : !else
49 : ! minsec_def = self%minsec
50 : !end if
51 : end if
52 46 : call self%exec()
53 46 : lenTime = 10000_IK
54 46 : if (allocated(TIMING%VALUES)) deallocate(TIMING%VALUES)
55 46 : allocate(TIMING%VALUES(lenTime))
56 46 : counter = 1_IK
57 46 : TIMING%overhead = 0._RKD
58 46 : TIMING%mean = 0._RKD
59 2180578 : loopRepeatTiming: do
60 2180624 : self%timer%start = self%timer%time()
61 2180624 : call self%exec()
62 2180624 : TIMING%VALUES(counter) = max(self%timer%time(since = self%timer%start), self%timer%resol)
63 2180624 : TIMING%mean = TIMING%mean + TIMING%VALUES(counter)
64 2180624 : self%timer%start = self%timer%time()
65 2180624 : call self%overhead()
66 2180624 : TIMING%overhead = TIMING%overhead + self%timer%time(since = self%timer%start)
67 2180624 : if (minsec_def <= TIMING%mean .and. miniter_def <= counter) exit loopRepeatTiming
68 2180578 : if (counter == lenTime) then
69 105 : lenTime = 2_IK * lenTime
70 105 : call setResized(TIMING%VALUES, size = lenTime)
71 : end if
72 2180578 : counter = counter + 1_IK
73 : end do loopRepeatTiming
74 46 : if (size(TIMING%VALUES, kind = IK) /= counter) call setResized(TIMING%VALUES, size = counter)
75 46 : TIMING%overhead = TIMING%overhead / counter
76 46 : TIMING%mean = max(self%timer%resol, TIMING%mean / counter - TIMING%overhead)
77 46 : TIMING%std = 0._RKC
78 46 : if (1_IK < size(TIMING%VALUES, 1, IK)) TIMING%std = max(self%timer%resol, sqrt(getVar(TIMING%VALUES)))
79 2180716 : TIMING%min = max(self%timer%resol, minval(TIMING%VALUES) - TIMING%overhead)
80 2180716 : TIMING%max = max(self%timer%resol, maxval(TIMING%VALUES) - TIMING%overhead)
81 : #else
82 : #error "Unrecognized interface."
83 : #endif
84 : #undef TIMING
|