Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16725

Parallelization sometimes a plus, sometimes not

From John Villarrubia <John.Villarrubia@nist.gov>
Newsgroups comp.soft-sys.math.mathematica
Subject Parallelization sometimes a plus, sometimes not
Date 2014-04-04 07:56 +0000
Message-ID <lhlojb$kif$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


I noticed recently that some of my calculations using ParallelMap are 
much slower than the same calculation with Map. The call is in the form

fits = ParallelMap[f[a,#,b,c]&,argumentList]

It takes a factor of 4 or 5 more time to run this using ParallelMap on 
my 8-core machine than using Map. I had seen this behavior in the old 
days, when I forgot to pass necessary definitions to the subkernels and 
the main kernel ended up doing all the work. That does not seem to be 
the issue here: ParallelMap in the Mathematica version I'm using (v. 8) 
is supposed to automatically pass the needed definitions and, indeed, it 
seems to have done so: In the TaskManager I can see all 8 subkernels 
busily maxed out for the whole time, while the main kernel runs at 1% or 
less (presumably gathering results).

You'll be wondering what's inside f. {a,b,c} are fixed arguments. The 
argumentList specifies a location in an image where a model function is 
fit to the data using a call to NonlinearModelFit. The model function 
has 4 floating parameters that are arguments of a 10-argument 
InterpolationFunction. (The other 6 parameters are held constant during 
any given fit.) The interpolation data set is huge and f itself is 
rather long, so it's not practical to list it here.

Naturally, since I can't easily list the code, I don't expect anyone to 
be able to pinpoint the problem. What I'm hoping is that someone else 
has experienced this and can say what the issue turned out to be--or 
that someone with experience doing parallel computing in Mathematica can 
say what sorts of things might be relevant to this. I'm struggling to 
think of those: For example, in browsing the list I see that shared 
variables are implicated in lots of people's problems. However, f is 
pretty self-contained. I have not set any shared variables or shared 
functions. There are some nonlocal variables that f reads, but does not 
alter.

What other sorts of things should I be investigating?

John


Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Parallelization sometimes a plus, sometimes not John Villarrubia <John.Villarrubia@nist.gov> - 2014-04-04 07:56 +0000

csiph-web