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

how to set up configuration for only using ifort on console line?

bsmile_2nd
Beginner
1,727 Views

I try to use ifort in a linux like environment (say using mingw) under windows 7. I just need the most basic functionality of the compiler (ifort, mkl library, mpi/openmp). What product should I use for this, and how should I set up the configuration for a command line compilation and run instead of resorting to the integrated invironment like visual studio? By the way, can anybody explain to me what's gcc? Is it actually a c compiler?

0 Kudos
16 Replies
TimP
Honored Contributor III
1,728 Views

Any of the purchased versions of ifort will satisfy those requirements, with the exception of MPI, which comes only with the Parallel Studio Cluster Edition.  ifort has a command line interface, as well as a Microsoft GUI interface.

mpich2 is a popular free implementation (TCP only) of MPI which works with ifort.  It's the same core as the Microsoft MPI.

The gcc free software compiler normally offers C, C++, and Fortran, as the Fortran (gfortran) can't be built without at least C and C++. https://gcc.gnu.org/wiki/GFortranBinaries (that page isn't up to date, there are current pre-built gfortran binaries at the referenced sites).

cygwin gfortran offers an OpenMPI option (TCP communication only). cygwin is the most linux-like development system for Windows. cygwin builds aren't binary-compatible with ifort or mingw. mingw "cross compilers" are offered in the cygwin setup, in case you want to make builds which run outside cygwin, using the cygwin development environment.  ifort may be used in a similar way, by superimposing cygwin environment on the ifort cmd prompt, but that is "unsupported."


 

0 Kudos
bsmile_2nd
Beginner
1,728 Views

Thanks for your explanation.

Can I understand it to be that fortran compiler is written using c++ language, thus it needs c++ to generate binary (which is kind of annoying as I have been thinking that fortran and c++ are at the same level of an advanced language)?

I don't remember that I had built mingw under cygwin environment. To use ifort under mingw, I might try the simplest way to write in the script where to look for the library, ifort and link etc to make ifort work, but there seems to be a big concern that ifort for windows uses /check etc syntax instead of -check (in linux) to add in compilation options, which linux(mingw here) would interpret it to be root directory. Is there fundamental issue to define the options with "/" under windows environment?

Even under windows, I have run into trouble to make ifort work. Basically, I met with the following three issues

(1) I cannot follow the instruction on the installation document of how to use command line to compile. I cannot find "command prompt" after "intel parallel studio" when beginning with start and then all program. I don't know anybody else might run into similar issues.

(2) I do found where ifort is located. I issued the following command

c:\intel\composer xe\bin\ia32\ifort aaa.f90

it complains cannot find 'link' although the compilation seems to be successful.

Can you possibly tell me where this file stays?

(3) where are the libraries located for me to possibly link to? (if I want to use with mingw, it might not be able to find the right place by using only /mkl)

At the end, could you please educate me about the difference between ifort and fortcom, "composer xe" and "composer xe 2013" say?

Thanks,

0 Kudos
mecej4
Honored Contributor III
1,728 Views

An Intel Fortran installation can reside on the same PC with Mingw-32, Cygwin, etc., but IFort is neither intended to work with the Mingw/Cygwin tools nor is Mingw-32 of any significant use in building programs with IFort. Some Windows SDK tools, such as Link, have the same name as Unix/Cygwin Link, but the two programs are completely different, so you have to make sure that you use the correct one.

Intel Fortran comes with a complete development environment, including command-line and IDE versions that you can choose at will (if you installed the licensed version; to use the evaluation version you will have to obtain and install the Windows SDK yourself before trying to install IFort). Once you learn to use it correctly, you can augment your development environment with tools from Linux/Cygwin/Mingw such as nm, grep, etc. However, in the beginning, it is best to forget about Mingw. Likewise, do not expect Windows command line tools to mimic Linux/Unix tools.

If you want to stick to a Unix-type command line environment, consider using Gfortran with Cygwin or Mingw under Windows, or run Linux and use a Fortran compiler that targets Linux.

0 Kudos
TimP
Honored Contributor III
1,728 Views

The Intel Fortran Getting Started document (which comes up at the end of your installation, as well as being searchable on line) tells how to find the command prompt shortcut on the several major versions of Windows, and how to run the compilervars.bat if you want to add the ifort environment to a cmd prompt window.  If you don't use a supported installation sequence, you may need the -Qlocation,link, option to point out the folder (normally a supported Visual Studio C++ folder) where you want link.exe to be used.

