| 1 | module parametrise |
| 2 | implicit none |
| 3 | contains |
| 4 | |
| 5 | subroutine stop_execution(msg) |
| 6 | character(200), INTENT(IN) :: msg |
| 7 | PRINT *, msg |
| 8 | stop 1 |
| 9 | end subroutine stop_execution |
| 10 | |
| 11 | subroutine driver(a, b, c, d) |
| 12 | integer, intent(inout) :: a, b, d(b) |
| 13 | integer, intent(inout) :: c(a, b) |
| 14 | real :: x, y |
| 15 | call kernel1(a, b, c) |
| 16 | call kernel2(a, b, d) |
| 17 | call kernel1(a, b, c) |
| 18 | end subroutine driver |
| 19 | |
| 20 | subroutine another_driver(a, b, c) |
| 21 | integer, intent(in) :: a |
| 22 | integer, intent(in) :: b |
| 23 | integer, intent(inout) :: c(a, b) |
| 24 | real :: x(a) |
| 25 | call kernel1(a, b, c) |
| 26 | end subroutine another_driver |
| 27 | |
| 28 | subroutine kernel1(a, b, c) |
| 29 | integer, intent(in) :: a |
| 30 | integer, intent(in) :: b |
| 31 | integer, intent(inout) :: c(a, b) |
| 32 | integer :: local_a |
| 33 | real :: x(a) |
| 34 | integer :: y(a, b) |
| 35 | real :: k1_tmp(a, b) |
| 36 | y = 11 |
| 37 | c = y |
| 38 | end subroutine kernel1 |
| 39 | |
| 40 | subroutine kernel2(a_new, b, d) |
| 41 | integer, intent(in) :: a_new |
| 42 | integer, intent(in) :: b |
| 43 | integer, intent(inout) :: d(b) |
| 44 | real :: x(a_new) |
| 45 | real :: y, z |
| 46 | real :: k2_tmp(a_new, a_new) |
| 47 | call device1(a_new, b, d, x, k2_tmp) |
| 48 | end subroutine kernel2 |
| 49 | |
| 50 | subroutine device1(a, b, d, x, y) |
| 51 | integer, intent(in) :: a |
| 52 | integer, intent(in) :: b |
| 53 | integer, intent(inout) :: d(b) |
| 54 | real, intent(inout) :: x(a) |
| 55 | real, intent(inout) :: y(a, a) |
| 56 | real :: z |
| 57 | integer :: d1_tmp |
| 58 | call device2(a, b, d, x) |
| 59 | call device2(a, b, d, x) |
| 60 | end subroutine device1 |
| 61 | |
| 62 | subroutine device2(a, b, d, x) |
| 63 | integer, intent(in) :: a |
| 64 | integer, intent(in) :: b |
| 65 | integer, intent(inout) :: d(b) |
| 66 | real, intent(inout) :: x(a) |
| 67 | integer z(b) |
| 68 | integer :: d2_tmp(b) |
| 69 | z = 42 |
| 70 | d = z |
| 71 | end subroutine device2 |
| 72 | |
| 73 | end module parametrise |