Skip to content

Commit

Permalink
Modernize some of the fortran examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeekman committed Dec 10, 2024
1 parent 9b45b71 commit 30137a8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
28 changes: 14 additions & 14 deletions tests/fortran/cubes.f
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
cc34567 Cubes program
PROGRAM SUM_OF_CUBES
INTEGER :: H, T, U
! This program prints all 3-digit numbers that
program sum_of_cubes
implicit none
integer :: h, t, u
! this program prints all 3-digit numbers that
! equal the sum of the cubes of their digits.
DO H = 1, 9
DO T = 0, 9
DO U = 0, 9
IF (100*H + 10*T + U == H**3 + T**3 + U**3) THEN
PRINT "(3I1)", H, T, U
ENDIF
END DO
END DO
END DO
END PROGRAM SUM_OF_CUBES
do h = 1, 9
do t = 0, 9
do u = 0, 9
if (100*h + 10*t + u == h**3 + t**3 + u**3) then
print "(3I1)", h, t, u
endif
end do
end do
end do
end program sum_of_cubes
32 changes: 16 additions & 16 deletions tests/fortran/cubes.hand-inst.f
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
cc34567 Cubes program
PROGRAM SUM_OF_CUBES
integer profiler(2) / 0, 0 /
save profiler
INTEGER :: H, T, U
!c34567 Cubes program
program sum_of_cubes
integer profiler(2) / 0, 0 /
save profiler
integer :: H, T, U
call TAU_PROFILE_INIT()
call TAU_PROFILE_TIMER(profiler, 'PROGRAM SUM_OF_CUBES')
call TAU_PROFILE_TIMER(profiler, 'program sum_of_cubes')
call TAU_PROFILE_START(profiler)
call TAU_PROFILE_SET_NODE(0)
! This program prints all 3-digit numbers that
! equal the sum of the cubes of their digits.
DO H = 1, 9
DO T = 0, 9
DO U = 0, 9
IF (100*H + 10*T + U == H**3 + T**3 + U**3) THEN
PRINT "(3I1)", H, T, U
ENDIF
END DO
END DO
END DO
do h = 1, 9
do t = 0, 9
do u = 0, 9
if (100*h + 10*t + u == h**3 + t**3 + u**3) then
print "(3I1)", h, t, u
endif
end do
end do
end do
call TAU_PROFILE_STOP(profiler)
END PROGRAM SUM_OF_CUBES
end program sum_of_cubes
12 changes: 6 additions & 6 deletions tests/fortran/loop_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ subroutine foo(iVal)
end do
end do

do 10, i = 1, 3
call bar(i+iVal)
10 continue
do i = 1, 3
call bar(i+iVal)
end do
print *, "after calling bar in foo"
end
end subroutine foo

program main
integer i

print *, "test program"

do 10, i = 1, 3
do i = 1, 3
call foo(i)
10 continue
end do
end program main

0 comments on commit 30137a8

Please sign in to comment.