User Tools

Site Tools


write_and_run_your_programs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
write_and_run_your_programs [2018/05/14 18:44] yutakawrite_and_run_your_programs [2018/05/14 19:05] yutaka
Line 1: Line 1:
 ====== Write and run your programs ====== ====== Write and run your programs ======
 +
 +By Yutaka Masuda
  
 In the course, we will use a remote server to write and run (execute) your program. In the course, we will use a remote server to write and run (execute) your program.
Line 107: Line 109:
  
    * When starting the editor, you are in the command mode which accept the command to action such as exit the program, save a file, search a text etc.    * When starting the editor, you are in the command mode which accept the command to action such as exit the program, save a file, search a text etc.
-   * To input the text, push ''i'' key (meaning //insert//) or ''a'' key (//add//) to move on the edit mode. +   * To input the text, push a single key ''i'' (meaning //insert//) or ''a'' (//add//) to move on the edit mode (no Enter key)
-   * To save the file, hit Esc key to come back to the command mode, type '':w'' (//write//), and hit the Enter key.+   * To save the file, push ''Esc'' key to come back to the command mode, type '':w'' (//write//), and hit the Enter key.
    * To edit the file again, push ''i'' or ''a''.    * To edit the file again, push ''i'' or ''a''.
    * You have to move to the edit mode and come back to the command mode repeatedly to finish the program. Then type '':q'' in the command mode to quit the program.    * You have to move to the edit mode and come back to the command mode repeatedly to finish the program. Then type '':q'' in the command mode to quit the program.
- 
-{{:wiki:vimode.png?direct|}} 
  
 You should know which which model are you currently working. You should know which which model are you currently working.
 +
 +{{:wiki:vimode.png?direct|}}
  
 Hints: Hints:
  
-  * If you get lost, hit the Esc key (on the top left of the keyboard) a few times so you will move to the command mode. +  * If you get lost, hit the ''Esc'' key (on the top left of the keyboard) a few times so you will move to the command mode. 
-  * The simplest way to quit vi: hit the Esc key many times, type '':q'', and hit the Enter key.+  * The simplest way to quit //vi//: hit the Esc key many times, type '':q'', and hit the Enter key.
  
 ===== Write, compile, and run the first program ===== ===== Write, compile, and run the first program =====
Line 145: Line 147:
 Let's compile it. Let's compile it.
 //Compilation// means the program you have written (source code) is converted to the machine code (executable program). //Compilation// means the program you have written (source code) is converted to the machine code (executable program).
-We have a compiler, named ''ifort'' (Intel Fortran Compiler), on the server.+We have a compiler, named ''gfortran'' (GNU Fortran Compiler), on the server. 
 +We would use a different compiler so please ask the lecturer which compilers are available. 
 Call the compiler with your source file. Call the compiler with your source file.
  
-   ifort prog1.f90+   gfortran prog1.f90
  
 If there is no problem, you will not get any message from the compiler. If there is no problem, you will not get any message from the compiler.
Line 176: Line 180:
 The following example creates ''prog1'' instead of ''a.out''. The following example creates ''prog1'' instead of ''a.out''.
  
-   ifort prog1.f90 -o prog1+   gfortran prog1.f90 -o prog1
  
 You can execute it. You can execute it.
Line 189: Line 193:
 This is useful when you compile modules and subroutines in a separate file. This is useful when you compile modules and subroutines in a separate file.
  
-   ifort -c prog1.f90+   gfortran -c prog1.f90
  
  
  
write_and_run_your_programs.txt · Last modified: 2024/03/25 18:22 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki