WOLFRAM

How do I use remote kernels on macOS and Linux machines?

Background Information

Parallelization in Mathematica uses the hub-and-spoke model in which a controlling kernel manages a number of subordinate kernels (subkernels). Remote computers that have Mathematica installed can provide additional subkernels beyond the local subkernels.

A remote computer that provides subkernels is considered a host, while the computer running the controlling kernel is considered the client. If the host computer is running a Linux or macOS operating system, then Mathematica can use SSH to connect with remote Wolfram kernels.

Setup

  1. Set up passwordless private/public key pairs between the host and client computers. Please contact your local System Administrator for help, if necessary.
  2. Start Mathematica on the client computer and open a new notebook.
  3. In the notebook, specify an SSH kernel on the remote machine with KernelConfiguration:

    kernel = KernelConfiguration["ssh://remote-host-name", "KernelCommand" -> "full path to kernel"]

    For example, to specify an SSH kernel on a remote macOS machine with a default installation of Mathematica:

    In[1]:= kernelConfigMacOS = KernelConfiguration["ssh://myRemoteMac",
    "OperatingSystem" -> "MacOSX", "KernelCount" -> 4]
    

    For a default installation of Mathematica on a remote Linux machine:

    In[1]:= kernelConfigLinux = 
    KernelConfiguration["ssh://myRemoteLinux", "KernelCount" -> 8]

  4. Launch the remote kernels with LaunchKernels[], and use any parallel functionality to perform parallel computations.

    For example, use four kernels launched on the remote macOS machine for parallel computations:

    In[2]:= LaunchKernels[kernelConfigMacOS];
    ParallelEvaluate[{$KernelID, $MachineName, $Version}]
    
    
    Out[3]= {{9, myRemoteMac, 14.1.0 for Mac OS X ARM (64-bit) (June 16, 2024)},
    {10, myRemoteMac, 14.1.0 for Mac OS X ARM (64-bit) (June 16, 2024)},
    {11, myRemoteMac, 14.1.0 for Mac OS X ARM (64-bit) (June 16, 2024)},
    {12, myRemoteMac, 14.1.0 for Mac OS X ARM (64-bit) (June 16, 2024)}}

    Use four kernels launched on the remote Linux machine for parallel computations:

    In[2]:= LaunchKernels[kernelConfigLinux];
    ParallelEvaluate[{$KernelID, $MachineName, $Version}]
    
    
    Out[3]= {{17, myRemoteLinux, 14.1.0 for Linux x86 (64-bit) (June 16, 2024)},
    {18, myRemoteLinux, 14.1.0 for Linux x86 (64-bit) (June 16, 2024)},
    {19, myRemoteLinux, 14.1.0 for Linux x86 (64-bit) (June 16, 2024)},
    {20, myRemoteLinux, 14.1.0 for Linux x86 (64-bit) (June 16, 2024)}}

Is this article helpful?
Yes
No

Any comments?

Thank you for your feedback.

Submit

Contact Support

Whether you have a question about billing, activation or something more technical, we are ready to help you.

1-800-WOLFRAM (+1-217-398-0700 for international callers)

Customer Support

Monday–Friday
8am–5pm US Central Time

  • Product registration or activation
  • Pre-sales information and ordering
  • Help with installation and first launch

Advanced Technical Support (for eligible customers)

Monday–Thursday
8am–5pm US Central Time

Friday
8:30–10am & 11am–5pm US Central Time

  • Priority technical support
  • Product assistance from Wolfram experts
  • Help with Wolfram Language programming
  • Advanced installation support