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

Select intel fortran comiler version in visual studio

Jens_E_
New Contributor I
863 Views

Hi,

 

I have a big visual studio solution containing c++ and fortran projects. The solution is built using devenv from the command line.

I have several fortran compilers installed (2013 and 2015). How can I select which compiler to use at build time, from the command line?

I am aware of the option from Tool-Options-Intel compilers and tools, but I have found no way to do this from the command line.

 

Thanks,

Jens

0 Kudos
16 Replies
andrew_4619
Honored Contributor II
863 Views

Each fortran version has its own command prompt on the start menu doesn't it? I can't check as I uninstalled all my many old versions recently. I would guess that if you run in the relevant command prompt you get that compiler. 

 

0 Kudos
Jens_E_
New Contributor I
863 Views

I'm not using the fortran compiler executable, I'm using devenv from the command line as I need to build the entire solution at once.

Yes, I could of course create my own build script to control which fortran compiler to invoke, but I want to use devenv as automatic as possible.

 

Jens

0 Kudos
IanH
Honored Contributor II
863 Views

From within the relevant command prompt for the compiler version of interest, add the /useenv switch to the devenv command line that you use to start the build. 

I expect mild chaos to result if the platform of the command line that you are working in does not match the platform that you build.

0 Kudos
Jens_E_
New Contributor I
863 Views

/useenv is only for the C++ env. variables and libraries, no?

0 Kudos
Steven_L_Intel1
Employee
863 Views

Ian's suggestion is exactly what you want to do. It will establish the Fortran environment that you have selected from the command prompt.

Note that the build log and output won't correctly identify the compiler version being used, so don't pay attention to that. You can set the property Fortran > General > Suppress Startup Banner to No to get the compiler to tell you which version it is using. I'll warn that the VS integration might use compiler options not supported in older versions if you do it this way.

0 Kudos
Jens_E_
New Contributor I
863 Views

Ok, I think I understand now. Thanks.

Is it possible to set the environment variables in a windows command prompt, so that this windows command prompt effectively is equivalent to a intel fortran compiler command prompt?

I'm using teamcity to build my vs solution, so I do not have easy access to an intel fortran command prompt.

0 Kudos
Steven_L_Intel1
Employee
863 Views

In your chosen command prompt, use:

call "path-to-version-specific-compilervars,bat" platformname vsversion

where platformname is ia32 or intel64 and vsversion is the version of VS you want to use (vs2010, vs2012, etc.)

For example:

call "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.2.180\windows\bin\compilervars.bat" intel64 vs2013

0 Kudos
Jens_E_
New Contributor I
863 Views

Thanks! This seems to work for the fortran compiler.

However, it breaks something regarding the c++ compiler. With /useenv I get the following error message for the c++ projects:

TRACKER : error TRK0002: Failed to execute command: ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\CL.exe" @C:\Users\JEFT\AppData\Local\Temp\tmpf3e0b205768041b6a3d590dbee6c5b75.rsp". The handle is invalid.

 

Any idea?

 

 

0 Kudos
Steven_L_Intel1
Employee
863 Views

I can't imagine what would be the problem here. All of the VS environment should be set up. The error you got does not suggest an environment problem but maybe some background process interfering with temporary files.

0 Kudos
Jens_E_
New Contributor I
864 Views

ok, thanks.

I also get this warning at the beginning of the build (after selecting the intel compiler 2015 environment for intel64, vs2010): Package 'Intel.Fortran.IFLangService.IFLangServicePackage, IFLangService, Version=16.0.0.0, Culture=neutral, PublicKeyToken=null' failed to load.

But that seems to be unrelated to my other issue.

0 Kudos
Jens_E_
New Contributor I
864 Views

Some additional information:

I want to build the c++ projects in my solution using vs2010 sp1. I know there is a significant difference between sp1 and not. Is this an issue?

I also have vs2013 and vs2015 installed. Does this imply any potential conflicts?

0 Kudos
Steven_L_Intel1
Employee
864 Views

I have seen the IFLangService warning but haven't noticed any ill effects of that. You should definitely use the latest SP of VS2010 - especially SP1 as that changed many things Fortran uses. That you also have VS2013 and 2015 does not matter.

0 Kudos
Jens_E_
New Contributor I
864 Views

I was using

compilervars.bat intel64 vs2010, 

However, with 

compilervars.bat ia32_intel64 vs2010,

everything builds. Does this make sense? Do I need to use this "cross toolset" when the ms compiler itself is x86 but compiling for x64?

One additional question though: I now get, for every cpp file being compiler, the message "You are using an Intel supplied intrinsic header file with a third-party compiler." What does this mean?

Best,
Jens

0 Kudos
Steven_L_Intel1
Employee
864 Views

I have a theory on the compilervars issue - let me dig into this and I'll get back to you.

When you use the Intel compilervars (and have Intel C++ installed), the include path includes Intel C++ headers that may not be right for MSVC. You can ask in the C++ forum whether or not this is important - I don't know.

0 Kudos
Jens_E_
New Contributor I
864 Views

Okay, thanks!

One thing occured to me: What if I wanted to use the intel c++ compilers as well, how would I go about setting up that from the command line? I notice that there's also an ifortvars.bat script - would that do anything different?

Jens

0 Kudos
Steven_L_Intel1
Employee
863 Views

compilervars.bat gives you both Intel Fortran and C++. But in VS you'd need to right click on your C++ project and select "Use Intel C++" (it's in some Intel submenu - I forget exactly.) ifortvars.bat does the same thing as compilervars.bat.

0 Kudos
Reply