answersLogoWhite

0


Best Answer

Fortran is a programming language, which means you write a program in Fortran, and COMPILE it to an EXECUTABLE program. The compiler you use differs depending on which operating system platform you intend to run the program on. If you wish to run the program on a PC using Windows XP, you must first compile it using a specific Fortran-compiler for Windows XP. The result after compiling will be an executable file (with the file-ending .exe). To find a suitable compiler, check out download.com, for instance.

Given that you know it is Fortran Code, we can assume that you do not have a compiled one, but just raw Frotran Source code.

To compile it, you need a Fortan compiler suitable for both your operating system as well as the version of Fortran the code was written for.

There is a free Fortran Compiler for Fortran77 from the GNU Project:

For Windows: http://www.geocities.com/Athens/Olympus/5564/

For Unix: http://www.gnu.org/software/fortran/fortran.HTML

The above is correct assuming your question is "Given the Fortran source code, how do I run it?" However if your question is "Given the Fortran executable (ProgName.exe) how do I run it?", the is that you run it like any other program. You either: 1 - Double-click on the file name OR 2 - Open a DOS window, go to the directory where the file is and type in the filename with or without the extension .exe OR 3 - You can select Start and Run and type in the filename.

Like any "compilable" language it can be used to build an exe or a dll. But a dll MUST be called by another program to run, you can only run a .exe directly.

------------------

In addition the workflow for running a Fortran program on a *nix platform (such as Unix, Linux, or Mac OSx) would be as such:

1) Write given Fortran code with proper extension

a) Fortran 77 - *.fb) Fortran 90 - *.f90c) Fortran 95 - *.f95

2) Compile using your compiler suite (showing examples for a few different cases)

a) for gfortran as mentioned abovegfortran myfile.f90 -o myExecutableg77 myfile.f77 -o myExecutableb) for OpenMPImpif90 myfile.f90 -o myExecutablempif77 myfile.f77 -o myExecutablec) for Intel Fortranifort myfile.f90 -o myExecutable

3) To run the executable first make sure it is marked as executable, this can by going to the folder in which it was compiled then typing:

ls -l

You will then see the myExecutable file marked with permissions. Check to see if the executable permission is there. If it is not, you must change permissions to allow it to be executed. This is done by typing:

chmod a+x myExecutable

4) Finally to actually run the code you simple add the execution prefix:

./myExecutable

This will cause the file to run with output in the current terminal session. Note that if you terminate the terminal/ssh session, the code execution will halt. If you want to execute a large piece of code on lets say a remote computer (or a cluster for scientific computing) then you do the following step instead of 4

4*) To run the executable in backround and log terminal output (if you don't want to keep the terminal window open) you use the following command:

nohup ./myExecutable > terminalOuput.txt &

This will cause the executable to run in the background, it will the tell terminal not to hang up (nohup) if you close the window, and it will append the terminal output to the file terminalOutput.txt

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which command would you use to run a Fortran code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why learn Fortran?

Fortran was designed by, and for, people who wanted raw number-crunching speed. There's a great deal of legacy code written in Fortran, and the embarrassing (to snobs who prefer object-oriented languages) secret is that attempts to rewrite that code in a more "stylish" language result in programs that just don't run as fast.


To print even nobetween 10 and 100 on qbasic command?

You need a code that can run to print even numbers between 10 and 100 using the qbasic command.


The command used to execute a BASIC programme?

Assuming a BASIC program is loaded into memory, the correct command to execute a BASIC program is: RUN. If you would like to start your program at a particular point in the execution, you may use RUN [#], where [#] is the line number you would like to start execution at.


How do you run HTML notpad code?

To "run" HTML code, you simply need to open it using a web browser. This can be done by placing the file on the server and pointing the browser to it, or you can use the native "Open File..." command in the browser itself. If you want to learn HTML you can visit one of the websites in the related links.


How do you make a batch file run a command on a specific date automatically and not when you click it?

Look into scheduling using the AT command.Schedule the program to run once:AT 2am /NEXT:Thursday "batch_file.bat"The above command will set batch_file.bat to run at 2AM on the next Thursday.Schedule the program to run every week:AT 2am /EVERY:Thursday"batch_file.bat"This command is similar, but sets batch_file.bat to run at 2AM every week on Thursday.

Related questions

Why learn Fortran?

Fortran was designed by, and for, people who wanted raw number-crunching speed. There's a great deal of legacy code written in Fortran, and the embarrassing (to snobs who prefer object-oriented languages) secret is that attempts to rewrite that code in a more "stylish" language result in programs that just don't run as fast.


How do you command someone to run in Spanish?

To command someone to run in Spanish, you would say 'corre.'


How do run the fortran program?

on the commad promt type RUN followed by the file name,then press enter.


How do you repeatedly run a code in command prompt?

You cannot repeatedly run a code in command prompt unless you create a batch script that will repeat the codes inside it. To create a script, you must open notepad. Type :A (colon A). Then below that code, type the codes you want to repeatedly run. Below the codes, write "goto A" (without quotes). Save this script as anything you like with a .bat extension. When you click the .bat script, it will read the code. On the last line of code, it will repeat any codes that is in between :A and goto A. You can also change the "A" into anything you would like.


What command would you use to show the current version of DOS Windows?

open command prompt and run 'ver'


To print even nobetween 10 and 100 on qbasic command?

You need a code that can run to print even numbers between 10 and 100 using the qbasic command.


What command would you run at the command prompt to display all of your computers addresses?

You can use the command:ipconfig /all


What command would you run from a windows command line to verify that a nic can send and receive ipv4 packets?

ping 127.0.0.1


What is the run dialog command to open Netmeeting?

Type conf.exe as a run command.


What is the way to use the run command line to open a command prompt?

run cmd.exe


What start run command launches the command prompt?

To launch the command prompt in run, type CMD and hit enter/ok.


What is the command to run windows explorer from the command line?

The command is: "start explorer.exe".