It doesn't make a lot of sense to install ifort with a non-supported Microsoft tool set when you could use VS2013 or 2015 Community if you didn't buy ifort with VS Shell, the latter being the only way to avoid having a C or C++ compiler installed.  As you claim to have come from linux, you must be aware that ifort linux depends on a g++ installation.

The mingw 32-bit link.exe may work to some extent with 32-bit ifort (probably not with normal debuggers,....), but the mingw libraries can't substitute for the Visual Studio ones.

ifort options work the same with - or /.  There are also options to change behaviors which have different defaults for Windows and linux.

I don't know if you are referring to one of the shell environments other than cmd shell which are frequently used with mingw, and it's probably not worth discussing here.  I normally use ifort under bash shell, and don't see any problems, other than those which may come about if invoking bash changes the linker path.  I thought one of the reasons people used mingw was to avoid using a linux-like shell.

If you want to use MKL with mingw, it may not be considered topical on the MKL forum; it's not topical here.  You may be able to find out whether people who ask that question, e.g. on stackoverflow, got any viable answers.  You would need to be proficient with tools like dumpbin, nm, and the like, and  Microsoft SDK library dependencies may be expected.  The gcc/gfortran compatibility of MKL and Intel OpenMP on linux does not carry over to Windows, instead there is support for the Visual Studio environment.

0 Kudos
bsmile_2nd
Beginner
1,728 Views

I don't know getting Intel Fortran compiler to work involves so much deep understanding of the operation system related and third party program related details. I just want the compiler to work for my needs,which should not be a very complicated thing, just like gfortran has been getting to work for me. (under mingw, does this actually make a difference?) Why wouldn't Intel Fortran come with a link.exe? I am quite curious about what prevents Intel Fortran from providing a link.exe which works for a windows machine.

 

0 Kudos
bsmile_2nd
Beginner
1,728 Views

if Intel compiler does not come with a link.exe, then does this mean we are forced to purchase a vs c++ suit in order to get the link.exe, totally confused.

if link.exe is system dependent, then does this mean .exe genereatef with windows link.exe cannot be run under mingw environment? This might kill a big convenience of using a Linux like environment due to its very convenient script and editing tools.

 

0 Kudos
TimP
Honored Contributor III
1,728 Views

In what way haven't your questions been answered?

0 Kudos
Steven_L_Intel1
Employee
1,728 Views

Intel Fortran comes with everything you need to create, build, debug and run Fortran applications. That includes the linker, which if you don't already have it is installed as part of the VS Shell-based development environment. (A caveat - if you are using an evaluation or student license, the VS Shell environment is not provided. You can use VS2015 Community Edition (or a trial of VS temporarily) instead in that case.)

Building from the command line is as simple as starting a command-prompt session using one of the Start menu shortcuts provided and typing:

ifort myprog,f90

We do not officially support use from mingw. I know people have gotten it to work that way, but you won't find information about it in our documentation. You may need to put in an invocation of ifortvars.bat from your mingw environment (I am not entirely sure how that would work), or maybe start mingw from the Fortran environment.

0 Kudos
bsmile_2nd
Beginner
1,728 Views

Thanks for the answers. So I guess you are saying that if I am using "an evaluation or student license", then I would not have the link.exe, is this the case? I might have been too shocked to accept this fact from other people's reply. But why should you do that, may I ask? Without the linker, how can we evaluate it? Do you mean we are forced to install VS Shell-based development environment? What exactly does this abbreviation mean? Is it freely available and how big is it? I don't have any idea on how a windows program might be built. So your further help would be greatly appreciated.

A further question concerning the linker, which I explained in my previous post. Does linker set up the bridge between the code and the environment (say, windows, linux, cygwin, mingw etc) it will work in, while the compiler cares nothing about it? I tried to use the linker provided by mingw and link the *.obj generated by intel compiler and had hoped it could work under mingw. The link is successful, but it turns out the resulting executable does not work. Could you please explain to me why this fails?

0 Kudos
Steven_L_Intel1
Employee
1,728 Views

