Configuring Kernels for Parallel Computing
Introduction: The Default Setting | Properties of Kernel Configurations |
Managing Configurations | Types of Kernels to Configure |
You can use local and remote additional kernels for performing parallel computations. Local kernels, using additional cores on your CPU, usually do not need any configuration, but for remote kernels you need to specify where they are and how to access the remote resources.
$DefaultParallelKernels | list of kernel configurations to launch by default |
KernelConfiguration["URL"] | configuration for a launchable kernel |
LaunchKernels[] | launch configured kernels |
Configuration of kernels for parallel computing.
Introduction: The Default Setting
The string "localhost" or "Local" is a short form of a kernel configuration. To obtain all properties of a kernel configuration, turn it into a configuration object and query it for its properties.
Managing Configurations
When you assign a new value to $DefaultParallelKernels, any subsequent use of LaunchKernels[] in the current session will use these kernels. The value is also remember between sessions.
Kernel configurations can also be edited from the Kernels section of the Preferences or the Evaluation ▶ Parallel Kernel Configuration… menu item.
Properties of Kernel Configurations
The detailed form of a kernel configuration supports many properties that you can modify for special situations.
The Location of the Engine Executable
For kernels on the local machine, the engine invoked is the same one as the one that invokes the kernel.
To access remote resources, you may need to specify the location of the engine executable on the remote machine if the "wolfram" executable is not on the shell search path.
Types of Kernels to Configure
To use kernels on machines other than your workstation, you need to specify the method used to access the remote machine and, depending on the method, additional parameters, such as remote a user name.
Local Kernels
"Local" | the default local kernel specification |
"localhost" | legacy localhost specification |
"file://" | an empty file URL to use the default kernel executable |
$ProcessorCount | an integer to denote the number of default kernels to launch |
Equivalent forms of local kernel URLs.
Local kernels can be specified with the legacy "localhost" string, a file URL or an integer, to indicate the desired number of default kernels.
SSH Kernels
The SSH protocol allows secure login on remote computers. It can be set up with SSH keys allowing login without a password prompt. Logging into a remote machine with the Wolfram Engine installed is an easy way to access remote resources in your lab, a local cluster or in cloud-computing services.
On a local Windows computer, it is recommended to install Microsoft's SSH package to allow the use of remote resources. Windows can also be configured as a remote resource by setting up an SSH server. This is an advanced topic not covered here.
Other operating systems come with SSH preinstalled.
"Username" | none | remote user name |
"OperatingSystem" | "Unix" | the remote operating system |
"KernelCommand" | os-dependent | the remote engine executable |
Common properties for SSH kernels.
WSTPServer Kernels
Install WSTPServer on a computer to easily provide kernels on this computer. WSTPServer can provide individual kernels for use in RemoteEvaluate, and parallel kernels.
A WSTPServer instance may provide several pools of kernels.
LightweightGrid Kernels
The Wolfram Lightweight Grid Manager is part of gridMathematica. It serves parallel kernels similarly to the way the more modern WSTPServer does. Detailed information on how to work with Lightweight Grid Manager is given in the tutorial Configuring LightweightGrid Kernels for Parallel Computation.
Lightweight Grid kernels are configured in much the same way as WSTPServer kernels, using the scheme lwg: in place of wstp:.