-
Notifications
You must be signed in to change notification settings - Fork 8.2k
doc: turbo mode for kconfig options #12631
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
Conversation
|
All checks are passing now. Review history of this comment for details about previous failed status. |
Codecov Report
@@ Coverage Diff @@
## master #12631 +/- ##
=======================================
Coverage 53.94% 53.94%
=======================================
Files 242 242
Lines 27654 27654
Branches 6717 6717
=======================================
Hits 14917 14917
Misses 9932 9932
Partials 2805 2805Continue to review full report at Codecov.
|
dbkinder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tried to build documents with KCONFIG_DOC_TURBO_MODE unset, the build fails within 10 seconds with only the message ninja: build stopped: subcommand failed:
~/zephyr$ echo $KCONFIG_DOC_TURBO_MODE
~/zephyr$ source zephyr-env.sh
~/zephyr$ time make htmldocs
mkdir -p doc/_build && cmake -GNinja -DDOC_TAG=development -DSPHINXOPTS=-q -Bdoc/_build -Hdoc/ && ninja -C doc/_build htmldocs
-- Zephyr base: /home/dbkinder/zephyr
Zephyr version: 1.13.99
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.7", minimum required is "3.4")
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.13") found components: doxygen
-- Found LATEX: /usr/bin/latex
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dbkinder/zephyr/doc/_build
ninja: Entering directory `doc/_build'
[1/4] cd /home/dbkinder/zephyr/doc && /home/dbkinder/.local/lib/python3.6/site-packages/cmake/data/bin/cmake -...CH=x86 /usr/bin/python3 scripts/genrest.py Kconfig /home/dbkinder/zephyr/doc/_build/rst/doc/reference/kconfig/
FAILED: CMakeFiles/kconfig
cd /home/dbkinder/zephyr/doc && /home/dbkinder/.local/lib/python3.6/site-packages/cmake/data/bin/cmake -E make_directory /home/dbkinder/zephyr/doc/_build/rst/doc/reference/kconfig && /home/dbkinder/.local/lib/python3.6/site-packages/cmake/data/bin/cmake -E env PYTHONPATH="/home/dbkinder/zephyr/scripts/kconfig:" srctree=/home/dbkinder/zephyr KERNELVERSION=0x10D6300 BOARD_DIR=boards/*/*/ ARCH=* SOC_DIR=soc/ SRCARCH=x86 /usr/bin/python3 scripts/genrest.py Kconfig /home/dbkinder/zephyr/doc/_build/rst/doc/reference/kconfig/
[3/4] cd /home/dbkinder/zephyr/doc/_build && /home/dbkinder/.local/lib/python3.6/site-packages/cmake/data/bin/...xy.log -DWORKING_DIRECTORY=/home/dbkinder/zephyr/doc -P /home/dbkinder/zephyr/cmake/util/execute_process.cmake
ninja: build stopped: subcommand failed.
Makefile:16: recipe for target 'htmldocs' failed
make: *** [htmldocs] Error 1
real 0m9.599s
user 0m8.611s
sys 0m1.475s
|
An interesting optimization, but I'm not sure this PR is really needed for developers. Today, generating full documentation in a clean doc build environment (with an empty doc/_build folder) takes about 7m40s (on my Ubuntu box). We've implemented optimizations so a rebuild of documentation with some reST file changes takes only 1m38s (when the doc/_build folder already exists). Sphinx knows not to regenerate HTML if the corresponding reST file didn't change, and the Kconfig automation doesn't update a config option reST file if it would be the same as was previously generated. With this PR, a doc build without generating the Kconfig options (in a clean doc build environment) takes about 2m33s and a rebuild (with an existing doc/_build folder) takes 1m30s), but the Kconfig option descriptions are missing. If the intent was to expedite developers rebuilding documentation in a working environment where they're making reST changes, checking the output, and rebuilding docs again, what we have today seems to work just fine, after the first doc build. That said, our current CI process always builds documentation in a clean environment (with an empty doc/_build folder), so this PR would indeed reduce the CI doc build processing by about 6 minutes, but would not be verifying the full docs would build properly (if there were errors in the Kconfig option documentation). |
I need that and and anyone doing anything serious with the documentation would need that. The rebuild performance is useless for many cases and is error prone, we copy files around and we end up with inconsistent results, especially when doing some major restructuring of the docs. But regardless, waiting the initial 7m40sis is 5 minutes wasted that I will never get back, why should I wait ~8 minutes when I can get things done in ~2?. Obviously whoever is going to use that need to know what they are doing. |
182847a to
d1dd9c3
Compare
yeah, leftover debug code. |
doc/README.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To position this a bit differently and fix some typos, how about:
Developer-mode Document Building
********************************
Building the documentation for all the Kconfig options significantly
adds to the total doc build time. When making and testing major changes
to the documentation, we provide an option to temporarily stub-out
the auto-generated configuration documentation so the doc build process
runs much faster.
To enable this "turbo" doc generation mode, before building
the documents, export the following environment variable (on Linux and macOS)::
export KCONFIG_DOC_TURBO_MODE=1
and then build the documentation as usual.
.. note:: Be sure to unset the KCONFIG_DOC_TURBO_MODE
variable before building the documentation for publication
purposes.
doc/scripts/genrest.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will run in TURBO_MODE if KCONFIG_DOC_TURBO_MODE has any value, right?
|
I am fine with the change, but I suggest we do not use environment variables since those are terrible on Windows. Can we use instead either:
|
dbkinder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
I can feel the excitement. |
|
OK!!!! :) |
addressed |
ulfalizer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the turbo_mode stuff just be a single if turbo_mode? That way it wouldn't get tangled up in the normal path.
Could get rid of a variable that way too maybe, like this:
if os.environ.get("KCONFIG_TURBO_MODE") == "1":
# Generate dummy index page, etc.
else:
...
doc/scripts/genrest.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could reuse the same index_rst variable in both cases here maybe. It's just different RST being generated for the index page, if I'm reading it right.
doc/scripts/genrest.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a different file being output here, in addition to index.rst?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to create the definition of the option in RST, otherwise we will have broken references.
doc/scripts/genrest.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could index_rst be reused here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, need to generate two files.
carlescufi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Building the documentation for all the Kconfig options significantly
adds to the total doc build time. When making and testing major changes
to the documentation, we provide an option to temporarily stub-out
the auto-generated configuration documentation so the doc build process
runs much faster.
To enable this mode, set the following option when invoking cmake
-DKCONFIG_TURBO_MODE=1
Signed-off-by: Anas Nashif <[email protected]>
And now TURBO_TURBO mode: 8 seconds with PR #13159 |
|
TURBO x3: do not re-run doxygen for no reason PR #13442 |
Building the complete documentation is a time consuming task due to the amount
of auto-generated pages we create during the documentation build process. When
making major changes to the documentation and rebuilding the documentation very
often it is possible to skip the Kconfig option generation and just enable
generation empty option definition to satisfy references.
To build in turbo mode, use
make htmldocs-fast