The linker is a tool that converts the raw object code from a compiler to an executable. It resolves all references between routines, pulls in libraries as needed and writes an EXE (or a DLL) that Windows understands. Intel Fortran is compatible only with the Microsoft linker. The linker (ld) in Mingw or other Linux toolsets is designed for use with the gcc compilers and not Intel Fortran.

Visual Studio Shell is what Microsoft calls the development environment without any of the language tools. It has the text editor and debugger, but by itself, can't create programs. The linker is part of a separate set of tools (plus some libraries) that we license from Microsoft and they charge us a per-copy fee for. Because there is this royalty-bearing component, we can't provide it for free evaluation, and the student license for our tools costs too little to absorb the cost. Since Microsoft makes full Visual Studio available as a 90-day trial, if you are evaluating you can get the necessary components that way. Students usually have access to a free copy of Visual Studio, and Microsoft now has a free "Community Edition" that works with Intel Fortran.

If you buy Intel Parallel Studio XE (including Fortran), and you don't already have a supported Visual Studio, we install everything you need to build and run Fortran programs at no additional cost. If you also want to use Microsoft languages such as Visual C++, then you need to obtain Visual Studio from Microsoft.

Does this help?

0 Kudos
John_Campbell
New Contributor II
1,728 Views

I agree with this poster. For a new user to ifort, the inter-related parts appears as a very complex collection.

A new (or infrequent) user wants to compile then link and test the resulting .exe. With other compilers, this can be achieved by

  • opening a cmd.exe window,
  • initialising the environment with some startup.bat
  • Using the "ifort" command to compile the source file(s)
  • Using the linker to assemble the .exe
  • running the resulting .exe

Once you become more experienced, then you can expand on this set of skills and have more advanced usage of the compiler and related packages.

If you know the Intel Fortran layout, it is easier to find the information, but for a new user where do you look ? There are (were when I started) too many possibilities.

The problem I found with ifort is the initial start required much more understanding, such as what options for the startup.bat and where are all the appropriate .dll files located. Just confirming I am using 64-bit and not 32-bit was confusing first time round. I think bsmile_2nd is reporting similar information overload, (and it may not be the first time he has tried to use ifort).

