nep框架搭建

This commit is contained in:
2025-12-08 17:48:03 +08:00
parent 0b6537a810
commit 5057d18e98
5 changed files with 232 additions and 48 deletions

53
config/machine.yaml Normal file
View File

@@ -0,0 +1,53 @@
# config/machine.yaml
# 当前使用的计算系统配置名
current_system: "interactive_gpu"
systems:
# --- 配置 1: 交互式 GPU 环境 (当前使用) ---
# 场景: 你已经用 srun/tmux 申请到了资源,直接运行命令即可
interactive_gpu:
type: "local" # local 表示直接运行 subprocess不提交 sbatch
# 路径配置
gpumdkit_root: "/cluster/home/koko125/tool/GPUMDkit"
tools:
# 1. GPUMD 配置
gpumd:
command: "gpumd"
# 运行前需要 source 的环境脚本
env_setup: ""
gpu_id: 0
# 2. NEP 配置 (同上)
nep:
command: "nep"
env_setup: ""
gpu_id: 0
# 3. VASP (GPU 版) 配置
vasp:
# 假设是 GPU 版本,可能不需要 mpirun 或者只需要少量核
command: "mpirun -np 1 vasp_std"
env_setup: ""
# 即使是 local 模式,有时也需要指定并行度
n_procs: 1
# --- 配置 2: VASP CPU 集群模式 (预留,未来使用) ---
# 场景: 需要生成 submit.slurm 并 sbatch 提交
slurm_cpu_cluster:
type: "slurm"
gpumdkit_root: "/cluster/home/koko125/tool/GPUMDkit"
tools:
vasp:
command: "mpirun -np 4 vasp_std"
env_setup: "module load vasp/6.3-cpu"
# Slurm 头部参数
slurm_header:
partition: "cpu_long"
ntasks_per_node: 64
time: "24:00:00"

View File

@@ -1,70 +1,46 @@
# config/param.yaml
# --- 1. 环境与路径配置 ---
env:
# 可执行文件绝对路径
vasp_std: "mpirun -np 1 /cluster/home/koko125/vasp/bin_gpu/vasp_std"
gpumd: "/cluster/home/koko125/tool/GPUMD/src/gpumd"
nep: "/cluster/home/koko125/tool/GPUMD/src/nep"
# GPUMDKit 脚本库根目录
gpumdkit_root: "/cluster/home/koko125/tool/GPUMDkit"
# 【修改点】HPC 作业提交配置 (用于填充 submit.slurm 模板)
# 这些变量会被自动替换到 .sh 脚本头部
# slurm_config:
# partition: "v100" # 队列分区名
# account: "def-user" # 账户名 (如果有)
# gpu_per_node: 1 # 每节点 GPU 数
# ntasks_per_node: 32 # 每节点 CPU 核数
# time_limit: "24:00:00" # 墙钟时间限制
# --- 2. 流程控制 ---
# 阶段代号定义 (对应 modules 下的 Python 文件)
# --- 1. 流程控制 ---
stages_def:
p: "preheat" # 00.md/preheat
m: "md" # 00.md/md
s: "select" # 01.select
d: "scf" # 02.scf
t: "train" # 03.train
pr: "predict" # 04.predict (新增:用于性质预测)
o: "output" # 05.output (始终默认执行:整理报告)
p: "preheat"
m: "md"
s: "select"
d: "scf"
t: "train"
pr: "predict"
o: "output"
# 自定义流程调度
# 注意:'o' (output) 不需要显式写在这里,代码逻辑会强制每轮最后执行它
schedule:
# 第1轮: 跑完训练,不做预测,看一眼结果
1: ["p", "m", "s", "d", "t"]
# 第2轮: 跑完训练,加入预测步骤 (计算电导/扩散等)
2: ["p", "m", "s", "d", "t", "pr"]
# 默认流程 (如果没有定义轮次)
# 默认流程
default_workflow: ["p", "m", "s", "d", "t", "pr"]
# --- 3. 容错与通知 ---
# 自定义调度
schedule:
1: ["p", "m", "s", "d", "t", "o"]
# --- 2. 容错与通知 ---
control:
max_retries: 3 # 任务失败自动重启次数
check_interval: 60 # 状态检查间隔 (秒)
max_retries: 3
check_interval: 60
notification:
enable_log: true
log_file: "./logs/sys_runtime.log"
enable_hook: true
hook_script: "python ./hooks/send_alert.py"
alert_events: ["fail", "finish"]
# --- 4. 模块参数 ---
# --- 3. 模块具体的物理/算法参数 ---
params:
preheat:
temp: 300
steps: 10000
# 这里不需要指定 gpumd 路径,只需要指定物理量
select:
target_min: 60
target_max: 120
init_threshold: 0.01
predict:
# 预测阶段需要的参数,比如计算电导率的温度范围
temperatures: [300, 400, 500]
script_path: "scripts/calc_conductivity.py" # 具体的计算脚本
scf:
# 比如指定用 machine.yaml 里的哪个 tool 配置
tool_key: "vasp"