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

Selecting the compiler in an automated build system

Arjen_Markus
Honored Contributor I
256 Views

We are facing a somewhat awkward problem with our automated build system:

On the various agents comprising this system we have multiple versions of the compiler installed under Visual Studio and we want to be able to select the compiler that will be used. We can log on to the system, select the compiler to the one we want and have the build run. However, the build system uses a different account for the actual build, so that the selection defaults to the most recent compiler instead.

My question: is there a way to select the compiler to use without starting the Visual Studio user-interface? For instance a command-line option or an environment variable?

 

0 Kudos
3 Replies
mecej4
Honored Contributor III
256 Views

For years, I have had several versions of the Intel compilers installed on my systems, and almost exclusively use command-line windows for development of character mode applications and DLLs. On one system, I have Intel Fortran 7.1, 9.1, 10, 11.1, 2013SP1, 2016U4 and the current 2017U2. As you may imagine, the older versions serve two purposes: (i) when a forum user reports a problem with a specific old version of the compiler, and (ii) when there is a bug in the present compiler and I want to see if this is a new bug.

Here is how I choose one of the different versions. From the Start menu, or otherwise, I open a Visual-Studio command window (32-bit or 64-bit native). In such a command window, the Microsoft tools and libraries are accessible, and provide a framework to which we can add the Intel tools, headers/modules and libraries. To add the Intel tools, I run one of a number of batch files, e.g., add16u132.bat, to add the Intel 2016 32-bit tools and libraries. Each batch file is quite simple: it has to (i) copy %PATH% to %OPATH%, and similarly %LIB% and %INCLUDE%, for restoring the default PATH, etc., should I wish to switch to a different version of Intel tools, and (ii) modify PATH, LIB and INCLUDE by adding the paths to the Intel tools version that I wish to use. The SETLOCAL and ENDLOCAL commands can be useful in such batch files.

To make this work, a precaution is necessary. It is a fact of life that many software installers modify the Windows global environment without asking for the user's permission. To manage this, I make a back-up copy of the environment to a text file before doing an installation, and use this backup to undo the damage done, after the installer finishes. Without this precaution, it is easy to end up with an environment in which you compile using one version of the MKL modules, for example, but link with a different version of the MKL libraries, which will quite probably cause puzzling errors at run time.

0 Kudos
Kevin_D_Intel
Employee
256 Views

Another possibility is using the Visual Studio /useenv command-line option. When using this, open a pre-initialized Intel compiler command-prompt window and add /useenv option to the devenv command-line. This will use the underlying Fortran environment (PATH, INCLUDE, etc.) for the selected command-prompt window.

0 Kudos
Arjen_Markus
Honored Contributor I
256 Views

Hi Kevin, mecej4,

thanks for this - I am not sure how the build tasks on our system are to be configured, but at the very least both your answers provide an opportunity to experiment. Thanks.

 

0 Kudos
Reply