Skip to content

Add OpenMP upstream sync + correctness CI test (bump 19.1.0 → 19.1.5)#2

Merged
coatless merged 20 commits into
mainfrom
feat/openmp-upstream-sync
Jun 23, 2026
Merged

Add OpenMP upstream sync + correctness CI test (bump 19.1.0 → 19.1.5)#2
coatless merged 20 commits into
mainfrom
feat/openmp-upstream-sync

Conversation

@coatless

@coatless coatless commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Two related additions for keeping the macOS OpenMP runtime correct and current.

1. Upstream sync mechanism

Keeps the pinned OpenMP versions in sync with https://mac.r-project.org/openmp/ and applies the first update it produces.

  • sync-openmp.sh — parses the upstream page and regenerates the pinned version + SHA1 table in install-openmp.sh (the clang case block and --help list) and README.md, between sentinel markers. SHA1s are computed by downloading the changed tarball (the page's value is only a cross-check), it fails closed on a bad fetch or empty parse, and --check reports drift without writing.
  • .github/workflows/check-upstream.yml — runs the sync weekly (and on demand) and opens a PR when upstream changes. It never auto-merges.
  • First update applied: OpenMP 19.1.0 → 19.1.5 for Apple clang 1700 (SHA1 5b44175bcbaa334b0c57391482e068ea185c95a2), across the case block, help text, and README.

2. OpenMP correctness CI test

Verifies the installed runtime actually runs in parallel and computes correct results — not just that the library is present.

  • test-openmp.sh — compiles and runs an OpenMP program in C and in a minimal R package (ompcheck, built with the documented PKG_CPPFLAGS='-Xclang -fopenmp' / PKG_LIBS='-lomp') against the installed runtime, asserting real multithreading and a deterministic parallel-reduction result (sum(1..1e6) == 500000500000). Distinct exit codes make failures unambiguous.
  • .github/workflows/test-openmp.yml — runs it on macos-14/macos-15, path-filtered to the runtime-affecting files (install-openmp.sh, test-openmp.sh, the workflow), plus workflow_dispatch.

Notes

  • Runtime behavior of install-openmp.sh is unchanged — it remains a static, pinned-table installer.
  • Pure bash/awk; the sync runs on Linux, the correctness test is macOS-only (skips elsewhere). The unsupported-version fallback in install-openmp.sh was simplified to point at --help instead of duplicating the version list.

coatless added 18 commits June 22, 2026 21:53
The sed split on '<tr' leaves the HTML preamble as the first chunk.
That preamble contains 'Apple clang 1700+' prose and a Release tarball
example, so it passed the Apple-clang filter and triggered a spurious
"clang 1700 has no SHA1; skipping" WARN on stderr.

Fix: tighten the case pattern from '*"Apple clang"*' to
'"<tr"*"Apple clang"*' so only genuine table-row chunks are considered;
the preamble (which starts with '<html>') is silently skipped.
- Add begin/end marker count check (grep -cF) in replace_block; errors
  and returns non-zero without touching the file if either marker is
  absent or appears more than once (fixes latent truncation bug).
- Capture original file mode portably (stat -f on macOS, stat -c on
  Linux) and chmod the mktemp before mv, so exec bits survive rewrites.
- Clean up temp file on awk failure to avoid leaking it.
- Restore 100755 on install-openmp.sh (was wrongly stripped to 100644).
- Add regression test in tests/test-edit.sh: replace_block must return
  non-zero and leave file unchanged when END marker is missing.
@coatless coatless changed the title Add upstream sync mechanism and bump OpenMP 19.1.0 → 19.1.5 Add OpenMP upstream sync + correctness CI test (bump 19.1.0 → 19.1.5) Jun 23, 2026
@coatless coatless merged commit 7b52263 into main Jun 23, 2026
2 checks passed
@coatless coatless deleted the feat/openmp-upstream-sync branch June 23, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant