Skip to content

Compile a Fortran program using ifort

ifort is an Intel Fortran compiler. This page describes how to compile Fortran code using ifort.

Procedure

1. Load the modules

Load a recent intel module:

module load intel/20.4

2. Write the Fortran program

Create and write a Fortran source file called hello_world.f:

nano hello_world.f

In nano, write the Fortran program as such:

C     HELLO.F :  PRINT MESSAGE ON SCREEN
      PROGRAM HELLO
      WRITE(*,*) "hello, world";
      END

3. Compile the C++ program

After saving and closing nano, compile as such:

ifort hello_world.f

4. Run the executable

Run the program:

./a.out 

Output:

hello, world