Problem
The success rate of connecting to a remote kernel is only 30%. And no matter success or not, it takes 5 mins for Mathematica to give me a result!
Is there anyone who has tried this function? Please help me!
Details
I want to use a remote powerful server for computing. I emailed Wolfram support and they replied that I should use WSTP Server and give me this tutorial.
I followed its steps, started WSTP Server on the server-side, and add a new kernel on my laptop.
I then execute 2+2
but no response at all. I also tried WSTPServer`GetKernelID[]
several times. The possibility of success is about 30%, in other cases, Mathematica will throw out some error.
The biggest problem is whether it successes or not, it takes 5 mins for Mathematica to show the result!
Add on Dec 25th
I think the problem is not the communication between the client-side and WSTPServer, but WSTPServer and the MMA kernel on the server-side. Because
- Immediately after I execute a command on the client-side, the server-side output the log "An expression was transferred from a kernel to a connection".
- When the client-side is waiting (remember that one has to wait 5 mins for a result), kill WSTPServer, the client-side will show an error immediately.
And I found that, although the success rate is very low, the commands after one success can always be executed. So I propose the following workaround. Set the timeout of WSTPServer waiting for MMA kernel shorter, for example, 3s, rather than 5mins. Then one can execute a simple command, for example, 2+2
again and again until a successful one. Then start the real computation.
Supplements
There is another tutorial howto/ConnectToARemoteKernel. Wolfram support team said it is obsolete and it does not work as well.
This WSTP Server is very new. Only work for 12.2 or later. So there is no literature at all except Wolfram's tutorial.
Both the client-side and the server-side are using the latest version of Mathematica (12.3.1.0).
My network condition is excellent.
$ ping -i 0.2 -c 20 babak.dynv6.net
20 packets transmitted, 20 received, 0% packet loss, time 4447ms
rtt min/avg/max/mdev = 2.135/2.309/3.292/0.239 ms
- I check the network connection status on the server. I can see after I strike "shift+enter" on the client, a new connection is established immediately. I do not know why it takes such a long time to return (or crash).
# lsof -i:31415
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
wstpserve 48234 babak 7u IPv4 713936 0t0 TCP 166.111.178.36:31415 (LISTEN)
wstpserve 48234 babak 8u IPv4 752738 0t0 TCP 166.111.178.36:31415->59.66.17.191:38812 (ESTABLISHED)
wstpserve 48234 babak 9u IPv4 752739 0t0 TCP 166.111.178.36:31415->59.66.17.191:38814 (ESTABLISHED)
I also captured traffic using Wireshark on my laptop. The symptom is the same. Some data is transferred at the beginning, but no communication after that.
I increased the log level on the server-side. But the log is messy and not well-formatted. The log is 1.2M for a single
2+2
. I tried to extract some information from it but failed.