了解内核与前端的通信-为什么前端会冻结? [英] Understanding Kernel-FrontEnd communication -- Why does my Front End freeze?

查看:118
本文介绍了了解内核与前端的通信-为什么前端会冻结?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:仅确认是否可以复制此内容将很有用.只需一台计算机即可尝试此操作(无需远程连接).

Just a confirmation whether you can reproduce this or not would be useful. Only a single computer is needed to try this (no remote connection necessary).

更新:似乎其他人无法在Mac或Win7上重现此内容,因此它特定于WinXP或特定于我的机器.在这一点上,我正在放弃.

Update It seems other can't reproduce this on Mac or Win7, so it's either WinXP-specific or specific to my machine. At this point I'm giving up.

最好有一个有关前端与内核如何通信的教程,以便我们可以调试远程内核问题.任何此类一般性答案(或指向其他地方的教程的链接)都是最受欢迎的.我已经知道Sascha Kratky的远程内核策略.

It would be good to have a tutorial on how the Front End and the Kernel communicate, so we can debug remote kernel issues. Any such general answers (or links to tutorials elsewhere) are most welcome. I am already aware of Remote Kernel Strategies by Sascha Kratky.

现在有一个实际问题::当我以任何方式(例如,使用远程内核策略)连接到远程计算机时,前端迟早都会冻结.我该如何预防?

Now the practical question: When I connect to a remote machine in any way (e.g. using remote kernel strategies), the front end will sooner or later freeze up. How can I prevent this?

这是在单台机器上重现问题的方法(无需远程连接):

Here's how to reproduce the problem on a single machine (no remote connection needed):

  1. 创建新的内核配置(评估菜单->内核配置选项...)

  1. Create a new kernel configuration (Evaluation menu -> Kernel Configuration Options...)

选择高级选项.

MLOpen的参数:

Arguments to MLOpen:

-LinkName "8000@YOUR-IP-HERE,8001@YOUR-IP-HERE" -LinkMode Listen 
-LinkProtocol TCPIP -LinkHost "YOUR-IP-HERE" -LinkOptions MLDontInteract

(用计算机的IP地址替换YOUR-IP-HERE.在Windows上,可以通过在命令窗口中键入ipconfig来获取它.)

(Replace YOUR-IP-HERE with your computer's IP address. On Windows you can get this by typing ipconfig in a command window.)

启动内核的Shell命令:留空(我们将手动执行)

Shell command to launch kernel: leave empty (we will do it manually)

打开一个新笔记本,将笔记本的内核设置为您刚刚设置的内核,然后进行评估(1+1).

Open a new notebook, set the notebook's kernel to the one you just set up, and evaluate something (1+1).

现在,我们需要在连接超时之前手动启动内核.因此,以命令行模式启动新内核(math),并评估以下内容:

Now we need to launch the kernel manually, before the connection times out. So start a new kernel (math) in command line mode, and evaluate the following:

link=LinkConnect["8000,8001",LinkProtocol->"TCPIP"] (* connect to front end link *)

$ParentLink = link; (* set the front end link as parent link *)

现在已建立连接,并且一切似乎都正常工作(在前端的粉红色消息窗口中保留一条消息)

Now the connection is established, and everything appears to work correctly (save for the one message in the front end's pink message window)

评估Manipulate[n, {n, 0, 100, 1}].首先,这似乎也起作用.现在玩滑块.前端迟早会冻结,需要杀死.对我而言,在不松开的情况下上下拖动滑块大约10秒钟就足够了.

Evaluate Manipulate[n, {n, 0, 100, 1}]. First, this appears to work too. Now play with the slider. Sooner or later the front end will freeze and needs to be killed. For me, dragging the slider up and down for ~10 seconds without releasing it always suffices.

前端为何冻结?如何以一种可以正常运行的方式在前端和内核之间创建TCPIP模式连接?

Why does the Front End freeze? How can I create a TCPIP-mode connection between the front end and the kernel in a way that everything will be working correctly?

一些注意事项:

  • 我正在使用Windows XP.
  • 如果我使用LinkProtocol -> "SharedMemory",问题将永远不会出现.
  • 使用评估中止计算->中止评估确实可以正常工作.
  • 我已经使用Links[]验证了MathLink`$PreemptiveLinkMathLink`$ServiceLink已创建,并且LinkConnectedQ[]对其返回了True.
  • I'm on Windows XP.
  • The problem never appears if I use LinkProtocol -> "SharedMemory".
  • Aborting calculations using Evaluation -> Abort Evaluation does work correctly.
  • I have verified using Links[] that MathLink`$PreemptiveLink and MathLink`$ServiceLink are created and LinkConnectedQ[] returns True on them.

同样,请注意,只有连续拖动Manipualate滑块几秒钟而不释放它,前端才会冻结.

Again, note that the Front End will freeze only after dragging the Manipualate slider continuously for a few seconds without releasing it.

链接到MathGroup上的同一问题.

相关:用于远程内核正常工作的防火墙设置( Mathematica)

推荐答案

(不是答案,但很难将其写为评论)

(not an answer, but hard to write this as comment)

fyi,这里有一些有关前端如何与内核对话的信息 http://reference.wolfram.com/mathematica/tutorial/AdvancedDynamicFunctionality.html

fyi, there is a little bit on information about how the frontend talks to the kernel here http://reference.wolfram.com/mathematica/tutorial/AdvancedDynamicFunctionality.html

大约下降一半

The front end and kernel communicate with each other through several 
MathLink connections, known as the main link, the preemptive link, 
and the service link. The main and preemptive links are pathways by 
which the front end can send evaluation requests to the kernel, and 
the kernel can respond with results. The service link works in reverse, 
with the kernel sending requests to the front end.

还有更多.可能会有所帮助.另外,第31页的PDF文件中包含相同的信息:

and more there. May be that will help. Also, same information is in the PDF file on page 31:

http://www.wolfram.com/learningcenter/tutorialcollection/DynamicInteractivity/

内核和前端之间的实际消息传递协议必须非常先进.

The actual messaging protocol between the kernel and front end must be very advanced.

这篇关于了解内核与前端的通信-为什么前端会冻结?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