- #1
geouke
- 9
- 0
I am going to use Fortran and Python as examples of a compiled and a scripting language in this question.
If I write a Fortran program and compile it, it is going to process data more quickly than a python script that does the same thing. However, what if I write a Fortran program that allows user-supplied data without re-compiling. For example, 'program_name data.dat' at the console would feed a data file into a Fortran program that would process it and spit out an answer. An even more general example would be if I write a Fortran console program that allows a user to define variables, do special functions, plot easily, etc. In other words, I have created a scripting language with Fortran. These are my questions:
(1) If a data file is read in using 'program_name data.dat' rather than the data being compiled into an executable and ran, have I lost some execution speed other than the time it takes the program to read the data? Why?
(2) It takes program_name.f03 time 't1' to compile and run and it takes 'program_name data.dat' time 't2' to read data and execute, is t1 <. ==. or > t2? Why?
I am in a graduate program where I need to do potentially time-consuming models repetitively with different parameters. The question of whether to use Fortran or Python for small tasks is obvious, but I am wondering what I have gained by using Fortran. More importantly, I would like to know why I have gained.
Thanks! You guys are always great.
If I write a Fortran program and compile it, it is going to process data more quickly than a python script that does the same thing. However, what if I write a Fortran program that allows user-supplied data without re-compiling. For example, 'program_name data.dat' at the console would feed a data file into a Fortran program that would process it and spit out an answer. An even more general example would be if I write a Fortran console program that allows a user to define variables, do special functions, plot easily, etc. In other words, I have created a scripting language with Fortran. These are my questions:
(1) If a data file is read in using 'program_name data.dat' rather than the data being compiled into an executable and ran, have I lost some execution speed other than the time it takes the program to read the data? Why?
(2) It takes program_name.f03 time 't1' to compile and run and it takes 'program_name data.dat' time 't2' to read data and execute, is t1 <. ==. or > t2? Why?
I am in a graduate program where I need to do potentially time-consuming models repetitively with different parameters. The question of whether to use Fortran or Python for small tasks is obvious, but I am wondering what I have gained by using Fortran. More importantly, I would like to know why I have gained.
Thanks! You guys are always great.