WOLFRAM

Technologies

WSTPServer

Connect and Reconnect to Long-Lived Preinitialized Wolfram Engines

WSTPServer runs one or more pools of Wolfram Engines that are made available for WSTP connections from any client, locally or over the network.

WSTPServer is a server program that routes all traffic from a client to a kernel that it manages, allowing links to WSTPServer to behave as direct links to kernels. WSTPServer kernels are discoverable on the network, so you can have pools of kernels running on one or more machines. Because a WSTPServer kernel can be connected to, disconnected from and reconnected to, you can maintain a long-lived session that you can connect to from different programs or machines.

Features

WSTPServer introduces a wide variety of kernel management, connection and discovery features to best fit your needs.

Run Multiple Pools Of Preinitialized Kernels

WSTPServer can run multiple pools of kernels, each sharing user-configurable properties. Kernels are preinitialized according to the properties of the pool they are in.

Visible On The Network

WSTPServer is available on the local network in its default configuration, allowing users to connect from other machines.

Discoverable On The Network

WSTPServer uses DNS Service Discovery (DNS-SD) to advertise itself on the network, making it easy for clients to discover available WSTPServer instances and kernels.

Maintain A Long-Lived Session

WSTPServer allows you to reconnect to a kernel that you have previously connected to, even from a different machine.

Run Kernels On Dedicated Machines

WSTPServer instances can be placed on dedicated machines so that only those machines are busy with kernel processes. Having WSTPServer instances running on multiple dedicated machines is simple to set up, as WSTPServer instances are easily discovered on the network.

Connect From Any Wstp Client

Any WSTP-enabled program can connect to WSTPServer. Multiple products in the Wolfram ecosystem explicitly support WSTPServer, including WolframScript, the notebook front end, the parallel computing framework and J/Link.

Make Kernels Available For Parallel Computing

WSTPServer has the ability to launch and make parallel kernels available for the Wolfram Language's parallel computing functionality. It is easy to configure the parallel computing framework to make use of these kernels.

Conveniently Manage Connections To Desired Kernels

WSTPServer allows you to easily manage connections to desired kernels through its profile system. Kernels with specific properties can be requested in a profile, and the details of kernels you previously connected to can be tracked in a profile, allowing you to easily reconnect to them.

Query The Status Of Wstpserver

WSTPServer makes it easy to query the current status of WSTPServer and get diagnostics using a WSTP connection to it.

Examples

WolframScript

Evaluate the Wolfram Language code 2+2 in an available WSTPServer:

$ wolframscript -wstpserver -code 2+2
            4

Run the Wolfram Language in an interactive REPL using an available WSTPServer:

$ wolframscript -wstpserver
In[1]:= 2+2
                
                            Out[1]= 4
            
                            In[2]:=
                

Notebook Front End

Connect to WSTPServer using the notebook front end. Get the ID of the connected WSTPServer kernel, get the name of the pool it is in and evaluate a test expression:

Parallel Computing Functionality

Connect to WSTPServer parallel kernels from the Wolfram Language and use them in a parallel evaluation:

WSTP C Program

Connect to WSTPServer and evaluate the Wolfram Language code 2+2 using a WSTP C program:

file.wls
[link = MLOpenString(env, "-linkmode connect -linkname 31415 -linkprotocol TCPIP -linkoptions 4", &error);
                
                MLNextPacket(link); MLNewPacket(link);

                MLPutFunction(link, "EvaluatePacket", 1);
                MLPutFunction(link, "Plus", 2);
                MLPutInteger(link, 2);
                MLPutInteger(link, 2);
                MLEndPacket(link);
             

Technical Information

  • WSTPServer supports x64 systems running Windows, macOS or Linux. ARM 32-bit support is available on Linux.
  • WSTPServer is distributed with Version 12.2 of the Wolfram Language and above, and is compatible with Version 11 of the Wolfram Language and above.