doomemacs/modules/lang/fortran
Colin Woodbury 1dfdfd53c6 feat(fortran): name executable after the file name
Previously the output was always the default `a.out`. Note that this is
only for the single-file non-fpm case, where the user just wants to
compile and run a one-off Fortran program.
2022-05-27 02:59:55 +02:00
..
autoload.el feat(fortran): name executable after the file name 2022-05-27 02:59:55 +02:00
config.el feat(fortran): keymappings for Intel 2022-04-16 02:48:24 +02:00
doctor.el feat(fortran): initial addition of ifort functions 2022-04-16 02:48:24 +02:00
README.org docs(fortran): show how to install Intel Fortran 2022-04-16 02:48:24 +02:00

lang/fortran

Description

This module enables a complete, modern development environment for the Fortran language. Initially released in 1956 (a year before Lisp 1.0), Fortran is the original high-performance computation language and is still widely used in science and academia. Popular versions of the language include Fortran 77 and Fortran 90, with further extensions in the 1995 and 2008 varieties. Today, Fortran has joined the modern age with its own package manager, package registry, and Discourse community.

In particular, this module features:

  • Support for all major Fortran varieties.
  • Auto-formatting via fprettier.
  • Integration with the fpm package manager.
  • LSP support via fortls.
  • Optional Intel Fortran support via the +intel flag.

After a career of writing Fortran on Mainframes and Windows machines, my now-retired Dad is switching to Linux. Imagine my surprise when I learned that off-the-shelf setups for Fortran on Linux basically don't exist! Well, until now… Cheers Dad, hope this helps.

Maintainers

Module Flags

  • +lsp Activate fortls for Fortran projects.
  • +intel Use the ifort compiler by default.

Plugins

Prerequisites

General

For minimum functionality, this module requires gfortran. For most project management tasks you will also need fpm, the Fortran Package Manager.

Arch Linux

gfortran is available from the official repositories:

sudo pacman -S gcc-fortran

Whereas fpm and fortls are available from the AUR and thus must be installed with an AUR-compatible tool like Aura:

sudo aura -A fortran-fpm fortls

Installing Intel Fortran

Activating the +intel flag won't automatically install Intel Fortan for you. Here's how to do it on *nix systems.

You can of course install the entire High-performance Computing kit from Intel, which includes Fortran, but the installation footprint is quite large. Instead, you're able to install just Fortran and its core facilities on their own as a standalone component. Download this script, and make it executable via:

chmod +x l_fortran-compiler_p_2022.0.3.83_offline.sh

The filepath will of course change with time, so alter the above command accordingly. Now run the script as a normal user (non-sudo) and follow the instructions of the installer. This will install ifort, etc., in a local filepath of your choosing.

To actually use ifort and have it link to its libraries properly, we must run a script provided by Intel to set certain environment variables:

. ~/intel/oneapi/setvars.sh

(Modify according to where you installed Intel Fortran.) Now ifort should be runnable in your terminal as you'd expect. To persist this, add that line to your Bash Profile, etc., and log out and in again. Now Doom will be able to use ifort too.

Good luck and happy computing!

Features

Configuration

Troubleshooting