gpt4 book ai didi

linux - SBCL 错误 : "binding stack exhausted" when running Maxima on Linux machine

转载 作者:IT王子 更新时间:2023-10-29 00:54:30 25 4
gpt4 key购买 nike

我知道有很多地方可以问这个问题,但我想我会在这里试试。我似乎已经从 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

在做我的 Maxima 工作时经过一些计算,我投入了一些

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

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

虽然我在 Maxima 工作中使用了内存,但我的计算有些密集和递归。 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 周,并且已经通过了他们所有的 make 测试。另外我的交换看起来像;

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 停止显示某些事件并且风扇不会上下移动)并且我认为耗尽错误有时会被埋没在嵌入式递归调用中。我在上面收到此错误消息是因为我避免在我想要的递归级别调用该函数,而是在终端“手动”构建它们。例如,我不是仅仅调用 fib(10) 之类的东西,而是连续调用 fib(1)、fib(2)、fib(3),其中每个先前的值都被内存。

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

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

2.) 在这些情况下运行另一个 lisp 会更好吗? ecl、cml 等?

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

更新

在增加动态空间大小、堆栈大小和绑定(bind)堆栈大小之后,这次崩溃时我遇到的是堆限制而不是绑定(bind)堆栈。附件是回溯的输出(不确定 pc 和 fp 这两个寄存器是什么...... - 程序计数器和帧指针?)。我也用 trace(residue,taylor) 运行了这个,但从来没有看到任何可疑的东西......

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, pc = 0x21dd0617, fp = 0x7ffff3944228
12: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944260
13: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944298
14: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39442d0
15: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944308
16: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944340
17: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944378
18: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39443b0
19: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39443e8
20: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944420
21: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944458
22: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944490
23: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39444c8
24: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944500
25: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944538
26: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944570
27: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39445a8
28: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39445e0
29: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944618
30: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944650
31: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944688
32: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39446c0
33: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39446f8
34: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944730
35: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944768
36: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39447a0
37: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39447d8
38: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944810
39: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944848
40: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944880
41: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39448b8
42: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39448f0
43: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944928
44: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944960
45: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944998
46: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39449d0
47: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944a08
48: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944a40
49: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944a78
50: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944ab0
51: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944ae8
52: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944b20
53: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944b58
54: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944b90
55: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944bc8
56: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944c00
57: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944c38
58: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944c70
59: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944ca8
60: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944ce0
61: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944d18
62: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944d50
63: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944d88
64: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944dc0
65: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944df8
66: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944e30
67: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944e68
68: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944ea0
69: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944ed8
70: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944f10
71: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944f48
72: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944f80
73: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3944fb8
74: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3944ff0
75: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945028
76: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945060
77: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945098
78: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39450d0
79: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945108
80: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945140
81: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945178
82: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39451b0
83: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39451e8
84: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945220
85: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945258
86: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945290
87: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39452c8
88: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945300
89: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945338
90: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945370
91: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39453a8
92: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39453e0
93: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945418
94: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945450
95: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff3945488
96: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff39454c0
97: MAXIMA::PSIMP, pc = 0x21dd0617, fp = 0x7ffff39454f8
98: MAXIMA::PALGSIMP, pc = 0x22166db7, fp = 0x7ffff3945530

最佳答案

绑定(bind)堆栈溢出的最常见原因是递归函数无限期地调用自身(即递归中的错误)。第二个最常见的原因是正确编程的递归函数,但 Lisp 实现无法处理它的次数太多。

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

无论哪种情况,您都可以通过以下方式尝试找出是哪个或哪些函数导致了问题

trace (mymaximafun1, mymaximafun2, ...);

对于 Maxima 函数和/或

:lisp (trace mylispfun1 mylispfun2 ...)

用于 Lisp 函数。

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

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

save ("mycheckpointfile.lisp", all);

请注意,save 需要很多选项,所以也许可以通过 查看文档?保存

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

关于linux - SBCL 错误 : "binding stack exhausted" when running Maxima on Linux machine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46637898/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com