ci / gate (push) Waiting to run
- 项目与文档标题:nax-rs → ssw-mpc(尚数网-多方安全计算),二进制 nax → mpc - 18 个 crate 及目录 nax-* → mpc-*,Rust 引用 nax_* → mpc_* - 环境变量、C 符号、构建/部署脚本:NAX_* → MPC_*、libnax_ray.so → libmpc_ray.so - 保留协议域分隔常量与 refs/nax 参考实现路径,维持 golden 向量与历史数据兼容 - 新增 [profile.dev] incremental=false
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
import ctypes, sys
|
|
|
|
|
|
class Cfg(ctypes.Structure):
|
|
_fields_ = [
|
|
("gcs_addr", ctypes.c_char_p),
|
|
("node_ip", ctypes.c_char_p),
|
|
("raylet_socket", ctypes.c_char_p),
|
|
("plasma_socket", ctypes.c_char_p),
|
|
("node_manager_port", ctypes.c_int),
|
|
("job_id_int", ctypes.c_int),
|
|
("language", ctypes.c_int),
|
|
("driver_name", ctypes.c_char_p),
|
|
]
|
|
|
|
|
|
lib = ctypes.CDLL(sys.argv[1] if len(sys.argv) > 1 else "/tmp/libmpc_ray.so")
|
|
lib.mpc_ray_last_error.restype = ctypes.c_char_p
|
|
|
|
gcs = sys.argv[2] if len(sys.argv) > 2 else "127.0.0.1:6402"
|
|
rsock = sys.argv[3] if len(sys.argv) > 3 else "/tmp/raylet_x.sock"
|
|
psock = sys.argv[4] if len(sys.argv) > 4 else "/tmp/plasma_x.sock"
|
|
port = int(sys.argv[5]) if len(sys.argv) > 5 else 6403
|
|
lang = int(sys.argv[6]) if len(sys.argv) > 6 else 2 # 2 = CPP
|
|
|
|
cfg = Cfg(gcs.encode(), b"127.0.0.1", rsock.encode(), psock.encode(), port, 1, lang, b"mpc_driver")
|
|
buf = ctypes.create_string_buffer(16384)
|
|
|
|
print(f"--- init gcs={gcs} raylet={rsock} port={port} lang={lang}")
|
|
rc = lib.mpc_ray_init(ctypes.byref(cfg), buf, 16384)
|
|
print("init rc =", rc)
|
|
if rc != 0:
|
|
print("err:", lib.mpc_ray_last_error().decode())
|
|
sys.exit(1)
|
|
print(buf.value.decode())
|
|
|
|
import time
|
|
hold = int(sys.argv[7]) if len(sys.argv) > 7 else 0
|
|
rc2 = lib.mpc_ray_probe(buf, 16384)
|
|
print("probe rc =", rc2, buf.value.decode() if rc2 == 0 else lib.mpc_ray_last_error().decode())
|
|
if hold:
|
|
print(f"holding {hold}s ...", flush=True)
|
|
time.sleep(hold)
|
|
lib.mpc_ray_shutdown()
|
|
print("shutdown done")
|