refactor: 引擎只走 DLL 路径,release 目录清理 exe
- dynamics.py: 去掉 exe 子进程回退,只走 DLL 路径 - .gitignore: 白名单 engines/release/dynamics_*.dll - engines/release/: 移除 dynamics_*.exe,新增 3 个引擎 DLL
This commit is contained in:
@@ -44,6 +44,9 @@ build_*/
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# 但 engines/release/ 中的引擎 DLL 需要跟踪(用户运行必备)
|
||||
!engines/release/dynamics_*.dll
|
||||
|
||||
# 可执行文件(保留源码,排除编译出的二进制)
|
||||
# 注意:Windows 下 .exe 后缀的可执行文件
|
||||
*.exe
|
||||
|
||||
+7
-17
@@ -248,23 +248,13 @@ def run_case(config_path, runtime_base, input_dir="input", output_dir="output",
|
||||
input_dir_abs = str(input_dir_path.resolve())
|
||||
output_dir_abs = str(output_dir_path.resolve())
|
||||
|
||||
# ── 优先尝试 DLL 路径(无文件 I/O,直接输出 display.npz)──
|
||||
_dll_used = False
|
||||
try:
|
||||
from engines.engine_dll import is_dll_available
|
||||
if is_dll_available(engine):
|
||||
compute.run_engine_dll(engine, output_dir_abs, config)
|
||||
_dll_used = True
|
||||
print(f"[run] DLL 路径成功")
|
||||
except Exception as _dll_err:
|
||||
print(f"[run] DLL 路径不可用 ({_dll_err}),回退到子进程模式")
|
||||
|
||||
if not _dll_used:
|
||||
# 回退:子进程模式(读写 display.txt / trajectory.txt)
|
||||
traj_x, traj_y, traj_z, traj_vx, traj_vy, traj_vz = compute.run_engine(
|
||||
engine, input_dir_abs, output_dir_abs, config)
|
||||
if int(config.get("save_trajectory", 0)):
|
||||
compute.save_trajectory_txt(traj_x, traj_y, traj_z, traj_vx, traj_vy, traj_vz, str(runtime_base))
|
||||
# ── DLL 路径(无文件 I/O,直接输出 display.npz)──
|
||||
from engines.engine_dll import is_dll_available
|
||||
if not is_dll_available(engine):
|
||||
raise FileNotFoundError(
|
||||
f"DLL 未找到(引擎 {engine})。"
|
||||
f"请先编译:cd engines/{engine} && make dll")
|
||||
compute.run_engine_dll(engine, output_dir_abs, config)
|
||||
|
||||
_elapsed = _time.time() - _t0
|
||||
print(f"[run] 引擎: {engine} 计算完成: {record_steps} 步 {_elapsed:.3f} s")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user