Skip to content
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

docs: some cleanup and improvements #33395

Merged
merged 3 commits into from
Mar 29, 2021

Conversation

gmarull
Copy link
Member

@gmarull gmarull commented Mar 16, 2021

Summary:

  • Current Makefile is just a thin wrapper around the CMake based documentation build. Removing this Makefile makes things more consistent as CMake is used everywhere in Zephyr as of today.
  • Sphinx supports parallelized build (-j) option. Setting it to auto makes use of all available cores. This option seems to speed up the build on multi-core machines, even though not much when Kconfig is enabled.

Quick comparison on -j auto usage (cpu count=12):

KCONFIG_TURBO_MODE=0

  • SPHINXOPTS=: ninja -C doc/_build htmldocs 650.51s user 8.50s system 100% cpu 10:55.39 total
  • SPHINXOPTS=-j auto: ninja -C doc/_build htmldocs 2094.90s user 62.44s system 368% cpu 9:46.23 total

KCONFIG_TURBO_MODE=1:

  • SPHINXOPTS=: ninja -C doc/_build htmldocs 303.29s user 4.48s system 101% cpu 5:04.46 total
  • SPHINXOPTS=-j auto: ninja -C doc/_build htmldocs 1060.54s user 21.20s system 555% cpu 3:14.64 total

checkpatch requires a Makefile to be present at the top-level directory.
Remove this requirement.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
@gmarull gmarull force-pushed the feature/docs-cleanup-1 branch from 62cc890 to 4c27a3f Compare March 17, 2021 16:01
@@ -59,7 +59,7 @@ if(${LATEXMK} STREQUAL LATEXMK-NOTFOUND)
endif()

if(NOT DEFINED SPHINXOPTS)
set(SPHINXOPTS -q)
set(SPHINXOPTS -q -j auto)
Copy link
Member

Choose a reason for hiding this comment

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

👍🏻

@gmarull gmarull force-pushed the feature/docs-cleanup-1 branch from 4c27a3f to bc7cd60 Compare March 17, 2021 16:30
@gmarull gmarull requested a review from carlescufi March 17, 2021 16:31
Copy link
Member

@carlescufi carlescufi left a comment

Choose a reason for hiding this comment

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

LGTM, glad to see that Makefile go and -j auto by default.

@gmarull gmarull added the dev-review To be discussed in dev-review meeting label Mar 17, 2021
@carlescufi
Copy link
Member

@nashif can you take a look?

Copy link
Member

@nashif nashif left a comment

Choose a reason for hiding this comment

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

how is having to type:

cmake -GNinja -S doc -Bdoc/_build
ninja -C doc/_build htmldocs

instead of just

make

an improvement?

@gmarull
Copy link
Member Author

gmarull commented Mar 18, 2021

how is having to type:

cmake -GNinja -S doc -Bdoc/_build
ninja -C doc/_build htmldocs

instead of just

make

in order to rebuild docs one can just do ninja htmldocs everytime when inside the build dir. Actually it's not just make, it's source zephyr-env.sh and make htmldocs...

an improvement?

the question here is: why do we want to maintain a top-level Makefile to build the documentation?

@gmarull gmarull requested a review from nashif March 18, 2021 10:36
@carlescufi
Copy link
Member

the question here is: why do we want to maintain a top-level Makefile to build the documentation?

I agree, having a Makefile at the root just to build the doc does not make sense in my opinion.

@nashif
Copy link
Member

nashif commented Mar 18, 2021

in order to rebuild docs one can just do ninja htmldocs everytime when inside the build dir. Actually it's not just make, it's source zephyr-env.sh and make htmldocs...

lets not pull source zephyr-env.sh into this please, for me this is a given and is always done as the first thing when I go into the repo, building docs right now is really just calling 'make', the default target gets me what I want.

I agree, having a Makefile at the root just to build the doc does not make sense in my opinion.

Then provide a way or a shortcut (script?) to build docs without having to deal with and remember cmake and ninja options like

cmake -GNinja -S doc -Bdoc/_build
ninja -C doc/_build htmldocs

@gmarull
Copy link
Member Author

gmarull commented Mar 18, 2021

I think that a shortcut script isn't ideal, what if I want to run doxygen target? What if I just want to skip CMake configuration step?

