Concepts of Parallel Computing inStatistics and Machine Learning Toolbox
Subtleties in Parallel Computing
There are two main subtleties in parallel computations:
Nested parallel evaluations (seeNo Nested parfor Loops). Only the outermost
parfor
loop runs in parallel, the others run serially.Reproducible results when using random numbers (seeReproducibility in Parallel Statistical Computations). How can you get exactly the same results when repeatedly running a parallel computation that uses random numbers?
Vocabulary for Parallel Computation
worker— An independent MATLAB®session that runs code distributed by theclient.
client— The MATLAB session with which you interact, and that distributes jobs to workers.
parfor
— A Parallel Computing Toolbox™ function that distributes independent code segments to workers (seeWorking with parfor).random stream— A pseudorandom number generator, and the sequence of values it generates. MATLAB implements random streams with the
RandStream
class.reproducible computation— A computation that can be exactly replicated, even in the presence of random numbers (seeReproducibility in Parallel Statistical Computations).