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

ifort command

intelnoob
Beginner
2,963 Views
I need ifort to compile a program which requires MKL. I've downloaded it, intalled it, and done the ifortvars.sh thing everytime I open the bash terminal. However when I try to make my program I just get this error

cpp -P -traditional-cpp -Dsp ddprecision.f90 \
ddprecision_cpp.f90
ifort -c -O2 ddprecision_cpp.f90 -o ddprecision.o
make: ifort: Command not found
make: *** [ddprecision.mod] Error 127

When i type ifort and double tap tab the ifort comand appears to be there. The makefile is fine because after editing out MKL and using gfortran it works. Can anybody help? Have I not done something, I should have done? Thanks
0 Kudos
1 Solution
Ron_Green
Moderator
2,963 Views
Quoting - tim18
You're starting make under a new shell. Apparently, you haven't sourced ifortvars.sh either in the shell startup script or in the Makefile. Not that we could recommend running make as root, or could have guessed you were doing this. Except that you have confirmed a suspicion which Ron mentioned.

Exactly as Tim says. Once you type 'sudo' you start a new root shell and lose all your environment settings. You have to source iforvars from this sudo shell. Here's a workaround if you insist on using a sudo root shell to make your application:

sudo bash
source /opt/intel/..../ifortvars.sh intel64
make all
exit

View solution in original post

0 Kudos
10 Replies
Ron_Green
Moderator
2,963 Views
Quoting - intelnoob
I need ifort to compile a program which requires MKL. I've downloaded it, intalled it, and done the ifortvars.sh thing everytime I open the bash terminal. However when I try to make my program I just get this error

cpp -P -traditional-cpp -Dsp ddprecision.f90
ddprecision_cpp.f90
ifort -c -O2 ddprecision_cpp.f90 -o ddprecision.o
make: ifort: Command not found
make: *** [ddprecision.mod] Error 127

When i type ifort and double tap tab the ifort comand appears to be there. The makefile is fine because after editing out MKL and using gfortran it works. Can anybody help? Have I not done something, I should have done? Thanks

Just to be sure, when you said you 'did the ifortvars.sh thing', you did do:

source /opt/intel/Compiler/11.1/046/bin/ifortvars.sh intel64

and

echo $0

does return
-bash

right? If so, try putting that source command inside your ~/.bashrc file

ron
0 Kudos
roddur
Beginner
2,963 Views
never mind but a silly query: do your ifort is in path?
0 Kudos
intelnoob
Beginner
2,963 Views

Just to be sure, when you said you 'did the ifortvars.sh thing', you did do:

source /opt/intel/Compiler/11.1/046/bin/ifortvars.sh intel64

and

echo $0

does return
-bash

right? If so, try putting that source command inside your ~/.bashrc file

ron

Sorry REALLY bad time for my harddrive to just pack in. Anyway I've installed everything again and I still have the same problem. I followed your instructions above (echo $0 did return bash) but the same thing keeps happening

make: ifort: Command not found

This is really puzzling because the command seems to be there in bash but as soon as I try to use it says it can't be found. Any help would be greatly appreciated.
0 Kudos
Ron_Green
Moderator
2,963 Views
Quoting - intelnoob

Sorry REALLY bad time for my harddrive to just pack in. Anyway I've installed everything again and I still have the same problem. I followed your instructions above (echo $0 did return bash) but the same thing keeps happening

make: ifort: Command not found

This is really puzzling because the command seems to be there in bash but as soon as I try to use it says it can't be found. Any help would be greatly appreciated.

How are you building the code, with a simple make command? ie 'make all' or some such thing? Or do you wrap up the build inside a script file of some sort?

Show us your Makefile. And cut and paste your session from the time you type 'make' until the thing aborts and returns to the command prompt.

ron
0 Kudos
intelnoob
Beginner
2,963 Views

How are you building the code, with a simple make command? ie 'make all' or some such thing? Or do you wrap up the build inside a script file of some sort?

Show us your Makefile. And cut and paste your session from the time you type 'make' until the thing aborts and returns to the command prompt.

