Skip to content

Commit

Permalink
Add simple Fortran examples from TAU to tests/fortran
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaimov committed Dec 6, 2024
1 parent 81a8308 commit 83eba75
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/fortran/cubes.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cc34567 Cubes program
PROGRAM SUM_OF_CUBES
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
22 changes: 22 additions & 0 deletions tests/fortran/cubes.hand-inst.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cc34567 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_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
call TAU_PROFILE_STOP(profiler)
END PROGRAM SUM_OF_CUBES
File renamed without changes.
33 changes: 33 additions & 0 deletions tests/fortran/loop_test.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
subroutine bar(arg)
integer arg

print *, "inside bar arg = ", arg
end subroutine bar

subroutine foo(iVal)
integer iVal
integer j, k
! Do something here...
print *, "Iteration = ", iVal
do j = 1, 5
do k = 1, 2
print *, "j = ", j
end do
end do

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

program main
integer i

print *, "test program"

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

0 comments on commit 83eba75

Please sign in to comment.