Compiling in Mathematica 8
- To: mathgroup at smc.vnet.net
- Subject: [mg114959] Compiling in Mathematica 8
- From: DmitryG <einschlag at gmail.com>
- Date: Fri, 24 Dec 2010 04:12:06 -0500 (EST)
I was pleasantly surprised by new features of Mathematica 8, especially by the possibility to compile pieces of code that solve the speed issue that remained painful in previous versions of Mathematica. Now one can write efficient Monte Carlo or fractal routines in Mathematica. Compilation can be done into Mathematica's native code with speed increase by a factor of 50-100 or into a C code with a much larger speed gain, if a C compiler is installed on your computer. I have two practical questions. 1. What C compiler can be recommended for me as non-C-programmer to install under Windows XP SP2? In the past I was using Microsoft C compiler that, as my friends said, was much faster than the others. Now, the current version of Microsoft C compiler requires SP3 to be installed that I don't want. Also what kind of C compiler would do, C or C++? 2. What about compiling of Mathematica's own routines such as NDSolve? I believe constructions such as Compile[{arguments}, NDSolve[...]] won't work. I have read in the help that NDSolve etc. decide automatically if compilation has to be done. There are also options such as Compile->True, and I have read that one can add // Developer`PackedArrayQ at the end and if the output is True, the command is compiled. I have tried this with NDSolve with both Compile- >True and Compile->False inside and in all cases the output was False. So I suspect NDSolve is never compiled. This is a pity because I am using NDSolve a lot and it works much slower than similar routines written in C or Fortran. I would greatly appreciate advice from Wolfam stuff and members of this group. Happy holidays for all, Dmitry