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
- Set up passwordless private/public key pairs between the host and client computers. Please contact your local System Administrator for help, if necessary.
- Start Mathematica on the client computer and open a new notebook.
-
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]
-
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)}}
[English]
1-800-WOLFRAM (+1-217-398-0700 美国境外用户)
客服支持
周一至周五
8am–5pm 美国中部时区
- 产品注册或激活
- 预售信息和订单
- 安装帮助和首次启动
高级技术支持 (面向特定用户)
周一至周四
8am–7pm 美国中部时区
周五
8:30–10am & 11am–5pm 美国中部时区
- 优先技术支持
- Wolfram 专家助理专员
- Wolfram 语言编程帮助
- 高级安装支持