ron
Yeah I'm just using a make all command. The program will compile under gfortran and works fine. The problem starts when I try to use ifort. I've attached the Makefile, the option I'm using has no MKL at the moment, to keep things simple, but I'm intending to use it later. The output I'm getting after make all is as follows:

@Ubuntu:~/Desktop/ddscat7.2.0.7/src$ sudo make all
[sudo] password for :
cpp -P -traditional-cpp -Dsp ddprecision.f90
ddprecision_cpp.f90
ifort -c -O2 ddprecision_cpp.f90 -o ddprecision.o
make: ifort: Command not found
make: *** [ddprecision.mod] Error 127
@Ubuntu:~/Desktop/ddscat7.2.0.7/src$

Thanks again for any assistance.
0 Kudos
TimP
Honored Contributor III
2,963 Views
Quoting - intelnoob
@Ubuntu:~/Desktop/ddscat7.2.0.7/src$ sudo make all
[sudo] password for :
cpp -P -traditional-cpp -Dsp ddprecision.f90
ddprecision_cpp.f90
ifort -c -O2 ddprecision_cpp.f90 -o ddprecision.o
make: ifort: Command not found

You're starting make under a new shell. Apparently, you haven't sourced ifortvars.sh either in the shell startup script or in the Makefile. Not that we could recommend running make as root, or could have guessed you were doing this. Except that you have confirmed a suspicion which Ron mentioned.
0 Kudos
Ron_Green
Moderator
2,964 Views
Quoting - tim18
You're starting make under a new shell. Apparently, you haven't sourced ifortvars.sh either in the shell startup script or in the Makefile. Not that we could recommend running make as root, or could have guessed you were doing this. Except that you have confirmed a suspicion which Ron mentioned.

Exactly as Tim says. Once you type 'sudo' you start a new root shell and lose all your environment settings. You have to source iforvars from this sudo shell. Here's a workaround if you insist on using a sudo root shell to make your application:

sudo bash
source /opt/intel/..../ifortvars.sh intel64
make all
exit
0 Kudos
intelnoob
Beginner
2,963 Views

Exactly as Tim says. Once you type 'sudo' you start a new root shell and lose all your environment settings. You have to source iforvars from this sudo shell. Here's a workaround if you insist on using a sudo root shell to make your application:

sudo bash
source /opt/intel/..../if


ortvars.sh intel64
make all
exit

Thanks Tim and Ron, that worked a treat. I was using sudo because something was being refused permission and sudo is the only way I know to fix that. I hate compiling anything. Why they can't just offer this program precompiled I have no idea, the damned thing is standalone and is only 0.5MB once compiled anyway. Thanks again, I can get some work done now once I master getting it to work with MKL, MPI and openMP.

0 Kudos
TimP
Honored Contributor III
2,963 Views
Quoting - intelnoob

Thanks Tim and Ron, that worked a treat. I was using sudo because something was being refused permission and sudo is the only way I know to fix that. I hate compiling anything. Why they can't just offer this program precompiled

Some people think open software, with provided source, is an advantage. If it has a public license, provision of source is mandatory, and allows the user to run on various architectures. It's a big job to build and test 6 or more builds such as ifort does. Usually, if the build has a final install step which requires root privilege, that is a separate step 'make install' so you would run make without root privilege, then complete make install under sudo. You would have to change ownership of all the files in the build back to yourself if you wished to switch back to building that way.
0 Kudos
intelnoob
Beginner
2,963 Views
Quoting - tim18
Some people think open software, with provided source, is an advantage. If it has a public license, provision of source is mandatory, and allows the user to run on various architectures. It's a big job to build and test 6 or more builds such as ifort does. Usually, if the build has a final install step which requires root privilege, that is a separate step 'make install' so you would run make without root privilege, then complete make install under sudo. You would have to change ownership of all the files in the build back to yourself if you wished to switch back to building that way.

I didn't know the provision of source was mandatory, learn't something new there. I would very much be of the opinion that if the makers can't build the program it doesn't leave much hope for anyone else. I presume (and hope) that any code has been compiled with all it's options by the builders first. Hence, can they not make the executable available to us mere plebs of the computing world to just download and use. I get your point about the installing part though. Thanks again for your help. I guess I just click the question answered to close the thread.
0 Kudos
Reply