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

How to detect installed Intel Visual Fortran version numbers programmatically ?

Lambdalous
Beginner
3,010 Views

Hello,

On Windows, I would like to retrieve programmatically (python or any other programming language) the version numbers of Intel Visual Fortran installed on my computer.
I know from Visual Studio (Tools/Options/Intel Compilers and Tools/Visual Fortran/Compilers) that I have these 3 versions:

12.1.5.344
15.0.4.211
19.1.3.311

The environment variables tell me only the install directories of these 3 versions

IFORT_COMPILER12=C:\Program Files (x86)\Intel\Composer XE 2011 SP1\ ==> corresponds to version 12.1.5.344
IFORT_COMPILER15=C:\Program Files (x86)\IntelComposer XE 2015\=> corresponds to version 15.0.4.211
IFORT_COMPILER20=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.4.311\windows\ ==> corresponds to version 19.1.3.311

I made several attempts (windows registry, fsupport.txt file, etc.) but nothing very conclusive

Thanks in advance for your help !

 

0 Kudos
1 Solution
Arjen_Markus
Honored Contributor I
2,961 Views

What you could do - in a small Fortran program - is construct the name of an environment variable, IFORT_COMPILERxx, where xx runs from, say, 10 to 30, get the value of that environment variable via get_environment_variable() and try to run the compiler, which would be located in %IFORT_COMPILERxx%\bin\intel64 (or similar) via execute_command_line(). Redirect the output to a file and parse the first line.

Whether that is an exhaustive search and whether there are variations in the latter part of the path that you need to take care of, I do not know. The versions I checked on my system seem to use this pattern.

Of course, you can do this with Python or most other programming languages as well.

View solution in original post

0 Kudos
5 Replies
Arjen_Markus
Honored Contributor I
3,004 Views

I am not sure that this is what you want, but you can use the intrinsic routines compiler_version() and compiler_options() to get the information on the compiler that was used to build the program. Here is an example of he information you get:

 

Compiler version:
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.4.0 Build 20210910_000000
Compiler options:
/debug

 

 

 

0 Kudos
Lambdalous
Beginner
2,969 Views

Thank you for your answer. But indeed I would like to know all the versions installed on the computer, not the information on the compiler that was used to build a specific program.

And I would like to find them via computer code (programmatically).

So in my case I would like a code that returns these 3 values:

12.1.5.344
15.0.4.211
19.1.3.311

0 Kudos
andrew_4619
Honored Contributor III
2,966 Views

I am not sure why you would want to do that.  You could scan your drives looking for ifort.exe and then either get the version.info from the file or parse the folder names.... There may be smarter ways, the folder roots used by OneApi and by previous versions of ifort are different BTW. 

 

0 Kudos
Arjen_Markus
Honored Contributor I
2,962 Views

What you could do - in a small Fortran program - is construct the name of an environment variable, IFORT_COMPILERxx, where xx runs from, say, 10 to 30, get the value of that environment variable via get_environment_variable() and try to run the compiler, which would be located in %IFORT_COMPILERxx%\bin\intel64 (or similar) via execute_command_line(). Redirect the output to a file and parse the first line.

Whether that is an exhaustive search and whether there are variations in the latter part of the path that you need to take care of, I do not know. The versions I checked on my system seem to use this pattern.

Of course, you can do this with Python or most other programming languages as well.

0 Kudos
Lambdalous
Beginner
2,932 Views

@andrew_4619 : The purpose is to let the user choose (in a GUI) the version of Intel Fortran to use to compile some files (see attached image). But I could not find the exact versions installed.

@Arjen_Markus : Your solution seems to work! Thank you

 

Thank you all for your answers

0 Kudos
Reply