Ray 这条线不绕 bazel: - wheel 里的 ray/_raylet.so 就是编好的 C++ core(34113 个导出符号, 3638 个 ray:: 符号 default 可见,含 CoreWorkerProcess::Initialize) - ray/nax_ray_shim.cc:259 行 C ABI shim,复用 process_helper 的初始化路径 - 实测跑通:Rust 二进制作为 driver 接入真实 GCS+raylet, 拿到 raylet 分配的 node_id(d190801c…),probe 通过 踩坑(都已固化进 ray/build.sh): - raylet 只编了 Python worker pool → 注册时语言声明 PYTHON - Ray C++ 是旧 ABI → -D_GLIBCXX_USE_CXX11_ABI=0 - fmt v9/v11 撞车 → FMT_HEADER_ONLY - Debian absl 固定自家 optional → 影子头直通 std::optional - _raylet.so 是 CPython 扩展(253 个 Py 符号)→ build.rs 自动链 libpython - GcsNodeInfo 手写 wire format 解析,避免 protobuf 跨 ABI armv7 交叉编译修正(原结论有误): - 换 armv7-unknown-linux-musleabihf + rust-lld/link-self-contained - 不再需要外部交叉 gcc,macOS 本机 83 秒出 687 KB 静态二进制 - .cargo/config.toml 固化,无需 export 任何变量 其他:nax-orch 告警清理;README/ZYNQ 文档对齐实测。
12 lines
473 B
Python
12 lines
473 B
Python
import ctypes, sys
|
|
lib = ctypes.CDLL(sys.argv[1] if len(sys.argv) > 1 else "/tmp/libnax_ray.so")
|
|
buf = ctypes.create_string_buffer(8192)
|
|
rc = lib.nax_ray_init(b"169.254.68.6", 6379, b"169.254.68.6", buf, 8192)
|
|
print("init rc =", rc)
|
|
if rc != 0:
|
|
print("err:", lib.nax_ray_last_error().decode())
|
|
else:
|
|
print(buf.value.decode())
|
|
rc2 = lib.nax_ray_probe(buf, 8192)
|
|
print("probe rc =", rc2, buf.value.decode() if rc2 == 0 else lib.nax_ray_last_error().decode())
|