Fortran Compiler - Get Started Guide - 2023.2 767260 781901
Fortran Compiler - Get Started Guide - 2023.2 767260 781901
Contents
Chapter 1: Get Started with the Intel® Fortran Compiler Classic and
Intel® Fortran Compiler
Get Started on Windows* ...........................................................................4
Get Started on Linux* ...............................................................................6
Get Started on macOS* .............................................................................7
2
Get Started with the Intel® Fortran Compiler Classic and Intel® Fortran Compiler 1
NOTE
• macOS* is not supported for the ifx compiler.
• Support for 32-bit targets is deprecated in ifort and may be removed in a future release. ifx
does not support 32-bit targets.
Find More
Document Description
Intel® Fortran Compiler Classic and Intel® Fortran The Developer Guide and Reference contains
Compiler Developer Guide and Reference information on:
• How to use the command line or Microsoft*
Visual Studio*or Xcode*or the Eclipse* CDT
• Support for the latest compiler technologies and
architectures.
• Compiler reference material, including options,
program structures, class and math libraries,
and much more
3
1 Get Started with the Intel® Fortran Compiler Classic and Intel® Fortran Compiler
Document Description
Intel® Fortran Compiler Classic and Intel® Fortran Information on product installation, new and
Compiler Release Notes changed features, and issues that are not described
in the product documentation.
Intel® Fortran Compiler Forum Ask questions and find answers in the Intel® Fortran
Compiler forum.
Layers for Yocto* Project Add oneAPI components to a Yocto project build
using the meta-intel layers.
4
Get Started with the Intel® Fortran Compiler Classic and Intel® Fortran Compiler 1
Option 1: Use the Command Line
The following steps show how to invoke the compiler on Windows. Exact steps may vary depending on which
version of Windows is installed.
Step 1: Open a command prompt
1. Open the Start menu
2. Select Intel oneAPI command prompt under the installed version of Intel oneAPI, for example Intel
oneAPI 2023
Step 2: Invoke the compiler
Invoke the compiler using the following syntax:
ifx hello.f90
To display all available compiler options, use the following command:
• ifx /help
Refer to Compiler Options for detailed information about available options.
NOTE To change the compiler version in Microsoft Visual Studio, navigate to Tools > Options > Intel
Compilers and Libraries> IFX Intel Fortran > Compilers.
ifx hello.f90
5
1 Get Started with the Intel® Fortran Compiler Classic and Intel® Fortran Compiler
3. Now you have an executable called hello, which can be run and will give immediate feedback:
hello
Which outputs:
Hello, world!
Next Steps
• Explore the latest oneAPI Fortran Code Samples.
• Explore the Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference.
a. If your compiler was installed in the default location by a root user or sudo user, the compiler will
be installed under /opt/intel/oneapi/.
b. For non-root users, your home directory under intel/ is used. In this case, <install_dir> will
be $HOME/intel/oneapi/.
c. For cluster or enterprise users, your admin team may have installed the compilers on a shared
network file system. Check with your local admin staff for the location of installation
(<install_dir>).
2. Source the environment-setting script for your shell:
a. bash: source <install root>/setvars.sh
ifx hello.f90
6
Get Started with the Intel® Fortran Compiler Classic and Intel® Fortran Compiler 1
The command to invoke the setup script must be done in any command window where you want to use
an Intel® Fortran Compiler. Alternatively, the command can be added to a .bashrc or other shell
startup file.
3. Compile hello.f90:
hello
Which outputs:
Hello, world!
Next Steps
• Explore the latest oneAPI Fortran Code Samples.
• Explore the Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference.
Before you can use this tool, you must first set the environment variables by sourcing the environment script
using the initialization utility to initialize all the tools in one step.
From a terminal session, run:
source <install_dir>/setvars.sh
Build a Program
Follow the steps below to test your compiler installation and build a program.
1. Use a text editor to create a file called hello.f90 with the following contents:
. /<install_dir>/setvars.sh
This command adds the compiler directors to PATH and updates LD_LIBRARY_PATH to make it easier to
run a Fortran program.
7
1 Get Started with the Intel® Fortran Compiler Classic and Intel® Fortran Compiler
The command to invoke the setup script must be done in any command window where you want to use
the Intel® Fortran Compiler. Alternatively, the command can be added to a .bashrc or other shell startup
file.
3. From the command prompt, issue the following command:
hello
Which outputs:
Hello, world!
Next Steps
• Explore the latest oneAPI Fortran Code Samples.
• Explore the Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference.