TIDE
Languages

Fortran

Installing Fortran on Ubuntu in TIDE

Fortran

Fortran (Formula Translation) is a compiled imperative programming language optimized for numeric computing, matrix algebra, and scientific engineering simulations. It remains a foundational language for High-Performance Computing (HPC), weather prediction, fluid dynamics, and aerospace design.

Installation

The standard open-source compiler on Linux is GNU Fortran (gfortran), part of the GNU Compiler Collection (GCC).

Update package lists and install gfortran along with essential build tools:

apt update
apt install -y gfortran build-essential

Option 2: Installing Fortran Package Manager (fpm)

fpm is the official package manager and build tool for modern Fortran development:

curl -s https://raw.githubusercontent.com/fortran-lang/fpm/main/install.sh | bash
export PATH=$PATH:$HOME/.local/bin

Verification

Confirm that gfortran is installed and ready to compile:

gfortran --version

Writing and Compiling Code

Writing a Modern Fortran Source File

Create a file named hello.f90:

program hello
    implicit none
    print *, "Hello, World from Fortran in TIDE!"
end program hello

Compiling and Executing with GFortran

Compile the source file into a native binary:

gfortran hello.f90 -o hello
./hello

To compile with compiler optimizations (e.g. for numerical benchmarks):

gfortran -O3 -march=native hello.f90 -o hello_opt
./hello_opt

Building Projects with fpm

Initialize, build, and run structured Fortran projects with fpm:

fpm new hello_app
cd hello_app
fpm run

Official Resources

On this page