SBCL错误:在Linux机器上运行Maxima时“绑定堆栈耗尽”

前端之家收集整理的这篇文章主要介绍了SBCL错误:在Linux机器上运行Maxima时“绑定堆栈耗尽”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我知道有很多地方可以问这个问题,但我想我会在这里试试.我已经看起来已经从Maxima的好人那里得到了尽可能多的帮助.

我用SBCL运行Maxima并且一直出错;

INFO: Binding stack guard page unprotected
Binding stack guard page temporarily disabled: proceed with caution

Maxima encountered a Lisp error:

 Binding stack exhausted.

PROCEED WITH CAUTION.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
INFO: Binding stack guard page reprotected

我已经通过为动态空间大小和控制堆栈大小添加更大的值来修改对Maxima(其可执行文件)的调用,并且我已经查看了./…/sbcl-help以获取添加到$的参数的任何想法maxima可执行文件中的MAXIMA_LISP_OPTIONS.

另外,我通常在运行它之前做这些(虽然我认为它们是不必要的,因为操作系统很聪明,也许最后一个需要摆弄);

sudo fstrim -v /
echo 3 | sudo tee /proc/sys/vm/drop_caches
echo 262144 | sudo tee /proc/sys/vm/max_map_count

在完成我的千里马工作的几次计算之后,我扔了几个

:lisp (sb-ext:gc :full t)

希望避免这个错误.我不太了解lisp,当然也不了解垃圾收集的所有内容.

虽然我在Maxima工作中使用了memoization,但我的计算有点密集和递归.我的电脑用inxi -b描述为,

System:    Host: XXX-MacBookPro Kernel: 4.10.0-33-generic x86_64 (64 bit) Desktop: Cinnamon 3.4.6
           Distro: Linux Mint 18.2 Sonya
Machine:   System: Apple (portable) product: MacBookPro11 3 v: 1.0
           Mobo: Apple model: Mac-2BD1B313 v: MacBookPro11 3
           Bios: Apple v: MBP112.88Z.0138.B25.1702171721 date: 02/17/2017
cpu:       Quad core Intel Core i7-4980HQ (-HT-MCP-) speed/max: 1402/4000 MHz
Graphics:  Card: NVIDIA GK107M [GeForce GT 750M Mac Edition]
           Display Server: X.Org 1.18.4 drivers: nvidia (unloaded: fbdev,vesa,nouveau)
           Resolution: 2880x1800@59.99hz
           GLX Renderer: GeForce GT 750M/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 375.66
Network:   Card-1: Broadcom BCM4360 802.11ac Wireless Network Adapter driver: wl
           Card-2: Broadcom NetXtreme BCM57762 Gigabit Ethernet PCIe driver: tg3
Drives:    HDD Total Size: 1000.6GB (17.5% used)
Info:      Processes: 291 Uptime: 43 min Memory: 3366.6/15953.7MB Client: Shell (bash) inxi: 2.2.35 

我的Maxima和SBCL是由GIT构建的,并且是相当新的〜大约2周,从头部开始并且已经通过了他们所有的制造测试.另外我的交换看起来像;

XXX@XXX-MacBookPro ~/ResearchWC $cat /proc/swaps 
Filename                Type        Size    Used    Priority
/70GiB.swap                             file        73400316    0   -2
/dev/sda7                               partition   25564776    0   -1

而且我经常基本上没有内存和大约20-30G进入交换.

通常它似乎最终会挂起(比如说100小时之后,因为我注意到htop停止显示某些活动并且风扇不会上下移动)我认为耗尽错误有时会隐藏在嵌入式递归调用中.我收到上面的错误消息,因为我避免在我想要的递归级别调用函数,而是在终端“手动”构建它们. E.G.,而不是仅仅调用像fib(10)这样的东西,而是连续地调用fib(1),fib(2),fib(3),其中每个先前的值都被记忆.

我有时间,但似乎不知道如何最大化我的交换 – 观看htop我从未见过它使用超过说~25%.

1.)有谁知道我还可以用SBCL做些什么来避免这些错误

2.)在这些情况下,另一个lisp是否会更好,例如ecl,cml等?

提前感谢您的任何建议,如果需要,我可以提供更多详细信息.

UPDATE

增加动态空间大小,堆栈大小和绑定堆栈大小之后,这次崩溃时我遇到了堆限制而不是绑定堆栈.附加是回溯的输出(不确定两个寄存器pc和fp是什么…… – 程序计数器和帧指针?).我用痕迹(残留物,泰勒)也跑了这个,但从来没有看到任何可疑的东西……

