Release FemLite 0.5.3
FemLite CI / build-test (push) Has been cancelled

This commit is contained in:
shenw committed 2026-07-01 18:39:18 +08:00
1 parent 75d4e735b1
commit 2b7962eb96
51 files changed
+3084 -2175

No files matched your search

+84 -17
View File
@@ -10,22 +10,44 @@ import sys
from pathlib import Path
METRICS = (
INT_METRICS = (
"path_steps",
"path_active",
"path_activated",
"path_released",
"path_bvh_nodes",
"path_cache_used",
"path_cache_over",
"active_count",
"state_open",
"state_activated",
"state_maintained",
"state_released",
"activation_count",
"release_count",
"search_facets",
"search_masters",
"search_broad",
"search_active",
"bvh_nodes",
"cache_used",
"cache_overflow",
)
FLOAT_METRICS = (
"path_force_sum",
"path_tan_mat_sum",
"path_tan_f_sum",
"path_gap_sum",
"path_slip_sum",
"force_sum",
"tan_force_sum",
"gap_sum",
"slip_sum",
)
def run_case(source_root: Path, executable: Path, threads: int) -> dict[str, int]:
def run_case(source_root: Path, executable: Path, threads: int) -> dict[str, float]:
env = os.environ.copy()
env["OMP_NUM_THREADS"] = str(threads)
proc = subprocess.run(
@@ -46,14 +68,23 @@ def run_case(source_root: Path, executable: Path, threads: int) -> dict[str, int
return parse_metrics(proc.stdout, threads)
def parse_metrics(output: str, threads: int) -> dict[str, int]:
values: dict[str, int] = {}
def parse_metrics(output: str, threads: int) -> dict[str, float]:
values: dict[str, float] = {}
for line in output.splitlines():
match = re.match(r"\s*([A-Za-z_]+):\s+([-+]?\d+)\s*$", line)
if match and match.group(1) in METRICS:
values[match.group(1)] = int(match.group(2))
match = re.match(
r"\s*([A-Za-z_]+):\s+([-+]?\d+(?:\.\d*)?(?:[Ee][-+]?\d+)?)\s*$",
line,
)
if not match:
continue
name = match.group(1)
if name in INT_METRICS:
values[name] = int(float(match.group(2)))
elif name in FLOAT_METRICS:
values[name] = float(match.group(2))
missing = [metric for metric in METRICS if metric not in values]
expected = INT_METRICS + FLOAT_METRICS
missing = [metric for metric in expected if metric not in values]
if missing:
print(output, end="")
raise SystemExit(
@@ -74,9 +105,26 @@ def parse_metrics(output: str, threads: int) -> dict[str, int]:
)
if values["cache_used"] <= 0:
raise SystemExit(f"no BVH cache use for OMP_NUM_THREADS={threads}")
if values["cache_overflow"] != 0 or values["path_cache_over"] != 0:
raise SystemExit(f"unexpected cache overflow for OMP_NUM_THREADS={threads}")
if values["path_force_sum"] <= 0.0 or values["force_sum"] <= 0.0:
raise SystemExit(f"missing force checksum for OMP_NUM_THREADS={threads}")
if values["path_tan_mat_sum"] <= 0.0:
raise SystemExit(f"missing tangent checksum for OMP_NUM_THREADS={threads}")
if values["path_gap_sum"] <= 0.0 or values["gap_sum"] <= 0.0:
raise SystemExit(f"missing gap checksum for OMP_NUM_THREADS={threads}")
if values["state_maintained"] <= 0:
raise SystemExit(f"missing maintained state for OMP_NUM_THREADS={threads}")
if values["activation_count"] <= 0:
raise SystemExit(f"missing activation count for OMP_NUM_THREADS={threads}")
return values
def close_enough(left: float, right: float) -> bool:
scale = max(1.0, abs(left), abs(right))
return abs(left - right) <= 1.0e-9 * scale
def main(argv: list[str]) -> int:
if len(argv) != 3:
print(
@@ -87,26 +135,45 @@ def main(argv: list[str]) -> int:
source_root = Path(argv[1]).resolve()
executable = Path(argv[2]).resolve()
serial = run_case(source_root, executable, 1)
parallel = run_case(source_root, executable, 4)
cases = {
threads: run_case(source_root, executable, threads)
for threads in (1, 2, 4)
}
serial = cases[1]
mismatches = [
metric
for metric in METRICS
if serial[metric] != parallel[metric]
(threads, metric)
for threads, values in cases.items()
if threads != 1
for metric in INT_METRICS
if serial[metric] != values[metric]
]
if mismatches:
float_mismatches = [
(threads, metric)
for threads, values in cases.items()
if threads != 1
for metric in FLOAT_METRICS
if not close_enough(serial[metric], values[metric])
]
if mismatches or float_mismatches:
print("OpenMP contact performance statistics differ:")
for metric in mismatches:
for threads, metric in mismatches:
print(
f" {metric}: OMP=1 {serial[metric]}, "
f"OMP=4 {parallel[metric]}"
f"OMP={threads} {cases[threads][metric]}"
)
for threads, metric in float_mismatches:
print(
f" {metric}: OMP=1 {serial[metric]:.12e}, "
f"OMP={threads} {cases[threads][metric]:.12e}"
)
return 1
print("perf_contact_pair path OpenMP consistency: PASS")
for metric in METRICS:
for metric in INT_METRICS:
print(f" {metric}: {serial[metric]}")
for metric in FLOAT_METRICS:
print(f" {metric}: {serial[metric]:.12e}")
return 0
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.