Learning Fortran: Compilers, Debugging & More

  • Fortran
  • Thread starter Sievers
  • Start date
  • Tags
    Fortran
In summary: However, that's not strictly necessary. You could use the "print" statement to output values, but you might need to modify the code to do this, if the code runs in an environment from which you can't see output.In summary, for learning Fortran, you will need a code editor, a compiler, and possibly a debugger. There are many options for each, so it's best to do some research and find what works best for you. Additionally, seeking out tutorials and other books can also be helpful in learning the language.
  • #1
Sievers
1
0
Hi guys

Im quite proficient when it comes to Matlab, and am now scheduled to learn Fortran 90/95 for a PhD-project (OS: winXP/win7) and I want to ease the transition as much as possible. I have been scouring the internet to learn more about what I am faced with and one thing keeps bugging me: While there seem to be plenty of tutorials explaining how the language itself works (I have recently gotten the "Fortran 95/2003 explained" book as well), there seem to be little or no information on how to set everything up to run. Which surprises me as this seems to not just be a simple "Install and use" program. By now I understand that the compiler is the 'engine', into which code must be thrown, for an eventual output. So i guess my question is simply:

  • In which program should I then write my code? (Cygwin is a name that keeps popping up but I also understand that there are several alternatives?)
  • Which compiler should I use (g95, gfortran, etc? All documentation and opinions I find are from 2007 and back, so I guess much have changed)
  • I read somewhere that a debugging environment would be needed as well? Which, and where can I learn more?
  • Is the installation process simply just what I listed above? "Code-editor -> Compiler -> Debugger"?
  • Also, apart from the book I already purchased, do you have any valuable suggestions (tutorials, other books, etc.) as how to best go around learning Fortran.

Thanks in advance!
 
Technology news on Phys.org
  • #2
No one has responded, so I'll put in my 2 cents.
Sievers said:
Hi guys

Im quite proficient when it comes to Matlab, and am now scheduled to learn Fortran 90/95 for a PhD-project (OS: winXP/win7) and I want to ease the transition as much as possible. I have been scouring the internet to learn more about what I am faced with and one thing keeps bugging me: While there seem to be plenty of tutorials explaining how the language itself works (I have recently gotten the "Fortran 95/2003 explained" book as well), there seem to be little or no information on how to set everything up to run. Which surprises me as this seems to not just be a simple "Install and use" program. By now I understand that the compiler is the 'engine', into which code must be thrown, for an eventual output.
Right. A Fortran development system is not just a program - it consists of at the least a compiler and linker. The compiler translates your Fortran code to object code, and the linker combines your object code with other code you used, and produces an executable.
Sievers said:
So i guess my question is simply:

  • In which program should I then write my code? (Cygwin is a name that keeps popping up but I also understand that there are several alternatives?)
  • Which compiler should I use (g95, gfortran, etc? All documentation and opinions I find are from 2007 and back, so I guess much have changed)
  • I read somewhere that a debugging environment would be needed as well? Which, and where can I learn more?
  • Is the installation process simply just what I listed above? "Code-editor -> Compiler -> Debugger"?
  • Also, apart from the book I already purchased, do you have any valuable suggestions (tutorials, other books, etc.) as how to best go around learning Fortran.

Thanks in advance!

The code you write is a text file, so anything from Notepad or equivalent on up can be used.
The last Fortran compiler I used was about 15 years ago, and was from Lahey. I don't have any experience with the compilers you listed, so can't make any recommendations.
A debugging environment isn't an absolute requirement, but I wouldn't want to try to write programs without one.

The development process for an application you write (as opposed to installing the development tools) is 1) write code in editor --> 2) compile code --> 3) link code. If the compiler finds errors, you use the information the compiler gives you to go back to step 1. After all semantic errors are fixed, it's possible that you have linker errors, which also need to be fixed.

After you get an executable (no compiler errors or linker errors) it's possible you have errors in logic that cause your application to produce erroneous results. That's where the debugger comes in handy, allowing you to single-step through the code to verify that the appropriate values are being calculated.
 

What is Fortran?

Fortran is a programming language commonly used for scientific and mathematical computations. It was first developed in the 1950s and has since undergone several updates and revisions.

What is a compiler?

A compiler is a software program that translates high-level programming language code into machine code that can be understood and executed by a computer. In Fortran, a compiler is necessary to create an executable program from the source code.

How do I debug my Fortran code?

Debugging is the process of identifying and fixing errors in a program's code. In Fortran, you can use tools such as debuggers or IDEs (Integrated Development Environments) to help locate and correct any issues in your code.

What are the advantages of learning Fortran?

Fortran is a highly efficient language for scientific and mathematical computations, making it well-suited for tasks such as data analysis, simulations, and modeling. It also has a large library of built-in functions and is widely used in various industries, making it a valuable skill for scientists and researchers.

How can I improve my skills in Fortran?

To improve your Fortran skills, you can practice writing code, read documentation and tutorials, and participate in online forums or communities dedicated to Fortran. You can also consider taking courses or attending workshops to learn advanced techniques and best practices for coding in Fortran.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
2
Views
4K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
Back
Top