How do I use remote kernels between Linux operating systems?
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", "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"]
-
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)}}
[English]
1-800-WOLFRAM (+1-217-398-0700 美国境外用户)
客服支持
周一至周五
8am–5pm 美国中部时区
- 产品注册或激活
- 预售信息和订单
- 安装帮助和首次启动
高级技术支持 (面向特定用户)
周一至周四
8am–7pm 美国中部时区
周五
8:30–10am & 11am–5pm 美国中部时区
- 优先技术支持
- Wolfram 专家助理专员
- Wolfram 语言编程帮助
- 高级安装支持