Skip to content

Commit b274f4a

Browse files
committed
refactor script: enhance .profraw file detection to include MPI rank-specific files and ensure unique entries
1 parent 8dab636 commit b274f4a

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

scripts/generate_llvm_coverage.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,25 @@
1515

1616
def find_profile_files(build_dir):
1717
"""Find all .profraw files in the build directory."""
18-
profile_files = list(Path(build_dir).rglob("*.profraw"))
18+
# Look for both regular .profraw files and MPI rank-specific files
19+
profile_files = []
20+
21+
# Standard .profraw files
22+
profile_files.extend(list(Path(build_dir).rglob("*.profraw")))
23+
24+
# MPI rank-specific files (e.g., file.profraw_rank_0)
25+
profile_files.extend(list(Path(build_dir).rglob("*.profraw_rank_*")))
26+
27+
# Remove duplicates while preserving order
28+
seen = set()
29+
unique_files = []
30+
for f in profile_files:
31+
if f not in seen:
32+
seen.add(f)
33+
unique_files.append(f)
34+
35+
profile_files = unique_files
36+
1937
if not profile_files:
2038
print("No profile files found!", file=sys.stderr)
2139
print(f"Searched in: {Path(build_dir).absolute()}", file=sys.stderr)

0 commit comments

Comments
 (0)