| 1 | module subroutines_inline_mod |
| 2 | implicit none |
| 3 | integer, parameter :: len = 3 |
| 4 | contains |
| 5 | |
| 6 | function func1(a) |
| 7 | integer, intent(in) :: a |
| 8 | integer :: func1(a) |
| 9 | |
| 10 | func1 = 1 |
| 11 | end function func1 |
| 12 | |
| 13 | subroutine kernel1(a, b, c) |
| 14 | integer, intent(in) :: a |
| 15 | integer, intent(inout) :: b(a) |
| 16 | integer, intent(inout) :: c(a, len) |
| 17 | real :: x(a) |
| 18 | integer :: y(a, len) |
| 19 | real :: k1_tmp(a, len) |
| 20 | y = 11 |
| 21 | c = y |
| 22 | x = func1(a) |
| 23 | end subroutine kernel1 |
| 24 | |
| 25 | subroutine kernel2(a1, b) |
| 26 | integer, intent(in) :: a1 |
| 27 | integer, intent(inout) :: b(a1) |
| 28 | real :: x(a1) |
| 29 | real :: y, z |
| 30 | real :: k2_tmp(a1, a1) |
| 31 | call device1(a1, b, x, k2_tmp) |
| 32 | call device2(a1, b, x) |
| 33 | end subroutine kernel2 |
| 34 | |
| 35 | subroutine device1(a1, b, x, y) |
| 36 | integer, intent(in) :: a1 |
| 37 | integer, intent(inout) :: b(a1) |
| 38 | real, intent(inout) :: x(a1) |
| 39 | real, intent(inout) :: y(a1, a1) |
| 40 | real :: z |
| 41 | integer :: d1_tmp |
| 42 | call device2(a1, b, x) |
| 43 | call device2(a1, b, x) |
| 44 | end subroutine device1 |
| 45 | |
| 46 | function init_int(a2) result(TMP) |
| 47 | integer, intent(in) :: a2 |
| 48 | integer :: tmp(a2) |
| 49 | integer :: tmp0(a2) |
| 50 | |
| 51 | tmp0 = 42 |
| 52 | tmp = tmp0 |
| 53 | end function init_int |
| 54 | |
| 55 | subroutine device2(a2, b, x) |
| 56 | integer, intent(in) :: a2 |
| 57 | integer, intent(inout) :: b(a2) |
| 58 | real, intent(inout) :: x(a2) |
| 59 | integer z(a2) |
| 60 | integer :: d2_tmp(len,len) |
| 61 | z = init_int(a2) |
| 62 | b = z |
| 63 | end subroutine device2 |
| 64 | |
| 65 | end module subroutines_inline_mod |
| 66 |