Skip to content

Latest commit

 

History

History
62 lines (51 loc) · 3.88 KB

remotemmakernel.md

File metadata and controls

62 lines (51 loc) · 3.88 KB

Remote Mathematica Kernels

The Victor, Fritz and Igor workstations can run long asynchronous Mathematica scripts [file] (.m or .wls) from the command line:

wolframscript -file [file.m]

They can also be used as servers for QuESTlink, as described here.

However, the workstations are particularly convenient for running remote Mathematica kernels, accessible from notebooks on your own machine.

Remote kernels may not be compatible with the Oxford VPN, and may require the user is connected to an Oxford network.

Setup

Assuming Mathematica is already installed on a workstation (via this guide), here's how to setup the remote kernel connection from your local computer.

  1. Setup passphrase-free SSH to a workstation, via this guide.

    Sadly Windows users must instead deal with entering their workstation credentials each time when launching the kernel

  2. From a Mathematica notebook, create a remote kernel via Evaluation > Kernel Configuration Options > Add...

    • set Kernel Name to (e.g.) Victor
    • tick Advanced Options
    • set Arguments to MLOpen:
      -LinkMode Listen -LinkProtocol TCPIP -LinkOptions MLDontInteract
      
    • The Launch Command depends on whether the workstations is running Linux (like Victor and Fritz) or MacOS (Igor), and where the Wolfram files are located. Replace [NAME] with your credentials in the Launch Commands below:
      • Victor:
        ssh [NAME]@victorslab.materials.ox.ac.uk 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/Wolfram/Mathematica/11.3/SystemFiles/Libraries/Linux-x86-64/;/home/Wolfram/Mathematica/11.3/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel -wstp -LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`"'
      • Fritz:
        ssh [NAME]@fritzlab.materials.ox.ac.uk '/usr/local/Wolfram/Mathematica/12.1/SystemFiles/Kernel/Binaries/Linux-x86-64/WolframKernel -wstp -LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`"'
      • Igor:
        ssh [NAME]@igor-gpu.materials.ox.ac.uk '/Applications/Mathematica.app/Contents/MacOS/MathKernel -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`" -LinkHost `ipaddress`'

    The first command after the SSH is the full path to the Mathematica kernel. If this location somehow changes, it can be found via running

    First @ $CommandLine

    in any Mathematica service, such as wolframscript at the command-line or in a notebook.

Usage

You can start and connect to the remote kernels at any time, from within a local Mathematica notebook, by selecting Evaluation > Notebook's Kernel then your chosen Kernel Name. Any commands entered into your notebook will be sent over the network to the workstation, executed there, and the output returned. File IO will therefore use the workstation filesystem. To run a command on your client kernel (and share the result with the remote workstation), wrap it in a call to

UsingFrontEnd[]

If the workstation has been setup correctly (via this guide), it will contain pre-prepared QuESTlink environments, for both serial, multithreaded and GPU-accelerated modes. To use them in your remote-kernel notebook, run:

Import["/questlink/link.m"]
CreateLocalQuESTEnv["/questlink/serial"];

replacing serial with multi or gpu for multithreaded and GPU-accelerated modes respectively.

As of 22 Oct 2020, Victor, Fritz and Igor are all prepared with QuESTlink v0.5 (released 20 May 2020).