CloseKernels

CloseKernels[]

terminates all parallel kernels from the list ParallelKernels[].

CloseKernels[k]

terminates the kernel k.

CloseKernels[{k1,k2,}]

terminates the kernels k1, k2, .

CloseKernels["prop"]

terminates kernels that satisfy the given property.

Details

  • Kernels can be specified either using KernelObject, as returned by Kernels[], or using their integer IDs, as returned by $KernelID.
  • The following properties can be used to select a subset of all running kernels:
  • Allall kernels
    "CloudKernels"all cloud kernels
    "LinkKernels"all link 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
  • Closed kernels are removed from the list of kernels available for parallel computing, as given by ParallelKernels[].

Examples

open allclose all

Basic Examples  (1)

Close all running parallel kernels:

Scope  (3)

Close any parallel kernels that may be running and launch the default kernels:

Close all kernels:

Launch copies of the previously running kernels:

Launch kernels of various types:

Close all LWG kernels:

Close all remote kernels:

Close all local kernels:

Applications  (1)

Measure the speedup of the same calculation with different numbers of kernels used:

Properties & Relations  (1)

Distributed definitions and shared variables apply to running kernels and new ones:

Packages read with ParallelNeeds also apply to running and new kernels:

Close all running kernels and launch new ones:

The new kernels inherit previously distributed definitions and shared variables:

The new kernels also inherit packages read previously:

Possible Issues  (1)

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

Wolfram Research (2008), CloseKernels, Wolfram Language function, https://reference.wolfram.com/language/ref/CloseKernels.html.

Text

Wolfram Research (2008), CloseKernels, Wolfram Language function, https://reference.wolfram.com/language/ref/CloseKernels.html.

CMS

Wolfram Language. 2008. "CloseKernels." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CloseKernels.html.

APA

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

BibTeX

@misc{reference.wolfram_2024_closekernels, author="Wolfram Research", title="{CloseKernels}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/CloseKernels.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_closekernels, organization={Wolfram Research}, title={CloseKernels}, year={2008}, url={https://reference.wolfram.com/language/ref/CloseKernels.html}, note=[Accessed: 22-November-2024 ]}