Re: much power to mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg125357] Re: much power to mathematica
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Fri, 9 Mar 2012 06:08:14 -0500 (EST)
- Delivered-to: email@example.com
On 3/8/12 at 4:41 AM, dave at removedbailey.co.uk (David Bailey) wrote: >On 06/03/2012 10:59, Bill Rowe wrote: >>On 3/5/12 at 1:03 AM, aleks.post at gmail.com (Alexey Kornetov) wrote: >>>Hmm.. You are right. I'm new in mathematica if there is the way to >>>allocate evolution between the cores to gain much speed? >>To allocate processing between cores you need to write your code to >>make use of functions such as ParallelTable. That is, your code >>needs to take advantage of parallel processing. Note, parallel >>processing can and will speed up some things but not all things. >Since you say you are a newcomer to Mathematica, I would be very >wary about plunging into parallel constructs unless you are sure >your code cannot be speeded up in other ways, such as: >Use of functional constructs. >Ensuring all arrays are 'packed'. >etc. >Remember that the maximum possible gain from parallelisation is >given by the number of cores on your machine, whereas other speedup >tricks can often achieve larger savings. This is most excellent advice. In fact, I should have made it clear I myself seldom use things like Compile or parallel processing to achieve speed improvements. I've found simply understanding my problem throughly and applying the correct functional constructs generally gives the performance I need. Both Compile and parallel processing can produce significant performance gains for some code and some problems. Compile is often particularly effective for procedural code. But it is very important to know neither Compile nor parallel processing will always produce performance gains. For a great many problems both can actually degrade performance of well written functional code in Mathematica. Getting maximum performance from Mathematica very much requires a complete understanding of the problem you are trying to solve and some effort in looking at how your code is working. There is no single simple approach guaranteed to always speed up Mathematica code.