Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ifort for ubuntu

JaiPrakash
Beginner
6,249 Views

I have installed one API HPC Toolkit in ubuntu now; how can I use ifort ?. What is a command for using the ifort? Would you please help me since I am struggling with this issue for a long?

0 Kudos
12 Replies
mecej4
Honored Contributor III
6,224 Views

You can read the Get Started notes here.

0 Kudos
JaiPrakash
Beginner
6,216 Views

Thanks for the reply, but still I am not getting which command I will use for  ifort to compile a file.

0 Kudos
mecej4
Honored Contributor III
6,212 Views

Before trying anything, you have to open a shell window and source the start-up script, as described in the Get Started guide. 

To compile and link a source file named xyz.f90, the command is 

ifort xyz.f90

You can run the resulting executable by typing

./a.out

 

0 Kudos
JaiPrakash
Beginner
6,126 Views

Hi, Thanks for the reply,

Actually, I have installed the ifort  in the location    '' "/opt/intel/oneapi/compiler/latest/linux/bin/intel64 "" .  So now  what command  I will use to compile the program.  I have attached the screenshot. Please help me ifort.jpgPlease help me. 

0 Kudos
jimdempseyatthecove
Honored Contributor III
6,108 Views

Please read the  Get Started notes here. As mecej4 recommended.

(click on the link ^^^ up here ^^^^)

The programmer does NOT cd to the compiler installation directory. Instead, you (generally) cd to your workspace directory.

Prior to running the compiler, you must first setup the build environment. For the oneAPI build environment issue:

 

   /opt/intel/oneapi/setvars.sh

 

There is a similar shell script to setup the environment for the "classic" version of the compiler.

After the (selected) environment is setup, the compiler (and tools) will be in PATH (and INCLUDE, etc...).

Jim Dempsey

0 Kudos
JaiPrakash
Beginner
6,082 Views

Thanks, Sir, for giving such details, now I have done the steps but in the last line you wrote ""  the compiler (and tools) will be in PATH (and INCLUDE, etc...)."" . this line I did not understand. and what is the command I will use to compile the program like " ifort xyz.f"

0 Kudos
jimdempseyatthecove
Honored Contributor III
6,056 Views
0 Kudos
JaiPrakash
Beginner
6,027 Views

Yes Sir I have already installed one API HPC Toolkit .   Please have a look an the attached screenshot

ifort 3.jpg

 

 

Earlier I was using the command  ~/intel/bin/ifort  with the old version of ifort. So is there any command like this for this new version of intel- fortran?

0 Kudos
Steve_Lionel
Honored Contributor III
6,013 Views

The command is the same. You should not need to specify a path if you have properly "sourced" the build environment as described in the Getting Started document. Your screenshot suggests that you have not.

 

Screenshot 2021-07-31 104108.png

0 Kudos
JaiPrakash
Beginner
5,972 Views

Sir, I  was asking about the command so that I can compile my local file eg. xyz.f,  now I found that command. which given below,

 ~/intel/oneapi/compiler/latest/linux/bin/intel64/ifort xyz.f

 

0 Kudos
andrew_4619
Honored Contributor III
5,952 Views

But the command "ifort xyz.f" should be enough because the full paths should be properly set bet the setvars script. If that has not been run there will be other problems that you might experience such as include files and defualt libraries etc

0 Kudos
jimdempseyatthecove
Honored Contributor III
5,941 Views

>>~/intel/oneapi/compiler/latest/linux/bin/intel64/ifort xyz.f

You still need to run the script when you enter the terminal window. While the above command line will locate ifort without running the script, it will result in ifort and the linker to not find other components necessary to build the application. e.g the INCLUDE and LIB paths will not have been specified (amongst potentially others).

Depending on what you have installed, you may need to run one or more setvar-equivilent script files. For my use, I place these few environment setups into a script file (e.g.  gointel.sh), then run that upon opening a terminal window. Then, say if I want to run Eclipse I append "&" such that the build environment initialized command window persists:

   eclipse&

Jim Dempsey

0 Kudos
Reply