Get Started on Linux*
Before You Begin
Download the Intel® Fortran Compiler
Download the Intel® Fortran Compiler onto your system through one of these ways:
- Download the Standalone package.
- Download as part of the Intel® HPC Toolkit.
Set Environment Variables for CLI Development
The directory layout used before 2024.0, the Component Directory Layout, is still supported on new and existing installations.
For detailed information about the Unified Directory Layout, including how to initialize the environment and advantages with the Unified Directory Layout, refer to Use the setvars and oneapi-vars Scripts with Linux.
Before using the compiler from a Command Line Interface (CLI), you must first configure the compiler environment variables. You can set up environment variables by running a script named setvars in the Component Directory Layout or oneapi-vars in the Unified Directory Layout. By default, changes to your environment that the setvars.sh or oneapi-vars.sh script sources apply only to the terminal session where you sourced the environment script. For each new terminal session, you must source the script again.
Detailed instructions on using the setvars.sh or oneapi-vars.sh script are found in Use the setvars and oneapi-vars Scripts with Linux.
Optionally use one-time setup for setvars.sh as described in Use Environment Modulefiles with Linux.
Invoke the Compiler From the Command Line
Invoke the compiler on the command line using the following syntax:
ifx [option] file1 [file2...] [/link link_options]
For example:
ifx hello.f90
Build a Program From the Command Line
Use the following steps to test your compiler installation and build a program.
- Use a text editor to create a file called hello.f90 with the following contents:
print *, "Hello, world!" end
- Open a terminal window.
- If you are not using one-time setup for setvars.sh, set environment variables by sourcing setvars:
Component Directory Layout
source <install-dir>/setvars.sh
Unified Directory Layout
source <install-dir>/<toolkit-version>/oneapi-vars.sh
For information about the <install-dir> location for Component or Unified layout on system-wide or private installations, refer to Use the setvars and oneapi-vars Scripts with Linux. - From the terminal window, issue the following command to compile hello.f90:
ifx –o hello hello.f90
- Now you have an executable called hello, which can be run and will give immediate feedback with:
hello
Which outputs:Hello, world!
Other Considerations
The conda package for the Intel® Fortran Compiler runtime no longer has a runtime dependency on the Intel® MPI Library, which is needed to enable coarrays. If you maintain a conda package that has a runtime dependency on the Intel Fortran Compiler runtime and your application uses the Intel MPI Library, you need to explicitly add the impi_rt conda package for the Intel MPI Library to the list of runtime dependencies in your project’s meta.yaml file.
Next Steps
- Explore the latest oneAPI Fortran Code Samples.