1
$\begingroup$

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. newly added 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. 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

  1. There is another tutorial howto/ConnectToARemoteKernel. Wolfram support team said it is obsolete and it does not work as well.

  2. This WSTP Server is very new. Only work for 12.2 or later. So there is no literature at all except Wolfram's tutorial.

  3. Both the client-side and the server-side are using the latest version of Mathematica (12.3.1.0).

  4. 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
  1. 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)
  1. 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.

  2. 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.

$\endgroup$
6
  • $\begingroup$ I cannot help but notice that on the first picture you loaded under the Basic Options, you are starting a kernel on the "Local Machine" i.e., your laptop. Is that so? $\endgroup$
    – Syed
    Dec 2, 2021 at 19:11
  • $\begingroup$ Thanks. Noticed that the -advanced options" box is checked and there are indeed some traffic to tge server. So I think it is using the remote kernel. $\endgroup$
    – Youran
    Dec 3, 2021 at 0:57
  • 2
    $\begingroup$ I think the basic problem is that the kernel tries to open the connection to the frontend (even when using WSTP server). If the FrontEnd is not accessible from the kernel host you'll see a huge timeout. The only option I'm aware of is to use some kind of VPN between frontend and kernel. I'm using Wireguard and/or Nebula. There were (now defunct AFAIK) solution using port forwarding with ssh, but it's very tricky — it tries to intercept kernel launch arguments and dynamically forward ports $\endgroup$ Dec 25, 2021 at 8:08
  • $\begingroup$ Thanks for that. Will open a frontend on the server-side help (my server has GUI)? $\endgroup$
    – Youran
    Dec 25, 2021 at 11:22
  • 2
    $\begingroup$ @Youran here's my very old comment on the problem: mathematica.stackexchange.com/questions/208607/… So my recommendation will be to set up a VPN and disable any firewall on it. I don't think this (very real )issue from 199X will be be fixed in 2XXX. $\endgroup$ Dec 26, 2021 at 12:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.