008_mpi_exchange Tests
速览
本页是 tests/008_mpi_exchange 的目录入口,用一个固定的 4-rank 小算例快速回归
H_MPI_Exchange 的三条核心通信语义:
H01 的场量 halo 覆盖、H02 的粒子跨 rank 迁移,以及 H03 的 scatter 后边界密度累加。
它偏向“先跑一遍确认没回归”,不是完整正确性证明,也不是 MPI 压力测试。
主题 |
固定设置 |
说明 |
|---|---|---|
目录角色 |
|
目录级运行命令、输出文件和结果判读集中放在这里。 |
固定拓扑 |
|
x/y 有真实 MPI 邻居;z 不拆分,只测本地周期处理。 |
核心文件 |
|
Fortran driver 负责断言,shell 负责运行,Python 负责诊断图。 |
通过判据 |
|
|
继续阅读 |
testing guide / |
手工期望值和编号粒子剧本看
MPI Exchange Testing Guide;
本地脚本入口和清理方式看 |
覆盖与边界
模块 |
当前 case |
当前断言 |
仍未覆盖 |
|---|---|---|---|
每个 rank 一个 |
|
|
|
2 个 species、固定编号粒子集、全局盒子 |
最终粒子数、ID 归属、吸收删除和 z 周期回绕。 |
大粒子量压力、 |
|
每个 rank 一个 |
|
边界整面穷举、 |
运行
运行前建议先确认 which mpif90、which mpiexec 和
python3 -c "import matplotlib"。默认使用
FC=mpif90、MPIEXEC=mpiexec、MPI_NP_FLAG=-n、NP=4,
构建带 -fdefault-real-8;这是因为 H01/H03 当前以默认 real 数组配合
MPI_DOUBLE 通信。若启动器还需要额外参数,可通过 MPIEXEC_ARGS 透传。
Windows/PowerShell 环境可改用 run.ps1。
cd tests/008_mpi_exchange
bash run.sh
bash make.sh
BUILD=0 bash run.sh
PLOT=0 bash run.sh
FC=mpifort MPIEXEC=mpirun MPI_NP_FLAG=-np NP=4 bash run.sh
输出与判读
文件 |
字段 / 内容 |
用途 |
|---|---|---|
|
|
H01/H03 的代表样本点,不是全部断言的完整转储。 |
|
|
交换后的本地粒子列表; |
|
样本 |
快速看 H01/H03 样本是否贴合。 |
|
粒子最终归属散点图 |
人工核对 face/edge/corner 迁移是否符合预期。 |
先看标准输出里是否出现
PASS: H_MPI_Exchange small MPI regression suite.。如果失败,Fortran 会打印
rank、断言标签和actual/expected差异。H03 需要特别注意:当前
h03_density_faces.dat和配套图片来自第二轮 “带 z 周期折叠”的样本状态,不是第一轮非周期x/y断言的完整导出。某些编译器或 MPI 启动器会额外打印
STOP 0;若 PASS 已出现,不必把它当成失败信号。当前参考运行中,
h01_field_faces.dat和h03_density_faces.dat的abs_error应为0,H02 粒子归属应与 testing guide 给出的最终 ID 集合一致。
拓扑与代表图
(1,2,1)
rank 3(2,2,1)
rank 0(1,1,1)
rank 1(2,1,1)
H01 |
halo 样本与邻居面 |
H02 |
粒子最终归属和 face/edge/corner 迁移结果。 |
H03 |
边界累加与 z 周期折叠后的代表样本状态。 |
Overview
This page is the directory entry for tests/008_mpi_exchange. It uses one
fixed 4-rank case to quickly regress three core
H_MPI_Exchange semantics: H01 field-halo
overwrite, H02 particle migration across ranks, and H03 post-scatter density
boundary accumulation. It is meant to answer “did the small MPI regression
break?” rather than provide a full correctness proof or an MPI stress test.
Topic |
Fixed setup |
Meaning |
|---|---|---|
Page role |
|
Directory-level run commands, output files, and result interpretation are collected here. |
Fixed topology |
|
x/y have real MPI neighbors; z stays unsplit and only exercises local periodic handling. |
Core files |
|
The Fortran driver asserts behavior, shell scripts run the case, and Python writes diagnostic figures. |
Pass criterion |
|
|
Read next |
testing guide / |
Use the
MPI Exchange Testing Guide
for hand-derived expectations and the ID-labeled particle script, and
|
Coverage And Limits
Module |
Current case |
Current assertions |
Still not covered |
|---|---|---|---|
One |
|
z-direction MPI halos with |
|
Two species, a fixed ID-labeled particle set, and a global
|
Final particle counts, ID ownership, absorbing removal, and local z-periodic wrap. |
Large-particle pressure, the |
|
One |
|
Full-face proofs and z-direction MPI accumulation with
|
Running
Before running, it is useful to confirm which mpif90,
which mpiexec, and python3 -c "import matplotlib". The defaults are
FC=mpif90, MPIEXEC=mpiexec, MPI_NP_FLAG=-n, and NP=4. The
build keeps -fdefault-real-8 because H01/H03 currently exchange default
real arrays with MPI_DOUBLE. Extra launcher options can be passed via
MPIEXEC_ARGS. On Windows/PowerShell, use run.ps1 instead.
cd tests/008_mpi_exchange
bash run.sh
bash make.sh
BUILD=0 bash run.sh
PLOT=0 bash run.sh
FC=mpifort MPIEXEC=mpirun MPI_NP_FLAG=-np NP=4 bash run.sh
Outputs And Reading Them
File |
Fields / content |
Use |
|---|---|---|
|
|
Representative H01/H03 sample points, not a dump of every assertion. |
|
|
Post-exchange local particle list; |
|
Sample |
Fast visual check for H01/H03 sample agreement. |
|
Final particle-ownership scatter plot |
Manual check of face/edge/corner migration. |
Start by checking whether stdout contains
PASS: H_MPI_Exchange small MPI regression suite..On failure, the Fortran test prints the failing
rank, assertion label, andactual/expecteddifference.H03 needs one extra note: the current
h03_density_faces.datand its figure come from the second pass with z-periodic folding enabled, not from the full first-pass nonperiodicx/yassertion set.Some compilers or MPI launchers may also print
STOP 0; if the PASS line is present, do not treat that as a failure marker.In the current reference run,
abs_errorin bothh01_field_faces.datandh03_density_faces.datshould be0, and H02 particle ownership should match the final ID sets listed in the testing guide.
Topology And Representative Figures
(1,2,1)
rank 3(2,2,1)
rank 0(1,1,1)
rank 1(2,1,1)
H01 |
Halo samples against neighbor-face |
H02 |
Final particle ownership and face/edge/corner migration. |
H03 |
Boundary accumulation plus z-periodic folding samples. |