ParallelKernels

ParallelKernels[]

gives the list of running kernels available for parallel computing.

ParallelKernels["prop"]

gives those running kernels that satisfy the given property.

Details

  • On a multicore computer, kernels are normally launched automatically when needed for a parallel computation.
  • All available kernels are by default used for all parallel computations.
  • The following properties can be used to select a subset of all running kernels:
  • Allall kernels
    "CloudKernels"all cloud kernels
    "LocalKernels"all kernels running locally
    "LWGKernels"all LightweightGrid kernels
    "OneKernelPerMachine"one kernel for each different machine
    "RemoteKernels"all kernels on remote machines
    "SshKernels"all SSH kernels
    "WSTPServerKernels"all WSTPServer kernels

Examples

open allclose all

Basic Examples  (1)

The list of currently running parallel kernels:

Scope  (5)

Launch the default set of kernels:

Give the list of currently running parallel kernels:

Close all running parallel kernels:

No kernels are running:

Launch kernels on various machines:

Select one kernel for each machine:

Run an evaluation on this subset of kernels:

Select all kernels of a particular type:

Select all nonlocal kernels:

Generalizations & Extensions  (1)

Remember the list of running kernels:

Close all kernels:

Launch copies of the previously running kernels:

Properties & Relations  (2)

ParallelEvaluate by default does one evaluation on each kernel:

$KernelCount gives the number of running kernels:

Possible Issues  (2)

If no kernels are available, most parallel calculations are done sequentially:

A kernel launched as a remote kernel, but on the local machine, is treated as remote:

Neat Examples  (1)

Given multiple running kernels on many different machines:

Load a resource function into the cache on each machine only once:

Use the resource function in all kernels:

Wolfram Research (2022), ParallelKernels, Wolfram Language function, https://reference.wolfram.com/language/ref/ParallelKernels.html (updated 2022).

Text

Wolfram Research (2022), ParallelKernels, Wolfram Language function, https://reference.wolfram.com/language/ref/ParallelKernels.html (updated 2022).

CMS

Wolfram Language. 2022. "ParallelKernels." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/ParallelKernels.html.

APA

Wolfram Language. (2022). ParallelKernels. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ParallelKernels.html

BibTeX

@misc{reference.wolfram_2022_parallelkernels, author="Wolfram Research", title="{ParallelKernels}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/ParallelKernels.html}", note=[Accessed: 04-February-2023 ]}

BibLaTeX

@online{reference.wolfram_2022_parallelkernels, organization={Wolfram Research}, title={ParallelKernels}, year={2022}, url={https://reference.wolfram.com/language/ref/ParallelKernels.html}, note=[Accessed: 04-February-2023 ]}