Skip to content

Fortran tips

Lars Vilhuber edited this page Feb 28, 2024 · 9 revisions

Fortran can come in several flavors, the most frequent being Intel Fortran and GNU Fortran. The former can be run on all platforms (Windows, Mac, Linux) but may perform differently on these. The latter is typically found on Linux.

Intel Fortran

Through compiler versions 2019.x, these are typically installed, and may require a license. On Windows, requires additional software (Visual Studio - not Code! - and various libraries.

Running on Windows is complicated....

As Docker

From 2021.x on, Intel also offers a license-free Docker solution. This makes it much simpler - at least on Linux - to run compilers. See Intel page. In a nutshell, if you already have Docker installed, do the following steps.

On BioHPC, replace docker with docker1.

Download the Intel docker image

Verify at https://hub.docker.com/r/intel/oneapi-hpckit/tags the tag that you want. Download a specific tag. We will refer to it as $TAG

TAG=2024.0.1-devel-ubuntu22.04

and then

docker pull intel/oneapi-hpckit:$TAG

Running the Intel Docker version of the Fortran compiler

This works on a generic Linux box:

cd /place/to/code

and then

docker run -v $(pwd):/workspace -w /workspace -it intel/oneapi-hpckit:$TAG

which starts the Docker image, mapping the directory place/to/code to the directory /workspace within the Docker image. Then

cd /workspace
ifort code.f90
./a.out
  • you may need to also mention other f90 files, e.g. ifort library.f90 code.f90 as per README
  • if using MPI, then replace ifort with mpiifort

On BioHPC, The directory /workdir/(USERID) is automatically mapped to /workdir within the Docker image.

As Singularity

(Not yet run - see BioHPC singularity instructions and Intel support for Singularity containers.)

Clone this wiki locally