Get Started on Linux*
Before You Begin
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:
- Determine your installation directory, <install_dir>:
- 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/.
- For non-root users, your home directory under intel/ is used. In this case, <install_dir> will be $HOME/intel/oneapi/.
- 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>).
- Source the environment-setting script for your shell:
- bash: source <install root>/setvars.sh
Use the Command Line
Invoke the compiler using the following syntax:
{ifx|ifort} [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
- Add the compiler directories to PATH and update LD_LIBRARY_PATH to make it easier to run a Fortran program. From a command window, issue the following command using a BASH-style shell:
source <install_dir>/compiler/env/vars.sh intel64
This particular configuration defaults the compiler to generating 64-bit objects. That can be overridden using command line options.
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.
- Compile hello.f90:
ifx –o hello hello.f90
- 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.