As a new user, it is a puzzle why ifort does not come with a linker ! ( the likely response from a new user is: I've failed the test; Intel does not want new users like me)

John

0 Kudos
IanH
Honored Contributor II
1,728 Views

John Campbell wrote:

I agree with this poster. For a new user to ifort, the inter-related parts appears as a very complex collection.

A new (or infrequent) user wants to compile then link and test the resulting .exe. With other compilers, this can be achieved by

  • opening a cmd.exe window,
  • initialising the environment with some startup.bat
  • Using the "ifort" command to compile the source file(s)
  • Using the linker to assemble the .exe
  • running the resulting .exe

The steps are pretty much the same with ifort, though (as with other compilers) there is a shortcut that both opens a command prompt and runs the necessary startup script.  The original poster in #3 doesn't seem to be able to locate this shortcut, which would indicate an installation problem.

For basic use you use the ifort command to both compile and link, and there is no need to really know there is such a thing as the linker.  I consider myself a reasonably frequent and adept ifort user, and I cannot remember the last time that I actually directly invoked the linker.

Once you become more experienced, then you can expand on this set of skills and have more advanced usage of the compiler and related packages.

If you know the Intel Fortran layout, it is easier to find the information, but for a new user where do you look ? There are (were when I started) too many possibilities.

The problem I found with ifort is the initial start required much more understanding, such as what options for the startup.bat and where are all the appropriate .dll files located. Just confirming I am using 64-bit and not 32-bit was confusing first time round. I think bsmile_2nd is reporting similar information overload, (and it may not be the first time he has tried to use ifort).

As a new user, it is a puzzle why ifort does not come with a linker ! ( the likely response from a new user is: I've failed the test; Intel does not want new users like me)

But it generally does come with a linker, if you buy the compiler.  If you follow the instructions for the evaluation version, you will also have a linker. 

The user is trying to do things through the mingw environment (I actually think they mean to say "msys", because the mingw tools are generally intended for use from the normal windows command prompt, with the normal windows path separator and drive letters, etc).  That msys environment is not the typical windows command prompt environment - and they need to understand the implications of their choice. 

When an installation finishes, my recollection is that the "Getting started" page out of the online documentation is put in front of you.  I just banish it, because it is against my religion to read compiler release notes or readme/getting started stuff, but looking at it now, it does pretty clearly lay out the equivalent of the steps you've listed above for working from the command line.

0 Kudos
Sahil_W_
Beginner
1,728 Views

Hi,

I recently installed an Intel Parallel Studio -Cluster edition  Fortran compiler (version: "Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.2.187 Build 20170213" ) on my Windows run PC and am unable to configure the "ifort" environment variable, which I need for working with Fortran subroutines in MSC ADAMS. (when I type in "ifort" in the Windows Command Prompt, I get an error message). I have been stuck for days because of this.
Could you please help me set up whatever this ifort environment is ?

The only relevant link pertaining to this that I could come across on the net was this: https://software.intel.com/en-us/articles/setting-up-the-build-environment-for-using-intel-c-or-fortran-compilers 

(^ and even here I could not understand how to proceed with this syntax- Point no. 2 under Intel® Parallel Studio XE for Windows* heading: ifort [options... ] inputfile(s) [/link link_options] - what is " [/link link_options] "? How does one type in for "inputfile"? Any examples would be very welcome..)

Any other methods to achieve this configuration of ifort environment (apart from the one illustrated in the abovementioned link) would also be welcome!

Regards,
Sahil

0 Kudos
Steve_Lionel
Honored Contributor III
1,728 Views

There are two ways of doing this.

The easiest is to use the installed shortcut under Intel Parallel Studio XE 2017 > Compiler 17.0 Update 2 for Intel 64. This creates a command prompt window with the environment set up. Note that it will put you in an unusable location for default directory, so you'll need to "cd" elsewhere. (I copy this shortcut to my desktop and modify it to set my own default.)

If you want to start your own command prompt somehow else, type the following:

"%IFORT_COMPILER17%bin\ifortvars.bat" intel64

This will set up the same environment.

0 Kudos
Reimers__Jeffrey
Beginner
1,728 Views

Hello,

Alas I am struggling with this too.  Visual studio 2015 and Intel parallel studio XE 2018 Update 3 have been successfully installed on my new computer (previously it was 2010 versions).  I can use it to compile and run progs OK.  However, most of the time I use the CMD shell to do everything.  I have tried most things in the message chain.  Starting

"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Intel Parallel Studio XE 2018\Compiler and Performance Libraries\Command Prompt with Intel Compiler 18.0 Update 3"

does create a CMD prompt, as expected.  However,  running ifort as

ifort prog.for

or ifort /help  

etc causes it to just hang and do nothing.  Ctrl-C kills it mostly, though once I had to kill the cmd prompt shell.

 

Variations including running beforehand the command

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.3.210\windows\bin\ifortvars.bat intel64

either in that command prompt or else in the standard windows command prompt makes no difference.

The path is:

PATH=C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\compilers_and_libraries_2018\windows\bin\intel64;
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\compilers_and_libraries_2018\windows\redist\intel64\compiler;
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\compilers_and_libraries_2018\windows\redist\intel64_win\compiler;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;
C:\Program Files (x86)\MSBuild\14.0\bin\amd64;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64;
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\VCPackages;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;
C:\Program Files (x86)\HTML Help Workshop;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\x64;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools;
C:\Program Files (x86)\Windows Kits\8.1\bin\x64;
C:\Program Files (x86)\Windows Kits\8.1\bin\x86;
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\;
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\bin\..\..\intel64\bin;
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\debugger_2018\bin\\..\gdb\intel64\bin;
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\debugger_2018\bin\..\libipt\intel64\lib;
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\compilers_and_libraries_2018\windows\redist\intel64_win\mkl;
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.3.054\compilers_and_libraries_2018\windows\redist\intel64_win\compiler;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\mpirt;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\mpirt;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;
C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\compiler;
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;

any ideas as to what I have not done?

thanks,

Jeff Reimers

 

 

0 Kudos
Steve_Lionel
Honored Contributor III
1,728 Views

Jeff, that's not at all a normal situation. But I will caution that if you just invoke the shortcut, you're left with a current directory that isn't writeable (possibly C:\Program Files (x86)\IntelSWTools) Make sure you CD to a writeable directory, outside of Program Files or Windows.

0 Kudos
Reply