Skip to content

Commit

Permalink
Update User Guide for 20.07 Release (#60)
Browse files Browse the repository at this point in the history
* Add sphinx support and documentation build script

* skip copyright check on VERSION in docs folder

* Cleanup documentation

* Cleanup 20.07 User Guide
  • Loading branch information
dzier authored Jul 28, 2020
1 parent cb1099f commit afdcf6c
Show file tree
Hide file tree
Showing 12 changed files with 426 additions and 42 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ COPY . .

RUN pip uninstall -y pyprof
RUN pip install --no-cache-dir .

# Generating the docs requires the docs source so copy that into the L0_docs so
# that it is available when the test runs.
RUN cp VERSION qa/L0_docs/. && \
cp README.rst qa/L0_docs/. && \
cp -r docs qa/L0_docs/.

9 changes: 6 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ branch for this release is `r20.07
Documentation
-------------

A `Quick Start Guide <https://docs.nvidia.com/deeplearning/frameworks/pyprof-user-guide/quickstart.html>`_ and
`Installation Guide <https://docs.nvidia.com/deeplearning/frameworks/pyprof-user-guide/install.html>`_
provide instructions on how to install and use PyProf.

The User Guide can be found in the
`PyProf docs folder <https://github.com/NVIDIA/PyProf/blob/master/docs>`_, and
provides instructions on how to install and profile with PyProf.
`documentation for current release <https://docs.nvidia.com/deeplearning/frameworks/pyprof-user-guide/index.html>`_.

An `FAQ <https://github.com/NVIDIA/PyProf/blob/master/docs/faqs.rst>`_ provides
An `FAQ <https://docs.nvidia.com/deeplearning/frameworks/pyprof-user-guide/faqs.html>`_ provides
answers for frequently asked questions.

Contributing
Expand Down
37 changes: 37 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = PyProf
SOURCEDIR = .
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(O)

clean:
@rm -fr $(BUILDDIR)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help clean Makefile
66 changes: 66 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!--
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
{% extends "!layout.html" %}
{% block sidebartitle %} {{ super() }}

<style>
/* Sidebar header (and topbar for mobile) */
.wy-side-nav-search, .wy-nav-top {
background: #76b900;
}

.wy-side-nav-search a:link, .wy-nav-top a:link {
color: #fff;
}
.wy-side-nav-search a:visited, .wy-nav-top a:visited {
color: #fff;
}
.wy-side-nav-search a:hover, .wy-nav-top a:hover {
color: #fff;
}

.wy-menu-vertical a:link, .wy-menu-vertical a:visited {
color: #d9d9d9
}

.wy-menu-vertical a:active {
background-color: #76b900
}

.wy-side-nav-search>div.version {
color: rgba(0, 0, 0, 0.3)
}
</style>
{% endblock %}

{% block footer %} {{ super() }}

<style>
a:link, a:visited {
color: #76b900;
}

a:hover {
color: #8c0;
}

.rst-content dl:not(.docutils) dt {
background: rgba(118, 185, 0, 0.1);
color: rgba(59,93,0,1);
border-top: solid 3px rgba(59,93,0,1);
}
</style>
{% endblock %}
231 changes: 231 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('..'))
from builtins import str
import os
import re
import sphinx_rtd_theme
import subprocess
import textwrap

# -- Project information -----------------------------------------------------

project = u'NVIDIA PyProf'
copyright = u'2020, NVIDIA Corporation'
author = u'NVIDIA Corporation'

version_long = u'0.0.0'
with open("../VERSION") as f:
version_long = f.readline()

version_short = re.match('^[\d]+\.[\d]+', version_long).group(0)

git_sha = os.getenv("GIT_SHA")

if not git_sha:
try:
git_sha = subprocess.check_output(["git", "log", "--pretty=format:'%h'", "-n1"]).decode('ascii').replace("'","").strip()
except:
git_sha = u'0000000'

git_sha = git_sha[:7] if len(git_sha) > 7 else git_sha

version = str(version_long + u"-" + git_sha)
# The full version, including alpha/beta/rc tags
release = str(version_long)

# hack: version is used for html creation, so put the version picker
# link here as well:
version = version + """<br/>
Version select: <select onChange="window.location.href = this.value" onFocus="this.selectedIndex = -1">
<option value="https://docs.nvidia.com/deeplearning/frameworks/pyprof-user-guide/docs/index.html">Current release</option>
<option value="https://docs.nvidia.com/deeplearning/frameworks/pyprof-archived/index.html">Older releases</option>
</select>"""

# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx.ext.ifconfig',
'sphinx.ext.extlinks',
'nbsphinx',
'breathe'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = [u'build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# Setup the breathe extension
breathe_projects = {
"BreathePyProf": "./doxyoutput/xml"
}
breathe_default_project = "BreathePyProf"

# Tell sphinx what the pygments highlight language should be.
highlight_language = 'text'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'canonical_url': 'https://docs.nvidia.com/deeplearning/frameworks/pyprof-user-guide/docs/index.html',
'collapse_navigation': False,
'display_version': True,
'logo_only': False,
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'NVIDIAPyProfdoc'


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'NVIDIAPyProf.tex', u'NVIDIA PyProf Documentation',
u'NVIDIA Corporation', 'manual'),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'nvidiapyprof', u'NVIDIA PyProf Documentation',
[author], 1)
]


# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'NVIDIAPyProf', u'NVIDIA PyProf Documentation',
author, 'NVIDIAPyProf', 'One line description of project.',
'Miscellaneous'),
]


# -- Extension configuration -------------------------------------------------
extlinks = {'issue': ('https://github.com/NVIDIA/PyProf/issues/%s',
'issue '),
'fileref': ('https://github.com/NVIDIA/PyProf/tree/' +
(git_sha if git_sha != u'0000000' else "master") + '/%s', ''),}

def setup(app):
# If envvar is set then the file is expected to contain a script
# that is added to every documentation page
visitor_script = os.getenv("VISITS_COUNTING_SCRIPT")
if visitor_script:
app.add_js_file(visitor_script)
3 changes: 0 additions & 3 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ Examples

This section provides several real examples on how to profile with PyPRrof.

*TODO:* Provide real examples. Everything here should also be added to
a QA L0_ test to lock in the code

Navigate to the lenet example. ::

$ cd pyprof/examples
Expand Down
Loading

0 comments on commit afdcf6c

Please sign in to comment.