ldb> backtrace
Backtrace:
   0: SB-BIGNUM::MULTIPLY-BIGNUM-AND-FIXNUM,pc = 0x21cb1336,fp = 0x7ffff3943f18
   1: SB-KERNEL::TWO-ARG-*,pc = 0x21cb00a7,fp = 0x7ffff3943f98
   2: MAXIMA::CTIMES,pc = 0x21e076b4,fp = 0x7ffff3943fc0
   3: MAXIMA::PCTIMES,pc = 0x21de5f4c,fp = 0x7ffff3943ff0
   4: MAXIMA::PCTIMES1,pc = 0x21e78f1e,fp = 0x7ffff3944048
   5: MAXIMA::PCTIMES,pc = 0x21de6033,fp = 0x7ffff3944078
   6: MAXIMA::PCETIMES1,pc = 0x21fe0560,fp = 0x7ffff39440d8
   7: MAXIMA::PTIMES1,pc = 0x21f457e5,fp = 0x7ffff3944148
   8: MAXIMA::PTIMES,pc = 0x21db6561,fp = 0x7ffff3944180
   9: MAXIMA::PSIMP,pc = 0x21dd0617,fp = 0x7ffff39441b8
  10: MAXIMA::PALGSIMP,pc = 0x22166db7,fp = 0x7ffff39441f0
  11: MAXIMA::PSIMP,fp = 0x7ffff3944228
  12: MAXIMA::PALGSIMP,fp = 0x7ffff3944260
  13: MAXIMA::PSIMP,fp = 0x7ffff3944298
  14: MAXIMA::PALGSIMP,fp = 0x7ffff39442d0
  15: MAXIMA::PSIMP,fp = 0x7ffff3944308
  16: MAXIMA::PALGSIMP,fp = 0x7ffff3944340
  17: MAXIMA::PSIMP,fp = 0x7ffff3944378
  18: MAXIMA::PALGSIMP,fp = 0x7ffff39443b0
  19: MAXIMA::PSIMP,fp = 0x7ffff39443e8
  20: MAXIMA::PALGSIMP,fp = 0x7ffff3944420
  21: MAXIMA::PSIMP,fp = 0x7ffff3944458
  22: MAXIMA::PALGSIMP,fp = 0x7ffff3944490
  23: MAXIMA::PSIMP,fp = 0x7ffff39444c8
  24: MAXIMA::PALGSIMP,fp = 0x7ffff3944500
  25: MAXIMA::PSIMP,fp = 0x7ffff3944538
  26: MAXIMA::PALGSIMP,fp = 0x7ffff3944570
  27: MAXIMA::PSIMP,fp = 0x7ffff39445a8
  28: MAXIMA::PALGSIMP,fp = 0x7ffff39445e0
  29: MAXIMA::PSIMP,fp = 0x7ffff3944618
  30: MAXIMA::PALGSIMP,fp = 0x7ffff3944650
  31: MAXIMA::PSIMP,fp = 0x7ffff3944688
  32: MAXIMA::PALGSIMP,fp = 0x7ffff39446c0
  33: MAXIMA::PSIMP,fp = 0x7ffff39446f8
  34: MAXIMA::PALGSIMP,fp = 0x7ffff3944730
  35: MAXIMA::PSIMP,fp = 0x7ffff3944768
  36: MAXIMA::PALGSIMP,fp = 0x7ffff39447a0
  37: MAXIMA::PSIMP,fp = 0x7ffff39447d8
  38: MAXIMA::PALGSIMP,fp = 0x7ffff3944810
  39: MAXIMA::PSIMP,fp = 0x7ffff3944848
  40: MAXIMA::PALGSIMP,fp = 0x7ffff3944880
  41: MAXIMA::PSIMP,fp = 0x7ffff39448b8
  42: MAXIMA::PALGSIMP,fp = 0x7ffff39448f0
  43: MAXIMA::PSIMP,fp = 0x7ffff3944928
  44: MAXIMA::PALGSIMP,fp = 0x7ffff3944960
  45: MAXIMA::PSIMP,fp = 0x7ffff3944998
  46: MAXIMA::PALGSIMP,fp = 0x7ffff39449d0
  47: MAXIMA::PSIMP,fp = 0x7ffff3944a08
  48: MAXIMA::PALGSIMP,fp = 0x7ffff3944a40
  49: MAXIMA::PSIMP,fp = 0x7ffff3944a78
  50: MAXIMA::PALGSIMP,fp = 0x7ffff3944ab0
  51: MAXIMA::PSIMP,fp = 0x7ffff3944ae8
  52: MAXIMA::PALGSIMP,fp = 0x7ffff3944b20
  53: MAXIMA::PSIMP,fp = 0x7ffff3944b58
  54: MAXIMA::PALGSIMP,fp = 0x7ffff3944b90
  55: MAXIMA::PSIMP,fp = 0x7ffff3944bc8
  56: MAXIMA::PALGSIMP,fp = 0x7ffff3944c00
  57: MAXIMA::PSIMP,fp = 0x7ffff3944c38
  58: MAXIMA::PALGSIMP,fp = 0x7ffff3944c70
  59: MAXIMA::PSIMP,fp = 0x7ffff3944ca8
  60: MAXIMA::PALGSIMP,fp = 0x7ffff3944ce0
  61: MAXIMA::PSIMP,fp = 0x7ffff3944d18
  62: MAXIMA::PALGSIMP,fp = 0x7ffff3944d50
  63: MAXIMA::PSIMP,fp = 0x7ffff3944d88
  64: MAXIMA::PALGSIMP,fp = 0x7ffff3944dc0
  65: MAXIMA::PSIMP,fp = 0x7ffff3944df8
  66: MAXIMA::PALGSIMP,fp = 0x7ffff3944e30
  67: MAXIMA::PSIMP,fp = 0x7ffff3944e68
  68: MAXIMA::PALGSIMP,fp = 0x7ffff3944ea0
  69: MAXIMA::PSIMP,fp = 0x7ffff3944ed8
  70: MAXIMA::PALGSIMP,fp = 0x7ffff3944f10
  71: MAXIMA::PSIMP,fp = 0x7ffff3944f48
  72: MAXIMA::PALGSIMP,fp = 0x7ffff3944f80
  73: MAXIMA::PSIMP,fp = 0x7ffff3944fb8
  74: MAXIMA::PALGSIMP,fp = 0x7ffff3944ff0
  75: MAXIMA::PSIMP,fp = 0x7ffff3945028
  76: MAXIMA::PALGSIMP,fp = 0x7ffff3945060
  77: MAXIMA::PSIMP,fp = 0x7ffff3945098
  78: MAXIMA::PALGSIMP,fp = 0x7ffff39450d0
  79: MAXIMA::PSIMP,fp = 0x7ffff3945108
  80: MAXIMA::PALGSIMP,fp = 0x7ffff3945140
  81: MAXIMA::PSIMP,fp = 0x7ffff3945178
  82: MAXIMA::PALGSIMP,fp = 0x7ffff39451b0
  83: MAXIMA::PSIMP,fp = 0x7ffff39451e8
  84: MAXIMA::PALGSIMP,fp = 0x7ffff3945220
  85: MAXIMA::PSIMP,fp = 0x7ffff3945258
  86: MAXIMA::PALGSIMP,fp = 0x7ffff3945290
  87: MAXIMA::PSIMP,fp = 0x7ffff39452c8
  88: MAXIMA::PALGSIMP,fp = 0x7ffff3945300
  89: MAXIMA::PSIMP,fp = 0x7ffff3945338
  90: MAXIMA::PALGSIMP,fp = 0x7ffff3945370
  91: MAXIMA::PSIMP,fp = 0x7ffff39453a8
  92: MAXIMA::PALGSIMP,fp = 0x7ffff39453e0
  93: MAXIMA::PSIMP,fp = 0x7ffff3945418
  94: MAXIMA::PALGSIMP,fp = 0x7ffff3945450
  95: MAXIMA::PSIMP,fp = 0x7ffff3945488
  96: MAXIMA::PALGSIMP,fp = 0x7ffff39454c0
  97: MAXIMA::PSIMP,fp = 0x7ffff39454f8
  98: MAXIMA::PALGSIMP,fp = 0x7ffff3945530
最佳答案
绑定堆栈溢出的最常见原因是递归函数,它无限地调用自身(即递归中的错误).第二个最常见的原因是一个正确编程的递归函数,但调用自身太多次以使Lisp实现处理它.

我忘记了SBCL的堆栈限制 – 它可能是8192,但这只是猜测.您可以通过实验确定它(如果不是通过阅读SBCL文档).

在任何一种情况下,您都可以尝试找出导致故障的功能

trace (mymaximafun1,mymaximafun2,...);

对于Maxima函数和/或

:lisp (trace mylispfun1 mylispfun2 ...)

对于Lisp函数.

关于第二个问题,您可以尝试通过将递归函数重新设置为迭代来避免深度递归.

你提到你有长时间运行的计算.减少崩溃影响的策略是调用save函数来不时地保存程序状态,例如:

save ("mycheckpointfile.lisp",all);

请注意,保存需要很多选项,所以可以通过文档看一下?保存.

您可以通过某些配方自动生成文件名,例如file_name:printf(false,“mycheckpointfile~d.lisp”,1000 random(9000)),它会生成一个随机的4位数字并将其粘贴到文件名中.当然有很多这样的食谱.

猜你在找的Linux相关文章