12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in...

28
1

Transcript of 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in...

Page 1: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

1

Page 2: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

2

Page 3: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

3

Page 4: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

4

These slides forward have been moved to lec04 (did not get to).

Page 5: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

5

Page 6: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

6

Page 7: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

7

Page 8: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

8

The difference between a standard object module (the result of compiling with the -c option) and a library (such as libraries.a above) is that only the modules that are needed are loaded from the library. When on object module (.o extent) or a Fortran module (.f extent) is included all the routines from these are linked to the program even if they are not needed.

Page 9: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

9

Page 10: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

10

Page 11: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

11

Page 12: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

12

Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option when f77 is run to force this behavior. The option is often -static. In g77, -fno-automatic is the option. (used info g77 to get information on linux machines; on athena % add fortran % g77 -v --help (lists all options)

Page 13: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

13

Page 14: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

14

Page 15: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

15

Page 16: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

16

Page 17: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

17

Page 18: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

18

Page 19: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

19

Page 20: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

20

Page 21: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

21

Page 22: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

22

Page 23: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

23

Page 24: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

24

Page 25: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

25

Page 26: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

26

Page 27: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

27

poly_area.f and vars.f should be stored in text files. If they are displayed in a web browser window and the the page saved, they should appear as text files on your system. The reason that the files sometimes do not display correctly is the way that the “end-of-line” is denoted on different OS types. In Unix, a new-line character (ASCII Octal 12 or ^J) is used, on Windows a carriage return/new-line and on MacOSX, a simple carriage return is used (ASCII octal 15, ^M).

Page 28: 12.010.Lec04tah/12.010/12.010.Lec04.pdf · 12! Loss of the values stored in variables in subroutines is not universal. Some compilers will retain values and often there is an option

28

We will be able to try these programs with g77, and fort77 on Mac OSX plus using gfortran on linerva,mit,edu