news 2026/5/28 16:12:23

对在aarch64 Linux环境编译安装的CinderX补充测试

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
对在aarch64 Linux环境编译安装的CinderX补充测试

前文最后说,CinderX报错不能用,这不对,我在其github存储库上提了这个issue,alexmalyshev回复

I think that’s actually just a warning that you’re getting but things should be working after that?Right, this is just a logged warning that CinderX tried to enable huge pages but wasn’t able to. It falls back to using normal pages.
(我认为那实际上只是一个警告,在那之后一切应该仍能正常运行?是的,这只是一个记录在案的警告,表示 CinderX 尝试启用大页但未能成功,因此它会回退到使用普通页面。)

下面是测试结果

nbs@kylin-pc:~/par$ sudo docker start gcc142 输入密码 gcc142 nbs@kylin-pc:~/par$ sudo docker exec -it gcc142 bash root@kylin-pc:/# cd /par/uv314 root@kylin-pc:/par/uv314# source .venv/bin/activate cinderx.jit.compile_after_n_calls(1) (uv314) root@kylin-pc:/par/uv314# time python ../pe932e.py JIT: /par/cinderx-2026.3.30.0/cinderx/Jit/code_allocator.cpp:62 -- Failed to madvise [0x7fa1ffc000, 0x7fa21fc000) with MADV_HUGEPAGE, errno=22 T(16) = 72673459417881349.time=18.62825632095337 T(16) = 72673459417881349.time=9.188195705413818 real 0m27.987s user 0m27.694s sys 0m0.047s -- cinderx.jit.compile_after_n_calls(0) (uv314) root@kylin-pc:/par/uv314# time python ../pe932e.py JIT: /par/cinderx-2026.3.30.0/cinderx/Jit/code_allocator.cpp:62 -- Failed to madvise [0x7fa0cdc000, 0x7fa0edc000) with MADV_HUGEPAGE, errno=22 T(16) = 72673459417881349.time=11.874915599822998 T(16) = 72673459417881349.time=12.66346549987793 real 0m24.587s user 0m24.465s sys 0m0.012s

可见不管是cinderx.jit.compile_after_n_calls(1)还是cinderx.jit.compile_after_n_calls(0),JIT后都比原始版本提速了。关于这个问题,我也发issue提问了。alexmalyshev回复

There could be a number of reasons for this, but most likely it’s because letting functions run through the interpreter once allows the CPython adaptive interpreter to emit specialized opcodes (e.g. BINARY_OP_ADD_INT instead of BINARY_OP) and CinderX can make use of that to generate faster code. Feel free to run with PYTHONJITDUMPFINALHIR=1 in your environment to compare CinderX’s internal representation for each function between the two runs.
In general we don’t recommend compile_after_n_calls(0) for general usage as it’s not meant to be performant. It’s primarily helpful to test CinderX compatibility for your code.
(出现这种情况可能有多种原因,但最有可能的是:让函数通过解释器运行一次,能使 CPython 的自适应解释器发出特化的操作码(例如BINARY_OP_ADD_INT而非BINARY_OP),而 CinderX 可以利用这一点来生成更快的代码。你可以在环境中设置PYTHONJITDUMPFINALHIR=1来比较两次运行之间 CinderX 对每个函数的内部表示差异。
一般来说,我们不建议在日常使用中设置compile_after_n_calls(0),因为这样做的目的并不是为了追求性能。它主要用于帮助你测试代码与 CinderX 的兼容性。)

我也用他建议的PYTHONJITDUMPFINALHIR=1参数测试了,确实两者输出的内部表示差别很大。compile_after_n_calls(0)的输出非常冗长,不像认真优化过的。

还有两个方法:cinderx.jit.force_compile(fun)cinderx.jit.lazy_compile(fun), 分别是立即编译和延迟编译,它们俩的效果没太大区别,都和compile_after_n_calls(1)的加速比一致。

