aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.F9022
1 files changed, 19 insertions, 3 deletions
diff --git a/src/main.F90 b/src/main.F90
index b0f0ffb..97e8e2d 100644
--- a/src/main.F90
+++ b/src/main.F90
@@ -7,11 +7,27 @@ PROGRAM mul
integer, parameter :: seed = 123456
real :: time
- integer :: dim = 10, multype = 1, realtype = 8
+ integer :: dim = 10, multype = 1, real_kind, stat
+ character(5) :: kind_arg
+ IF (command_argument_count() < 1) THEN
+ write (error_unit, *) "Usage: mul KIND", char(10), &
+ "where KIND is one of: 4, 8, 16"
+ STOP
+ END IF
+
+ call get_command_argument(1, kind_arg)
+
+ read (kind_arg, *, iostat = stat) real_kind
+
+ IF (stat .ne. 0) THEN
+ write (error_unit, *) "Couldn't parse kind number argument"
+ STOP
+ END IF
+
DO WHILE (dim < 2000)
- SELECT CASE(realtype)
+ SELECT CASE(real_kind)
CASE (4,1)
time = measure_4(dim)
CASE (8,2)
@@ -19,7 +35,7 @@ PROGRAM mul
CASE (16,3)
time = measure_16(dim)
CASE default
- write (error_unit, *) "wrong kind for real: ", realtype
+ write (error_unit, *) "wrong kind for real: ", real_kind
STOP
END SELECT