-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsequential_code.f90
More file actions
33 lines (28 loc) · 856 Bytes
/
sequential_code.f90
File metadata and controls
33 lines (28 loc) · 856 Bytes
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
program sequential_code
implicit none
integer, parameter :: dp = selected_real_kind(15,307)
real, dimension(:), allocatable :: a, b
real(dp) :: start_t, end_t
integer, parameter :: n = 1000000
integer :: i
call cpu_time(start_t)
do i = 1, 100
call random_seed
allocate(a(n), b(n))
call random_number(a)
call process(a, b, n)
deallocate(a, b)
enddo
call cpu_time(end_t)
write(*,20) end_t-start_t
20 format('Total elapsed time is ', f10.5, ' seconds.')
contains
subroutine process( a, b, n )
real, intent(inout) :: a(n), b(n)
integer, intent(in) :: n
integer :: i
do i = 1, n
b(i) = exp(sin(a(i)))
enddo
end subroutine process
end program sequential_code