Note that CMake command allows for some more simplicity, e.g. taking Ninja out of the game (doesn't add value here other than offering better experience for Windows users):

# from `doc` folder
cmake -B_build .
cd _build
make htmldocs
# edit files
make htmldocs
...

@carlescufi
Copy link
Member

carlescufi commented Mar 18, 2021

Then provide a way or a shortcut (script?) to build docs without having to deal with and remember cmake and ninja options like

We rejected this in-tree back when we switched from make to CMake, asking people to have their own scripts or aliases, if memory serves.
EDIT: @nashif for reference, here is what I am referring to: #5201 (review)

@nashif
Copy link
Member

nashif commented Mar 18, 2021

EDIT: @nashif for reference, here is what I am referring to: #5201 (review)

right, then leave the Makefile. I am really not sure what problem are we trying to solve here.

@gmarull
Copy link
Member Author

gmarull commented Mar 18, 2021

EDIT: @nashif for reference, here is what I am referring to: #5201 (review)

right, then leave the Makefile. I am really not sure what problem are we trying to solve here.

IMO it's about tidiness. A top-level Makefile (a wrapper Makefile to be precise) just for docs is odd. Even more if Make is not actually used as a build system... Would it be possible at least to move it down to docs...?

@carlescufi
Copy link
Member

EDIT: @nashif for reference, here is what I am referring to: #5201 (review)

right, then leave the Makefile. I am really not sure what problem are we trying to solve here.

IMO it's about tidiness. A top-level Makefile (a wrapper Makefile to be precise) just for docs is odd. Even more if Make is not actually used as a build system... Would it be possible at least to move it down to docs...?

I do agree with @gmarull here. That Makefile used to be the project's main entry point to the build system, but now it's just a wrapper around CMake for the docs? it's kind of a very strange reasoning for a Makefile to be there at all to be honest.

@carlescufi
Copy link
Member

EDIT: @nashif for reference, here is what I am referring to: #5201 (review)

right, then leave the Makefile. I am really not sure what problem are we trying to solve here.

IMO it's about tidiness. A top-level Makefile (a wrapper Makefile to be precise) just for docs is odd. Even more if Make is not actually used as a build system... Would it be possible at least to move it down to docs...?

I do agree with @gmarull here. That Makefile used to be the project's main entry point to the build system, but now it's just a wrapper around CMake for the docs? it's kind of a very strange reasoning for a Makefile to be there at all to be honest.

In fact, I would argue that it's misleading to have that Makefile at all. Everything in Zephyr is CMake-based, but users looking at the codebase for the first time see a Makefile in the root folder, which is a red herring.

@carlescufi
Copy link
Member

@nashif do you really want to keep this Makefile? I disagree, but we can discuss it.

@nashif
Copy link
Member

nashif commented Mar 25, 2021

@nashif do you really want to keep this Makefile? I disagree, but we can discuss it.

if the makefile being in the root is the problem, just move it under doc, Is this acceptable?

@carlescufi
Copy link
Member

@nashif do you really want to keep this Makefile? I disagree, but we can discuss it.

if the makefile being in the root is the problem, just move it under doc, Is this acceptable?

If you insist... but I really think that keeping a Makefile that just wraps a CMake script makes no sense.

@carlescufi
Copy link
Member

dev-review 2021.03.25:

  • Move the Makefile to doc/
  • Long term, create a west doc-build command

Sphinx supports parallelized build (-j) option. Setting it to `auto`
makes use of all available cores. This option seems to speed up the
build significantly on multi-core machines.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
@gmarull gmarull force-pushed the feature/docs-cleanup-1 branch 2 times, most recently from ee94d1a to 981d145 Compare March 25, 2021 19:51
Move the top-level Makefile to the documentation folder as it is only
used for documentation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
@gmarull gmarull force-pushed the feature/docs-cleanup-1 branch from 981d145 to 3892248 Compare March 25, 2021 19:52
@gmarull
Copy link
Member Author

gmarull commented Mar 25, 2021

@nashif should be ready now

@nashif nashif merged commit 32b71cb into zephyrproject-rtos:master Mar 29, 2021
Copy link
Contributor

@mbolivar-nordic mbolivar-nordic left a comment

Choose a reason for hiding this comment

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

@nashif I remember trying this a couple of years ago and dbkinder told me this lead to nondeterministic error output being caught by the .known-issues checks.

@gmarull have you tried this with different -j levels (not -j auto, but -j 2, -j 4, etc.) to make sure this doesn't happen?

@mbolivar-nordic
Copy link
Contributor

lol, too late to the party

@gmarull
Copy link
Member Author

gmarull commented Mar 29, 2021

@mbolivar-nordic I've only tried -j auto (which is -j 12 on my machine) and I haven't seen any errors so far. Do you mean that known issues filter is masking some real issues?

@gmarull gmarull deleted the feature/docs-cleanup-1 branch March 29, 2021 15:02
@mbolivar-nordic
Copy link
Contributor

#14983 (comment) is the thread where dbkinder mentioned problems

@mbolivar-nordic
Copy link
Contributor

mbolivar-nordic commented Mar 29, 2021

@mbolivar-nordic I've only tried -j auto (which is -j 12 on my machine) and I haven't seen any errors so far. Do you mean that known issues filter is masking some real issues?

I'm reading tea leaves here, but basically I think that we are (or at least at some point, we were) relying on a particular serialization of how the .rst files are processed when masking errors in .known-issues.

For example -- and again I want to emphasize I am just making an educated guess here since it was @dbkinder, the former docs maintainer, who pointed out the error -- if we get a Duplicate C declaration warning from foo.rst using -j1, we might get the same warning from bar.rst using -j3 if bar.rst and foo.rst happen to get processed in different orders in -j3 vs -j1.

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.

6 participants