-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdriver.f90
More file actions
96 lines (63 loc) · 1.94 KB
/
driver.f90
File metadata and controls
96 lines (63 loc) · 1.94 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
program driver
integer :: NDIM
real (kind=8) :: wall_start, wall_end
real (kind=8) :: cpu_start, cpu_end
real (kind=8) :: trace
integer :: startval, stopval, stepval
real (kind=8) :: walltime
real (kind=8) :: cputime
external walltime, cputime
character (len=8) :: carg1, carg2, carg3
real (kind=8), dimension(:), allocatable :: veca, vecb
real (kind=8), dimension(:,:), allocatable :: matrixa, matrixb, matrixc
!modified to use command line arguments
call get_command_argument(1, carg1)
call get_command_argument(2, carg2)
call get_command_argument(3, carg3)
! Use Fortran internal files to convert command line arguments to ints
read (carg1,'(i8)') startval
read (carg2,'(i8)') stopval
read (carg3,'(i8)') stepval
do iter = startval, stopval, stepval
NDIM = iter
allocate ( veca(NDIM), stat=ierr)
allocate ( vecb(NDIM), stat=ierr)
allocate ( matrixa(NDIM,NDIM), stat=ierr)
allocate ( matrixb(NDIM,NDIM), stat=ierr)
allocate ( matrixc(NDIM,NDIM), stat=ierr)
do i = 1, NDIM
veca(i) = 1.0
vecb(i) = 1.0 / sqrt( dble(NDIM))
enddo
matrixa = 0.0
matrixb = 0.0
call vvm(NDIM, veca, vecb, matrixa);
call vvm(NDIM, veca, vecb, matrixb);
wall_start = walltime()
cpu_start = cputime()
call mmm(NDIM, matrixa, matrixb, matrixc);
cpu_end = cputime()
wall_end = walltime()
trace = 0.0;
do i=1, NDIM
trace = trace + matrixc(i,i)
enddo
!print *, "The trace is ", trace
mflops = dble(NDIM)**3/ (cpu_end-cpu_start) / 1.0e6
mflops2 = dble(NDIM)**3/ (wall_end-wall_start)/ 1.0e6
print *, NDIM, trace, cpu_end-cpu_start, wall_end-wall_start, mflops, mflops2
!print *, " "
!print *, " Run took ", minutes, " minutes and ", seconds, &
! " seconds of processor time."
!print *, " "
!print *, " "
!print *, " Run took ", w_minutes, " minutes and ", w_seconds, &
! " seconds of wall clock time."
!print *, " "
deallocate(matrixa)
deallocate(matrixb)
deallocate(matrixc)
deallocate(veca)
deallocate(vecb)
enddo
end program driver