How to install and configure Intel C++ Compiler for Mathematica correctly?



I wish to try the trial version of the latest Intel C++ Compiler for Windows with Mathematica. I have downloaded the current version of Intel® C++ Composer XE 2011 for Windows and installed only the "Intel C++ Compiler" component from this package. But Mathematica does not recognize it:

In[1]:= Needs["CCompilerDriver`"]

Out[2]= {}

How to configure Mathematica to use the Intel C++ Compiler?

Alexey Popkov

Posted 2012-05-23T14:55:12.470

Reputation: 50 220

Make sure you have installed the 64 bit tools for Visual studio (if you are on a 64 bit system). You did install visual studio right? – Ajasja – 2012-05-23T15:02:35.770

@Ajasja At least when using the Microsoft compiler, it's not strictly necessary to install Visual Studio. The Windows SDK with the command line compiler will suffice. But the Intel compiler I have never used on Windows.

– Szabolcs – 2012-05-23T15:03:35.037

@Ajasja I use 32 bit Windows XP. I have not installed Visual Studio. Is it strictly necessary? – Alexey Popkov – 2012-05-23T15:04:34.300

2Yes, for the Intel compiler it is strictly necessary. It works with the Express edition as well, at least I think so. – Ajasja – 2012-05-23T15:08:22.797

@Ajasja Well, now I am downloading and installing Visual C++ 2010 Express.

– Alexey Popkov – 2012-05-23T15:14:28.017

@Ajasja The installation of Visual C++ 2010 Express has finished but after restarting the computer I still have no Intel compiler listed in CCompilers[] output even after setting $CCompiler = {"Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler}. What am I doing wrong? – Alexey Popkov – 2012-05-23T16:54:32.603

In your Mathematica, what does Environment["ICPP_COMPILER11"] return? – Joel Klein – 2012-05-23T20:40:08.233

@jfklein It returns $Failed (I have already installed Visual C++ 2010 Express). – Alexey Popkov – 2012-05-23T23:04:17.837

4This Intel version 12 is not supported, and that's why CCompilerDriver is not automatically detecting your Intel compiler. Until I have a chance to look into this, you could go into AddOns/Applications/CCompilerDriver/IntelCompilerWindows.m and replace ICPP_COMPILER11 with ICPP_COMPILER12. This may work only superficially, but it would be the fastest thing for you to try. – Joel Klein – 2012-05-24T02:24:15.130

As @jfklein mentioned the latest supported compiler is 11.1 (see here). Perhaps you could define ICPP_COMPILER11 and point it to ICPP_COMPILER12. Otherwise it's probably possible to set the compiler manually (see Setting a Different Compiler in the previous link)

– Ajasja – 2012-05-24T07:18:51.200

1@jfklein It works, thank you. @Ajasja After defining $CCompiler = {"Compiler"->CCompilerDriver`IntelCompiler`IntelCompiler,"CompilerInstallation"->"C:\\Program Files\\Intel\\Composer XE 2011 SP1\\"}; now DefaultCCompiler[] returns CCompilerDriver`IntelCompiler`IntelCompiler. – Alexey Popkov – 2012-05-24T10:03:41.453

@alexey Does defining $CCompiler work on it's own or do you have to change IntelCompilerWindows.m as well? – Ajasja – 2012-05-24T12:23:52.083

@Ajasja Without changing IntelCompilerWindows.m CCompilers[] does not list IntelCompiler. I have taken the value for $CCompiler from the list returned by CCompilers[] after changing IntelCompilerWindows.m . – Alexey Popkov – 2012-05-24T17:08:22.117

1CCompilers[] only lists compilers that are seen to be valid installations. CCompilers[Full] will list all compilers supported on that $SystemID. – Joel Klein – 2012-05-24T18:01:10.320



Mathematica 8 automatically detects Intel version 11, but not Intel version 12 which was released later.

In order to use the Intel 12 compiler, you'll need to set $CCompiler to point CCompilerDriver to where you've installed the Intel compiler:

$CCompiler = {"Compiler" -> 
   "CompilerInstallation" -> "E:\\IntelCompiler"};

You can put this in a kernel initialization file, such as $UserBaseDirectory/Kernel/init.m so you don't need to evaluate it every time you start Mathematica.

Joel Klein

Posted 2012-05-23T14:55:12.470

Reputation: 4 935

2This should now Just Work in Mathematica 9. – Joel Klein – 2012-11-30T03:18:45.503