Re: Mathematica 7 is now available
- To: mathgroup at smc.vnet.net
- Subject: [mg94217] Re: Mathematica 7 is now available
- From: Jon Harrop <jon at ffconsultancy.com>
- Date: Mon, 8 Dec 2008 06:21:49 -0500 (EST)
- References: <gg62p3$56g$1@smc.vnet.net> <gh8hkr$r1d$1@smc.vnet.net> <ghavsp$ock$1@smc.vnet.net>
Michael Weyrauch wrote: > Hello, > >> Parallelism is used when performance is important. In general, >> Mathematica is used when performance is largely unimportant. >> Consequently, they are almost mutually exclusive. > > This is a strange statement, which I hardly understand. First of all, in > many of my numerical calculations performance is important (e.g. solving > large sets of coupled differential equations) and Mathematica compares > rather well with compiled languages (in a few cases I can compare with > compiled code which does the same calculations as my Mathematica code) > > Within such calculations often linear algebra routines are used, which > where parallalized in Mathematica even before Version 7, and, of course > it makes a big difference if your Computer has just one or more > processors available. So compared to compiled languages with programs > that are not parallelized (which is often the case) Mathematica may even > have an advantage. Yes, and that is true of any task where Mathematica already bundles a decent implementation that you can simply invoke. However, it is not true in general. >> For example, you would need to parallelize the following Mathematica >> program perfectly across 700,000 CPU cores to obtain performance >> comparable to the equivalent OCaml program: > > I don't know OCaml. This is not specific to OCaml. Here are equivalent implementations of that program in C++, Java, OCaml, SML, Scheme, Lisp and Haskell and all well over 100,000x faster than the Mathematica I gave (and many are more concise as well!): http://www.ffconsultancy.com/languages/ray_tracer/ > Therefore, could you elaborate a bit how this tremendous difference comes > about and under what conditions?? Mathematica programs are only competitively performant when the bottleneck is one of Mathematica's internal routines (FFT, Schur decomposition, regular expressions etc.). Optimizing Mathematica code largely entails reimplementing your code in such a way that stress is moved onto these internal functions even if that is objectively inappropriate (e.g. in the case of the recent example on this list with the subject "Floating-Point Computing"). If you cannot express a solution to your problem in such a way then Mathematica's performance is likely to be dire, often up to a thousand times slower than a compiled language. The program I gave hits several of Mathematica's inefficiencies and, consequently, it takes days to compute instead of seconds. I highly recommend learning when these performance issues are likely to arise because you can save a huge amount of time by developing from scratch in a performant language when you know performance will be important. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u
- Follow-Ups:
- Re: Re: Mathematica 7 is now available
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Re: Mathematica 7 is now available