Skip to content
Draft
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
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx-cpp/_build
sphinx-python/_build
sphinx-cpp/_doxygen
16 changes: 16 additions & 0 deletions docs/build_cpp_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="${SCRIPT_DIR}/sphinx-cpp/_build"
DOXYGEN_DIR="${SCRIPT_DIR}/sphinx-cpp/_doxygen"

mkdir -p "${BUILD_DIR}" "${DOXYGEN_DIR}"

echo "Running Doxygen for C++ API..."
(cd "${SCRIPT_DIR}/sphinx-cpp" && doxygen Doxyfile)

echo "Building Sphinx C++ docs..."
sphinx-build -b html "${SCRIPT_DIR}/sphinx-cpp" "${BUILD_DIR}"

echo "C++ docs available at ${BUILD_DIR}/index.html"
12 changes: 12 additions & 0 deletions docs/build_python_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="${SCRIPT_DIR}/sphinx-python/_build"

mkdir -p "${BUILD_DIR}"

echo "Building Sphinx Python docs..."
sphinx-build -b html "${SCRIPT_DIR}/sphinx-python" "${BUILD_DIR}"

echo "Python docs available at ${BUILD_DIR}/index.html"
45 changes: 45 additions & 0 deletions docs/sphinx-cpp/Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
PROJECT_NAME = "NVBench"
PROJECT_BRIEF = "C++ NVBench Library"
OUTPUT_DIRECTORY = _doxygen
GENERATE_XML = YES
GENERATE_HTML = NO
GENERATE_LATEX = NO
QUIET = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_LOGFILE = _doxygen/warnings.log
INPUT = ../../nvbench
EXCLUDE = ../../nvbench/cupti_profiler.cxx
EXCLUDE_SYMBOLS = type_strings \
nvbench::detail \
nvbench::internal \
nvbench::tl \
UNUSED \
M_PI \
NVBENCH_UNIQUE_IDENTIFIER_IMPL1 \
NVBENCH_UNIQUE_IDENTIFIER_IMPL2 \
main
FILE_PATTERNS = *.cuh *.cxx *.cu *.h *.hpp
EXTENSION_MAPPING = cuh=C++ cu=C++
RECURSIVE = YES
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = YES
STRIP_FROM_PATH = ../../
CLANG_ASSISTED_PARSING = YES
CLANG_OPTIONS = -std=c++17
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
GENERATE_TAGFILE =
XML_PROGRAMLISTING = NO
PREDEFINED = __device__= \
__host__= \
__global__= \
__forceinline__= \
__shared__= \
__align__(x)= \
__launch_bounds__(x)= \
NVBENCH_HAS_CUDA=1
Binary file added docs/sphinx-cpp/_static/nvidia-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions docs/sphinx-cpp/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import os
import sys

project = "NVBench C++ API"
author = "NVIDIA Corporation"

extensions = ["breathe"]

templates_path = ["_templates"]
exclude_patterns = ["_build", "_doxygen"]

release = "0.0.1"

_here = os.path.abspath(os.path.dirname(__file__))
_doxygen_xml = os.path.join(_here, "_doxygen", "xml")

breathe_projects = {"nvbench": _doxygen_xml}
breathe_default_project = "nvbench"
breathe_domain_by_extension = {"cuh": "cpp", "cxx": "cpp", "cu": "cpp"}

sys.path.insert(0, os.path.abspath(os.path.join(_here, "..", "..")))


def _patch_breathe_namespace_declarations() -> None:
try:
import breathe.renderer.sphinxrenderer as sphinxrenderer
from docutils import nodes
from sphinx import addnodes
except Exception:
return

original = sphinxrenderer.SphinxRenderer.handle_declaration

def handle_declaration(self, nodeDef, declaration, *args, **kwargs):
is_namespace = getattr(nodeDef, "kind", None) == "namespace"
if not is_namespace:
return original(self, nodeDef, declaration, *args, **kwargs)

name = (declaration or "").strip()
if name.startswith("namespace "):
name = name[len("namespace ") :].strip()
if not name:
name = "<anonymous>"

keyword = addnodes.desc_sig_keyword("namespace", "namespace")
sig_name = addnodes.desc_sig_name(name, name)
return [keyword, nodes.Text(" "), sig_name]

sphinxrenderer.SphinxRenderer.handle_declaration = handle_declaration


def setup(app):
_patch_breathe_namespace_declarations()


######################################################

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

html_theme = "nvidia_sphinx_theme"

html_logo = "_static/nvidia-logo.png"

html_baseurl = (
os.environ.get("NVBENCH_DOCS_BASE_URL", "https://nvidia.github.io/nvbench/").rstrip(
"/"
)
+ "/"
)

html_theme_options = {
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/NVIDIA/nvbench",
"icon": "fa-brands fa-github",
"type": "fontawesome",
}
],
"navigation_depth": 4,
"show_toc_level": 2,
"navbar_start": ["navbar-logo"],
"navbar_end": ["theme-switcher", "navbar-icon-links"],
"footer_start": ["copyright"],
"footer_end": ["sphinx-version"],
"sidebar_includehidden": True,
"collapse_navigation": False,
"switcher": {
"json_url": f"{html_baseurl}nv-versions.json",
"version_match": release,
},
}

html_static_path = ["_static"] if os.path.exists("_static") else []

# Images directory
if os.path.exists("img"):
html_static_path.append("img")
5 changes: 5 additions & 0 deletions docs/sphinx-cpp/cpp_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NVBench C++ API Reference
=========================

.. doxygenindex::
:project: nvbench
7 changes: 7 additions & 0 deletions docs/sphinx-cpp/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NVBench C++ API
===============

.. toctree::
:maxdepth: 2

cpp_api
Binary file added docs/sphinx-python/_static/nvidia-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions docs/sphinx-python/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import os

project = "cuda.bench Python API"
author = "NVIDIA Corporation"

extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx.ext.autosummary"]

templates_path = ["_templates"]
exclude_patterns = ["_build"]

autosummary_generate = True
autodoc_default_options = {"members": True, "undoc-members": True}

release = "0.2.0"

######################################################

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

html_theme = "nvidia_sphinx_theme"

html_logo = "_static/nvidia-logo.png"

html_baseurl = (
os.environ.get("NVBENCH_DOCS_BASE_URL", "https://nvidia.github.io/nvbench/").rstrip(
"/"
)
+ "/"
)

html_theme_options = {
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/NVIDIA/nvbench",
"icon": "fa-brands fa-github",
"type": "fontawesome",
}
],
"navigation_depth": 4,
"show_toc_level": 2,
"navbar_start": ["navbar-logo"],
"navbar_end": ["theme-switcher", "navbar-icon-links"],
"footer_start": ["copyright"],
"footer_end": ["sphinx-version"],
"sidebar_includehidden": True,
"collapse_navigation": False,
"switcher": {
"json_url": f"{html_baseurl}nv-versions.json",
"version_match": release,
},
}

html_static_path = ["_static"] if os.path.exists("_static") else []

# Images directory
if os.path.exists("img"):
html_static_path.append("img")
7 changes: 7 additions & 0 deletions docs/sphinx-python/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cuda.bench Python API
=====================

.. toctree::
:maxdepth: 2

python_api
8 changes: 8 additions & 0 deletions docs/sphinx-python/python_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cuda.bench Python API Reference
===============================

.. automodule:: cuda.bench
:members:
:imported-members:
:undoc-members:
:show-inheritance:
Loading