Compile under dos command line

Compile under dos command line

I just purchased the Intel Visual Fortran composer XE 2013 SP1 for Windows with IMSL; OS Windows 7.

What is the syntax to compile a fortran program directly in dos command line? (I try to avoid the MS Visual environment).

I tried ifort, fl90, does not work.

Thanks:  Eva
 

13 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

ifort is correct, but first you have to establish the environment. We provide shortcuts to do so - Start > All Programs > Intel Parallel Studio XE 2013 > Command Prompt > Parallel Studio XE with Intel Compiler XE v14.0

For more information, see the documentation provided with the install or here.

Steve - Intel Developer Support

Hi, thanks.

I managed to run c:\Program Files (x86)\Intel\Composer XE 2013 SP1\bin\compilervars intel64    -   OK, no error

But ifort is still not recognized. I use an “independent” command window….  What else do I need to set up?

You have to do the ifort command from the window that invoked compilervars.bat.

Steve - Intel Developer Support

I see, thanks, again.  Is there a way to set it up as an environmental variable?

Éva

Éva:

You appear to be slightly confused by how to set the environment for IFort to work correctly from the command line. Although it is possible to alter the environment so that all "independent" command windows enable you to run IFort properly, that would create an undesirable situation: you would not be able to run other compilers or other software packages that need a different environment than IFort. This option is, therefore, unacceptable unless you know for certain that you will never run anything but IFort from a command window; even in that case, if you wanted to compile for 32-bit targets some times and for 64-bit targets at other times, you would have problems.

You can obtain the requisite command line environment in one of two ways:

  1. You can run the appropriate command window using the shortcut that is installed in the Windows "Start->IntelParallelStudio_xx_yy->command Prompt->Parallel Studio XE with Intel Compiler XE vvvvUpdate ww->IA-32 Visual Studio yyyy mode" (the version numbers and software labels may vary from one version to another, so I have written "xx", etc.)
  2. You can open your "independent" command window, and type the command
    "c:\Program Files (x86)\Intel\Composer XE 2013 SP1\bin\compilervars.bat" ia32
    . If you have the compiler installed at a location that is not the default, or you want to compile for 64-bit targets, modify the command accordingly.

Here is what I see when I use the second method:

Microsoft Windows [Version 6.3.9600]

	(c) 2013 Microsoft Corporation. All rights reserved.
s:>ifort

	'ifort' is not recognized as an internal or external command,

	operable program or batch file.
s:>"c:\Program Files (x86)\Intel\Composer XE 2013 SP1\bin\compilervars.bat" ia32
Setting environment for IMSL Fortran Library - IA-32

	Intel(R) Parallel Studio XE 2013 SP1

	Copyright (C) 1985-2014 Intel Corporation. All rights reserved.

	Intel(R) Composer XE 2013 SP1 Update 2 (package 176)

Intel installers used to be more aggressive about modifying the Windows startup environment variables (the ones in control panel advanced system settings).  As mecej4 said, this causes problems with use of alternate tools or modes, as well as with upgrades.

Now that so many different combinations of Microsoft OS and VS versions have to be supported, the situation with setting up paths is barely under control with the compilervars.bat system.  Combinations such as Inspector + ifort + visual studio on win8.1 seem to be impractical even with the flexibility which is available.

Thanks to all. Yes, I was confused, still a bit. I could not believe, that a basic task, such as compiling under DOS command would be difficult. At least I got it working now (luckily I have win7 not 8.1 here).

The problem is that compiling (and linking) is not "a simple operation" - it involves multiple tools that aren't part of Windows as well as multiple libraries. If everything was put in system environment variables, it would interfere with other tasks.

Steve - Intel Developer Support

I don't have experience of XE 2014, but for XE 2012 and Ver 11.1 the setup can be a bit confusing.

As mecej4 highlights, there are a number of uses of the environment settings which need to be considered when providing environment variable settings for a cmd.exe window. This can include:
1) compiling and linking using ifort and the various libraries ( which is provided by the "Start > All Programs > Intel Parallel Studio XE 2013 > Command Prompt > Parallel Studio XE with Intel Compiler XE v14.0" approach. compilervars.bat can also provide this, with the appropriate options for 32 vs 64 .exe )
2) running programs generated by ifort ( which is provided by the change to environment variables at install )
3) running other programs or compilers which do not use ifort. ( this can require reversing some of the ifort settings, especially path= )
4) running programs generated by ifort on computers where ifort or visual studio has not been installed.

The use of compilervars.bat can be confusing, especially if both ifort 32 and ifort 64 are installed.
I would suggest that the environment settings for option 2 can conflict when option 3 is being used. Is it possible to consider a less aggressive change to environment variables for option 2) use and provide a clearer documentation of a way of enabling type 2) use?

I have recently been performing option 4) on other computers to test out some ifort .exe performance on a range of hardware and have needed to check what environment variable changes are required. This has been a process of trial and error. Path settings are the most confusing to manage for this option, especially managing what additional directories must be provided.

Perhaps I have omitted to find and read the appropriate documentation, but a solution could be by having documented alternative batch files for options 1), 2) and 4) might help. I think the most confusing part of installing ifort is understanding the multiple places that ifort and VS files are located and which of these need to be replicated on other computers.

John

Establishing the build environment has nothing to do with running programs. When you install the compiler, all the DLLs you need to run Fortran programs are put in PATH. (But not the performance libraries such as MKL.) What I do is copy one of the shortcuts in the Start menu to my desktop, edit it to change the "Start in" folder, and just click on that when I want to start a new command session. Generally there are only two of these of interest, one for IA-32 and one for Intel 64.

For running programs elsewhere, see What do I need to deploy my Fortran application on a system where the compiler is not installed?

Steve - Intel Developer Support

Steve,

Thanks for the link. This assists with option 4 I identified in Quote #10.
Item 3 also requires some consideration, as the changes to the environment and path settings when ifort is installed can create some conflicts, although these occurrences may have been due to my mistakes.
I recently installed depends and found errors in the .dll's that were being used, as 32 bit and 64 bit versions were conflicting. This may have been that I did not have the correct environment provided, although I thought I could run a program (use option 2) using the default environment settings at install. I was also surprised at the different .dll's that were reported, as a number did not appear relevant to the .exe I had created.

John

If you are talking about what Dependency Walker reports on a 64-bit system, it isn't aware that Windows x64 skips over the "wrong architecture" DLLs in its search.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today