Questions tagged [parallelization]

Questions on parallel computing in Mathematica.

Parallel computing in Mathematica is based on launching and controlling multiple Mathematica kernel (worker) processes from within a single master Mathematica, providing a distributed-memory environment for parallel programming. Questions about starting, scheduling, waiting for and finishing processes in parallel and exchanging data between processes should use this tag.

A lot of parallelization is done autmatically (Parallelize, ParallelEvaluate, ParallelTry, ...). Many common data-handling functions also have parallel twins (ParallelMap, ParallelTable, ParallelSum, ...)

Some useful knowledge about parallel computation:

Some example questions:

If you are looking for performance optimization consider using the tag too.

933 questions
50
votes
3 answers

Are built-in Mathematica functions already parallelized?

I've been noticing something strange since updating to Mathematica 8, and that is that occaisionally I'll see that the MathKernel is using up to 800% CPU in my Activity Monitor on OS X (I have 8 cores). I have no Parallel calls whatsoever, and this…
Guillochon
  • 6,117
  • 2
  • 31
  • 57
31
votes
2 answers

List of Parallelize[]-able functions

The question is clear and is inspired by this question and the first comment on this question. Although there are many tricks for parallelizing things that are not Parallelize[]-able it would be handy to know beforehand whether the function you need…
faleichik
  • 12,651
  • 8
  • 43
  • 62
30
votes
1 answer

Is it safe to launch/close kernels in the middle of a parallel calculation?

It appears that it is possible to launch additional kernels (or close existing ones) during a parallel calculation. The newly launched kernels will be utilized for the rest of the calculation. Here's a simple way to test and illustrate this (in a…
Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
22
votes
1 answer

Two, maybe related, issues with ParallelTable

I will use a very simple example for demonstrating two issues I face with ParallelTable, one with respect to the speed and one with respect to the use of memory. These issues might be related. Let us start with the speed. args=RandomReal[1,…
Fred Simons
  • 10,181
  • 18
  • 49
20
votes
1 answer

Does Mathematica take advantage of hyper-threading (if it is available)?

I do not know much about computer architecture, but some Intel processors have hyper-threading technology, which can apparently improve parallelization for applications that take advantage of it. In a processor with hyper-threading technology, the…
Andrew
  • 10,569
  • 5
  • 51
  • 104
20
votes
2 answers

Parallelization problem in LinearSolve and Minimize

My CPU has got 8 cores (it is Intel Core i7-2600 3.40 GHz). When I try to solve a linear matrix equation using LinearSolve for large matrices, Mathematica just uses 4 cores to solve the problem (CPU usage will be 50%). So it means that there is a…
mak maak
  • 369
  • 3
  • 9
16
votes
1 answer

How to parallel the computation tasks according to machines instead of kernels

On a HPC, there are many computation nodes, each node corresponds to an independent machine. Every node has several cores, for example 8 per node. Mathematica can launch remote kernels on different nodes (see method here). After all the kernels were…
matheorem
  • 17,132
  • 8
  • 45
  • 115
16
votes
2 answers

Tell ParallelMap[] to use just specific kernels

Is there a way to tell ParallelMap to use just some specific kernels (as is possible for ParallelEvaluate)? Background: I have 6 local and 16 remote kernels. During some analysis I call ParalleMap twice. One ParallelMap is quicker using all the…
Ajasja
  • 13,634
  • 2
  • 46
  • 104
15
votes
2 answers

Writing data to a common file during parallel processing

I am executing a loop, and in each loop I have to store a parameter in a file. It is like file = FileNameJoin[{NotebookDirectory[], "info.txt"}]; OpenWrite[file]; Do[out = Prime[i]; WriteString[file, i, "\t", out, "\n"], {i, 1, 10}] Close[file] It…
Sumit
  • 15,912
  • 2
  • 31
  • 73
14
votes
1 answer

Parallel optimization of Markov Chain Monte Carlo

I'm trying to reduce the computation time of a MCMC simulation. Essentially I have a set of particles performing a random walk in a periodic random potential. The particles are independent and every 100 timesteps I perform some checks and modify the…
CupiDio
  • 439
  • 2
  • 9
14
votes
1 answer

DistributeDefinitions and synchronization in Mathematica 10

The command DistributeDefinitions[z] installs all current definitions for z on the local kernels. A simple example: we assign the value 1 to z in the mainkernel, distribute the definitions of z and inspect the values of z in the subkernels. All are…
Fred Simons
  • 10,181
  • 18
  • 49
13
votes
1 answer

Parallelization and Hadoop

The short question: Has anyone used Mathematica in conjunction with Hadoop and does Mathematica's built in parallelization play well with Hadoop? The long version: So I have a Mathematica program that I would like to do the following: I have a…
13
votes
4 answers

Why is ParallelTable slower than Table?

Update Following a comment of Szabolcs have changed Timing to AbsoluteTiming. The results are virtually the same. Original post I have accidentally observed the following surprising result. So, why should I use ParallelTable? $Version (* Out[114]=…
Dr. Wolfgang Hintze
  • 13,039
  • 17
  • 47
13
votes
3 answers

Parallelization works, but does not use all CPU power

I've written code which involves Parallelize@Cases. When I evaluate, I find that all 16 cores are being used, but not fully; in other words all cores are active, but the total CPU usage is only 50%. Is this an indication that my code as it is simply…
Luther
  • 133
  • 1
  • 4
11
votes
1 answer

How to monitor the communication between parallel kernels

Recently I increased the problem size in my code, and it scales up very badly using ParallelTable. With a lot of help from the this community, it seems that the problem maybe caused by the communication of large data between the kernels. So is there…
xslittlegrass
  • 27,549
  • 9
  • 97
  • 186
1
2 3
11 12