In the blog https://writings.stephenwolfram.com/2020/12/launching-version-12-2-of-wolfram-language-mathematica-228-new-functions-and-much-more/, I find the following idea.
It’s now possible to use WSTPServer to set up a centralized kernel pool to which you can connect the notebook front end, allowing you, for example, to keep running a particular session (or even a particular computation) in the kernel even as you switch to a different notebook front end, on a different computer.
In front end I can use the traditional method add a kernel to work by set MLOpen to "-LinkMode Listen ....".
The following codes also work. But I do not know how to set the WSTPServerKernels as default to run sequential codes. I want to use WSTPServerKernels as a kernel of the front end.
CloseKernels[];
Kernels[]
$MachineName
Needs["SubKernels`WSTPServerKernels`"]
LaunchKernels["wstp://192.168.1.202", 2]
Parallelize@Table[$MachineName, {i, 1, 10}]
The output is OK.
I have tried set MLOpen to "-linkmode connect -linkname 31415@192.168.1.4 -linkprotocol TCPIP -linkoptions 4" and shell command as " ssh xix@192.168.3.202 "wolfram" -wstp -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname
" -LinkHost 192.168.1.202" .
I run "./wstpserver -l 3 -i 192.168.1.202" in the side of wstpserver.
In front end, I run the code "1+1"。 The output of wstpserver as following and the title of front end is always says "(Running...)"
WSTPServer: Logger (2, 2021-01-17 19:59:36): Debug:
An expression on the kernel link:
* with an ID of "845a-9b23-0aac",
* and bridged with the connection with an ID of "2abd-5fd2-6122"
- is ready
WSTPServer: Logger (2, 2021-01-17 19:59:36): WSTP:
ReturnPacket [
EnterExpressionPacket [
HoldComplete [
Plus [1 , 1 ]]]]
WSTPServer: Logger (2, 2021-01-17 19:59:36): Debug:
An expression was transferred from a kernel to a connection
The output of wstpserver is so ugly.