Skip to content

MNT speed-up html-noplot build #26245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
- OPENBLAS_NUM_THREADS: 2
- CONDA_ENV_NAME: testenv
- LOCK_FILE: build_tools/circle/doc_min_dependencies_linux-64_conda.lock
# Sphinx race condition in doc-min-dependencies is causing job to stall
# Here we run the job serially
- SPHINX_NUMJOBS: 1
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
Expand Down Expand Up @@ -61,8 +58,6 @@ jobs:
- OPENBLAS_NUM_THREADS: 2
- CONDA_ENV_NAME: testenv
- LOCK_FILE: build_tools/circle/doc_linux-64_conda.lock
# Disable sphinx parallelism to avoid EOFError or job stalling in CircleCI
- SPHINX_NUMJOBS: 1
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
Expand Down
29 changes: 23 additions & 6 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@ SPHINXBUILD ?= sphinx-build
PAPER =
BUILDDIR = _build

# Run sequential by default, unless SPHINX_NUMJOBS is set.
SPHINX_NUMJOBS ?= 1

ifneq ($(EXAMPLES_PATTERN),)
EXAMPLES_PATTERN_OPTS := -D sphinx_gallery_conf.filename_pattern="$(EXAMPLES_PATTERN)"
endif

ifeq ($(CI), true)
# On CircleCI using -j2 does not seem to speed up the html-noplot build
SPHINX_NUMJOBS_NOPLOT_DEFAULT=1
else ($(shell uname), Darwin)
# Avoid stalling issues on MacOS
SPHINX_NUMJOBS_NOPLOT_DEFAULT=1
else
SPHINX_NUMJOBS_NOPLOT_DEFAULT=auto
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -T -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)\
-j$(SPHINX_NUMJOBS) $(EXAMPLES_PATTERN_OPTS) .
$(EXAMPLES_PATTERN_OPTS) .


.PHONY: help clean html dirhtml ziphtml pickle json latex latexpdf changes linkcheck doctest optipng
Expand All @@ -44,17 +51,27 @@ clean:
-rm -rf generated/*
-rm -rf modules/generated/

# Default to SPHINX_NUMJOBS=1 for full documentation build. Using
# SPHINX_NUMJOBS!=1 may actually slow down the build, or cause weird issues in
# the CI (job stalling or EOFError), see
# https://github.com/scikit-learn/scikit-learn/pull/25836 or
# https://github.com/scikit-learn/scikit-learn/pull/25809
html: SPHINX_NUMJOBS ?= 1
html:
# These two lines make the build a bit more lengthy, and the
# the embedding of images more robust
rm -rf $(BUILDDIR)/html/_images
#rm -rf _build/doctrees/
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html/stable
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) -j$(SPHINX_NUMJOBS) $(BUILDDIR)/html/stable
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/stable"

# Default to SPHINX_NUMJOBS=auto (except on MacOS and CI) since this makes
# html-noplot build faster
html-noplot: SPHINX_NUMJOBS ?= $(SPHINX_NUMJOBS_NOPLOT_DEFAULT)
html-noplot:
$(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html/stable
$(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) -j$(SPHINX_NUMJOBS) \
$(BUILDDIR)/html/stable
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/stable."

Expand Down