(uv314) root@kylin-pc:/par/uv314# time python ../pe932d.py N=2499500025000000, a=24995000, b=25000000, k=8, s=49995000 T(16) = 72673459417881349,time=14.928523063659668 real 0m14.948s user 0m14.871s sys 0m0.004s (uv314) root@kylin-pc:/par/uv314# (uv314) root@kylin-pc:/par/uv314# time python ../pe932e.py JIT: /par/cinderx-2026.3.30.0/cinderx/Jit/code_allocator.cpp:62 -- Failed to madvise [0x7fbbb7c000, 0x7fbbd7c000) with MADV_HUGEPAGE, errno=22 T(16) = 72673459417881349.time=14.70127558708191 cinderx.jit.force_compile(solve_T16) T(16) = 72673459417881349.time=8.867673873901367 real 0m23.639s user 0m23.529s sys 0m0.012s (uv314) root@kylin-pc:/par/uv314# time python ../pe932e.py JIT: /par/cinderx-2026.3.30.0/cinderx/Jit/code_allocator.cpp:62 -- Failed to madvise [0x7fa909c000, 0x7fa929c000) with MADV_HUGEPAGE, errno=22 T(16) = 72673459417881349.time=14.878132820129395 cinderx.jit.lazy_compile(solve_T16) T(16) = 72673459417881349.time=9.286654710769653 real 0m24.211s user 0m24.080s sys 0m0.024s
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/28 16:12:22

vscode使用

配置文件**情景:**当我们既需要使用vue代码开发,又需要使用react代码开发,还需要使用python开发,这个时候我们需要下载很多插件,设置很多不同的代码片段,开发环境会显得很乱,还可能有些插件冲突…

作者头像 李华
网站建设 2026/5/23 1:58:17

ADS RFPro实战:800MHz微带滤波器场分布可视化,教你定位耦合热点

ADS RFPro实战:800MHz微带滤波器场分布可视化与耦合热点定位 在射频电路设计中,微带线滤波器的性能优化往往像一场精密的外科手术——我们需要准确找到"病灶"位置才能实施有效治疗。当工作频率达到800MHz时,那些肉眼无法观察到的电…

作者头像 李华
网站建设 2026/5/23 1:58:26

Tmux实战:5个高效会话管理技巧让你告别终端焦虑

Tmux实战:5个高效会话管理技巧让你告别终端焦虑 每次看到满屏的终端窗口,是不是感觉血压都升高了?作为一名常年与服务器打交道的开发者,我曾经也深陷终端窗口管理的泥潭——SSH断开后工作进度丢失、多个项目窗口混杂难辨、复杂任务…

作者头像 李华
网站建设 2026/5/23 1:58:59

07-EMC滤波器件选型(多孔珠、磁环、复合滤波器件)

1.多孔珠俗称猪鼻子,具有很好的高频特性,在高频阻抗很高(上百MHz),一般适用于电源端口以及一些工作频率小于5MHz的信号电路,大于5MHz的工作电路高频阻抗较大,信号衰减大,需谨慎。&am…

作者头像 李华
网站建设 2026/5/23 1:58:19

ai辅助开发新体验:在快马平台中智能调优llmfit微调流程

最近在尝试用AI辅助开发优化LLMFit微调流程时,发现InsCode(快马)平台的智能功能特别适合这种需要反复调试的场景。整个过程就像有个懂行的搭档在旁边实时指导,我把这次实践的关键点整理成了几个环节: 数据集分析与参数推荐 平台内置的AI助手能…

作者头像 李华
网站建设 2026/5/23 1:58:26

Ubuntu22.04安装SSH保姆级教程:从配置到远程连接一步到位

Ubuntu 22.04 终极SSH配置指南:安全高效的远程管理方案 刚接触Ubuntu的新手往往对命令行操作感到陌生,而远程管理又是系统运维的刚需。本文将彻底解决这个痛点——从零开始构建一套既安全又高效的SSH远程管理方案。不同于基础教程只教安装步骤&#xff0…

作者头像 李华