Wolfram Computation Meets Knowledge

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",
    "KernelCommand" -> "/Applications/Mathematica.app/Contents/MacOS/WolframKernel"]

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

    In[1]:= kernelConfigLinux = KernelConfiguration["ssh://myRemoteLinux",
    "KernelCommand" -> "/usr/local/Wolfram/Mathematica/13.1/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel"]

  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]:= kernelsOnMacOS = LaunchKernels[kernelConfigMacOS, 4];
    
    ParallelEvaluate[{$KernelID,$MachineName,$Version}, kernelsOnMacOS]
    
    Out[3]= {{9, myRemoteMac, 13.1.0 for Mac OS X ARM (64-bit) (June 16, 2022)},
    {10, myRemoteMac, 13.1.0 for Mac OS X ARM (64-bit) (June 16, 2022)},
    {11, myRemoteMac, 13.1.0 for Mac OS X ARM (64-bit) (June 16, 2022)},
    {12, myRemoteMac, 13.1.0 for Mac OS X ARM (64-bit) (June 16, 2022)}}

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

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

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