-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.f90
64 lines (52 loc) · 1.38 KB
/
main.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
program main
use mpi
use mod_timer
implicit none
interface sleep
procedure sleep_r
end interface
integer, parameter :: n = 3
integer :: i,ierr,myid
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD,myid,ierr)
do i = 1,n
if(myid == 0) print*,'Iteration #',i,'of',n
if(myid == 0) print*,''
call timer_tic('First Thing',1)
call sleep(0.10)
call timer_tic('Sub-First Thing',0)
call sleep(0.05)
call timer_toc('Sub-First Thing')
call timer_toc('First Thing')
call timer_tic('Second Instance',2)
call sleep(0.15)
call timer_toc('Second Instance')
call timer_tic('Second Instance',2)
call sleep(0.15)
call timer_toc('Second Instance')
call timer_tic('First Thing',1)
call sleep(0.15)
call timer_toc('First Thing')
call timer_tic('Third Event',3,'c')
call sleep(0.25)
call timer_toc('Third Event')
call timer_tic('Fourth Event',0)
call sleep(0.35)
call timer_toc('Fourth Event')
end do
call timer_print(myid)
call timer_cleanup
call MPI_Finalize(ierr)
contains
subroutine sleep_r(s)
implicit none
interface
subroutine usleep(us) bind(C)
use, intrinsic :: iso_c_binding, only:c_int
integer(c_int), value :: us
end subroutine usleep
end interface
real, intent(in) :: s
call usleep(int(s*10**6))
end subroutine sleep_r
end program main