Skip to content

docs: parallelize man page generation with make -j#10775

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:man-pages-parallel-gen
Jun 29, 2026
Merged

docs: parallelize man page generation with make -j#10775
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:man-pages-parallel-gen

Conversation

@maliberty

Copy link
Copy Markdown
Member

Summary

The man_pages Bazel action invoked make bazel-manpages serially, running ~10,000 pandoc/nroff invocations one at a time. On a 64-core host this took ~177s and was the long pole of //:install.

Split the single make call into two phases:

  1. preprocess (serial) — generates the md/man*/*.md sources.
  2. cat web (parallel, -j$(nproc)) — the pandoc/nroff fan-out over ~3,351 pages.

They cannot share one -j invocation: cat/web read the md files preprocess produces, and a parallel build has no dependency edge forcing preprocess to finish first. Running cat web as a second invocation also re-parses the Makefile so its $(wildcard md/man*/*.md) picks up the freshly generated sources.

Results

Regenerating the full doc set (3113 man3 + 237 man2 + 1 man1, cat + html) from a cold action cache:

Critical path
Before (serial) 176.75 s
After (-j64) 5.78 s

~30× faster. Output set is byte-for-byte identical in page counts (cat3=3113, html3=3113, cat2=237, cat1=1).

@maliberty maliberty self-assigned this Jun 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates bazel/man_pages.bzl to split the man page generation into a serial preprocessing phase and a parallelized phase. The feedback correctly identifies that using nproc directly will cause build failures on macOS and suggests a robust fallback using sysctl.

Comment thread bazel/man_pages.bzl Outdated
@maliberty

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8be0cfdb4d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bazel/man_pages.bzl Outdated
The man_pages Bazel action invoked 'make bazel-manpages' serially, running
~10,000 pandoc/nroff invocations one at a time (~177s on a 64-core host).

Split the single make call into two phases: 'preprocess' (serial) generates
the md/man*/*.md sources, then 'cat web' fan out pandoc/nroff in parallel with
-j. They cannot share one -j invocation because cat/web read the md files that
preprocess produces and there is no dependency edge forcing preprocess first.
Running 'cat web' as a second invocation also re-parses the Makefile so its
$(wildcard md/man*/*.md) picks up the freshly generated sources.

Job count uses nproc with a sysctl fallback (then 4) so the action also works
on macOS, where nproc is not available by default.

A resource_set reserves the host CPUs for this action so the parallel make
does not oversubscribe other concurrently scheduled Bazel actions; Bazel
clamps the request to the cores actually available.

Regenerating the full doc set drops from ~177s to ~6s (~30x).

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@openroad-ci openroad-ci force-pushed the man-pages-parallel-gen branch from 8be0cfd to 2644a56 Compare June 28, 2026 22:14
@maliberty maliberty marked this pull request as ready for review June 29, 2026 00:41
@maliberty maliberty requested a review from a team as a code owner June 29, 2026 00:41
@maliberty maliberty requested a review from osamahammad21 June 29, 2026 00:41
@maliberty maliberty merged commit 5fcc1e8 into The-OpenROAD-Project:master Jun 29, 2026
16 of 17 checks passed
@maliberty maliberty deleted the man-pages-parallel-gen branch June 29, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant