-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple Fortran examples from TAU to tests/fortran
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|