Skip to content
Draft
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .github/_typos.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[files]
extend-exclude = ["third_party/*", "*.svg", "*.bib", "CITING.md"]
extend-exclude = ["third_party/*", "*.svg", "*.bib", "CITING.md", "Doxyfile.in"]

[default.extend-words]
dout = "dout"
Expand Down
41 changes: 0 additions & 41 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -553,47 +553,6 @@ sonarqube_cov:
- bash <(curl -s https://codecov.io/bash) -f "\!*examples*" -f "\!*third_party*" -f "\!*c\\+\\+*" -f "\!*benchmark*"


# Deploy documentation to github-pages
gh-pages:
stage: deploy
interruptible: false
extends:
- .default_variables
- .deploy_condition
- .before_script_git_template
- .use_status-job-settings
variables:
PUBLIC_REPO: git@github.com:ginkgo-project/ginkgo-generated-documentation.git
script:
# build docs
- mkdir -p ${CI_JOB_NAME} && pushd ${CI_JOB_NAME}
- cmake ${CI_PROJECT_DIR}
-DCMAKE_CXX_COMPILER=${CXX_COMPILER}
-DCMAKE_CUDA_COMPILER=${CUDA_COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
-DBUILD_SHARED_LIBS=ON ${EXTRA_CMAKE_FLAGS} -DGINKGO_DEVEL_TOOLS=OFF
-DGINKGO_BUILD_REFERENCE=OFF -DGINKGO_BUILD_OMP=OFF -DGINKGO_BUILD_CUDA=OFF
-DGINKGO_BUILD_HIP=OFF -DGINKGO_BUILD_SYCL=OFF -DGINKGO_BUILD_MPI=OFF
-DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF
-DGINKGO_BUILD_DOC=ON -DGINKGO_DOC_GENERATE_PDF=ON
- make usr
- make pdf
- popd
# publish it
- git clone ${PUBLIC_REPO} -b gh-pages gh-pages-repo
- rm -rf gh-pages-repo/doc/${CI_COMMIT_REF_NAME}
- mkdir -p gh-pages-repo/doc
- mkdir -p gh-pages-repo/doc/pdf
- cp -r ${CI_JOB_NAME}/doc/usr gh-pages-repo/doc/${CI_COMMIT_REF_NAME}
- cp ${CI_JOB_NAME}/doc/pdf.pdf gh-pages-repo/doc/pdf/${CI_COMMIT_REF_NAME}.pdf
- export CURRENT_SHA="$(git rev-parse --short HEAD)"
- cd gh-pages-repo
- git add -A
- git diff --quiet HEAD ||
(git commit -m "Update documentation from ginkgo-project/ginkgo@${CURRENT_SHA}" && git push)
dependencies: null
needs: []


threadsanitizer:
stage: QoS_tools
extends:
Expand Down
38 changes: 38 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
Copy link
Member

@yhmtsai yhmtsai Mar 25, 2025

Choose a reason for hiding this comment

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

after this pr, we need to have registered in readthedoc. They will constantly fetch the repo or get the notification by some API hook. We do not need to do anything on our CI, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it gets automatically picked up: MarcelKoch#20.
I think all of the configuration happens on the read-the-docs side.

Copy link
Member

Choose a reason for hiding this comment

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

I see. I have also seen https://docs.readthedocs.com/platform/stable/guides/automation-rules.html such that we can set up a rule to just make the release and latest version documentation not-hidden to user.
We can make the normal branch either in hidden state (still build) or deactivated (no build).


# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-24.04
apt_packages:
- doxygen
- cmake
- graphviz
tools:
python: "3.12"
jobs:
pre_build:
- cmake -S . -B build
-DGINKGO_BUILD_DOC=ON
-DGINKGO_DOC_GENERATE_PDF=OFF
-DGINKGO_BUILD_EXAMPLES=OFF
-DGINKGO_BUILD_TESTS=OFF
-DGINKGO_BUILD_BENCHMARKS=OFF
-DGINKGO_BUILD_REFERENCE=OFF
-DGINKGO_BUILD_OMP=OFF
-DGINKGO_BUILD_CUDA=OFF
-DGINKGO_BUILD_HIP=OFF
-DGINKGO_BUILD_SYCL=OFF
-DGINKGO_BUILD_MPI=OFF
- cmake --build build -t doxysphinx -- -j

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: build/doc/conf.py

# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: doc/requirements.txt
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ implemented for NVIDIA, AMD and Intel GPUs.

# Prerequisites

### Linux and Mac OS
### Linux and macOS

For Ginkgo core library:

Expand Down Expand Up @@ -97,7 +97,7 @@ The Ginkgo OMP module has the following __additional__ requirements:
* _MinGW_

In these environments, two problems can be encountered, the solution for which is described in the
[windows section in INSTALL.md](INSTALL.md#building-ginkgo-in-windows):
[windows section in install.md](doc/user-guide/install.md#building-ginkgo-in-windows):
* `ld: error: export ordinal too large` needs the compilation flag `-O1`
* `cc1plus.exe: out of memory allocating 65536 bytes` requires a modification of the environment

Expand All @@ -120,7 +120,7 @@ modules depending on your machine environment (present of CUDA, ...). You can
also explicitly compile with the OpenMP, CUDA, HIP or DPC++(SYCL) modules enabled to
run the examples with these executors.

Please refer to the [Installation page](./INSTALL.md) for more details.
Please refer to the [Installation page](doc/user-guide/install.md) for more details.

Tip: After installation, in your CMake project, Ginkgo can be added with `find_package(Ginkgo)` and the the target that is exported is `Ginkgo::ginkgo`.
An example can be found in the [`test_install`](test/test_install/CMakeLists.txt).
Expand All @@ -140,15 +140,15 @@ Various examples are available for you to understand and play with Ginkgo within
A unique feature of Ginkgo is the ability to run benchmarks and view your results
with the help of the [Ginkgo Performance Explorer (GPE)](https://ginkgo-project.github.io/gpe/).

More details about this can be found in the [BENCHMARKING.md page](./BENCHMARKING.md)
More details about this can be found in the [benchmarking.md page](doc/user-guide/benchmarking.md)

# Bug reports and Support

If you have any questions about using Ginkgo, please use [Github discussions](https://github.com/ginkgo-project/ginkgo/discussions).

If you would like to request a feature, or have encountered a bug, please [create an issue](https://github.com/ginkgo-project/ginkgo/issues/new). Please be sure to describe your problem and provide as much information as possible.

You can also send an email to [Ginkgo's main email address](mailto:ginkgo.library@gmail.com).
You can also email [Ginkgo's main email address](mailto:ginkgo.library@gmail.com).

# Licensing

Expand All @@ -157,12 +157,12 @@ to the project are added under this license.

Depending on the configuration options used when building Ginkgo, third party
software may be pulled as additional dependencies, which have their own
licensing conditions. Refer to [ABOUT-LICENSING.md](ABOUT-LICENSING.md) for
licensing conditions. Refer to [about-licensing.md](doc/user-guide/about-licensing.md) for
details.

# Contributing to Ginkgo

We are glad that that you would like to contribute to Ginkgo and we are happy to help you with any questions you may have.
We are glad that you would like to contribute to Ginkgo, and we are happy to help you with any questions you may have.

If you are contributing for the first time, please add yourself to the list of external contributors with the following info

Expand All @@ -181,7 +181,7 @@ license, as specified in the repository's LICENSE file.

#### Contribution Guidelines

When contributing to Ginkgo, to ease the review process, please follow the guidelines mentioned in [CONTRIBUTING.md](CONTRIBUTING.md).
When contributing to Ginkgo, to ease the review process, please follow the guidelines mentioned in [contributing.md](doc/user-guide/contributing.md).

It also contains other general recommendations such as writing proper commit messages, understanding Ginkgo's library design, relevant C++ information etc.

Expand Down Expand Up @@ -211,5 +211,4 @@ pages = {2:1--2:33}
}
```

For more information on topical subjects, please refer to the [CITING.md
page](CITING.md).
For more information on topical subjects, please refer to the [citing.md page](doc/user-guide/citing.md).
100 changes: 80 additions & 20 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,84 @@
cmake_minimum_required(VERSION 3.16)
include(helpers.cmake)
find_package(Doxygen REQUIRED)
find_package(Perl REQUIRED)
option(GINKGO_DOC_GENERATE_PDF "Generate PDF documentation" OFF)
option(GINKGO_DOC_GENERATE_DEV "Generate internal documentation" OFF)
option(GINKGO_DOC_GENERATE_EXAMPLES "Generate example documentation" ON)
if(GINKGO_DOC_GENERATE_EXAMPLES)
add_subdirectory(examples)
endif()
add_subdirectory(doxygen)

set(default_predefined_macros "GKO_HAVE_PAPI_SDE=1 GINKGO_BUILD_MPI=1")
find_program(sphinx-build NAMES sphinx-build REQUIRED)
find_program(doxysphinx NAMES doxysphinx REQUIRED)

if(GINKGO_DOC_GENERATE_PDF)
find_package(LATEX COMPONENTS PDFLATEX REQUIRED)
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in
${CMAKE_CURRENT_BINARY_DIR}/conf.py
@ONLY
)

ginkgo_doc_gen(usr Doxyfile-usr.in OFF USR_DOC.md)
if(GINKGO_DOC_GENERATE_DEV)
ginkgo_doc_gen(dev Doxyfile-dev.in OFF DEV_DOC.md)
endif()
if(GINKGO_DOC_GENERATE_PDF)
ginkgo_doc_gen(pdf Doxyfile-pdf.in ON PDF_DOC.md)
# Copy to the sphinx sources in the build directory
# These have to be actual copies, since sphinx (or myst) can't
# resolve (symbolic) links to files outside the sphinx source
# directory
set(files_to_copy ${CMAKE_CURRENT_SOURCE_DIR}/index.md)
set(dirs_to_copy)
set(dirs _static _templates developer-guide user-guide)
foreach(dir IN LISTS dirs)
file(GLOB_RECURSE globs LIST_DIRECTORIES true CONFIGURE_DEPENDS ${dir}/*)
list(APPEND files_to_copy ${globs})

cmake_path(ABSOLUTE_PATH dir OUTPUT_VARIABLE absolute_dir)
list(APPEND dirs_to_copy ${absolute_dir})
endforeach()

foreach(in_source_file IN LISTS dirs_to_copy files_to_copy)
string(
REGEX REPLACE
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
in_binary_file
${in_source_file}
)
if(IS_DIRECTORY ${in_source_file})
file(MAKE_DIRECTORY ${in_binary_file})
else()
file(COPY_FILE ${in_source_file} ${in_binary_file})
endif()
endforeach()

# Create symlinks for top-level files referenced by documentation
# Here links are fine, since those files are not part of the documentation,
# they are just referenced
file(MAKE_DIRECTORY ${Ginkgo_BINARY_DIR}/test/test_install/)
file(
CREATE_LINK ${Ginkgo_SOURCE_DIR}/LICENSE ${Ginkgo_BINARY_DIR}/LICENSE
SYMBOLIC
)
file(
Copy link
Member

Choose a reason for hiding this comment

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

do we use test_install somewhere in documentation?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, in install.md, right at the bottom.

Copy link
Member

Choose a reason for hiding this comment

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

I have tested it, but it actually downloaded the file.
I think it should be a link to the github page on the code rather than download that file.

CREATE_LINK
${Ginkgo_SOURCE_DIR}/test/test_install/CMakeLists.txt
${Ginkgo_BINARY_DIR}/test/test_install/CMakeLists.txt
SYMBOLIC
)

if(DEFINED ENV{READTHEDOCS_OUTPUT})
set(GINKGO_SPHINX_BUILD_DIR $ENV{READTHEDOCS_OUTPUT}/html)
else()
set(GINKGO_SPHINX_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/_build)
endif()

add_custom_target(
doxysphinx
ALL
COMMAND
"${doxysphinx}" build --doxygen_cwd ${CMAKE_CURRENT_BINARY_DIR}/doxygen/
${CMAKE_CURRENT_BINARY_DIR} ${GINKGO_SPHINX_BUILD_DIR}
${CMAKE_CURRENT_BINARY_DIR}/doxygen/Doxyfile
DEPENDS doxygen
COMMENT "Generating .rst files from doxygen documentation"
VERBATIM
)

add_custom_target(
sphinx-doc
ALL
COMMAND
"${sphinx-build}" -j auto -b html --quiet ${CMAKE_CURRENT_BINARY_DIR}
${GINKGO_SPHINX_BUILD_DIR}
DEPENDS doxysphinx
COMMENT "Generating sphinx documentation"
VERBATIM
)
9 changes: 9 additions & 0 deletions doc/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
html{
--pst-font-size-base: 17px;
}
html[data-theme="light"] {
--pst-color-primary: #F7A71E;
}
.bd-page-width {
max-width: 100rem; /* default is 88rem */
}
25 changes: 25 additions & 0 deletions doc/_templates/article-header-buttons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{#
SPDX-FileCopyrightText: 2020 Chris Holdgraf

SPDX-License-Identifier: BSD-3-Clause
#}

{#
Copied from: https://github.com/executablebooks/sphinx-book-theme/blob/master/src/sphinx_book_theme/theme/sphinx_book_theme/macros/buttons.html
to remove the light/dark theme switcher button
Copy link
Member

Choose a reason for hiding this comment

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

why to remove light/data theme button?

Copy link
Member Author

Choose a reason for hiding this comment

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

because the doxygen API doesn't work with it. The doxygen thing will not change entirely, so there are always some blocks which are light colored.

Copy link
Member

Choose a reason for hiding this comment

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

I see. I am using dark theme. It hurts my eyes in some api pages like the following. I will not ask the changes about the style in this PR, but this will be definitely changed by setting background/font-color always or finding a color theme can fit dark/light theme well
image

Copy link
Member Author

Choose a reason for hiding this comment

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

This image is exactly the issue I mentioned. I have no idea how to fix those white blocks, so I would put this as an issue to fix later.

Copy link
Member

@pratikvn pratikvn Mar 31, 2025

Choose a reason for hiding this comment

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

Maybe we can change the Sphinx theme ? I prefer ones where both dark and light themes work well. Some themes which seem to be quite nice:

  1. https://sphinx-book-theme.readthedocs.io/en/stable/
  2. https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html

In particular, the PyData seems nice, because it has support for Jupyter extensions, which could be useful for us.

Copy link
Member Author

Choose a reason for hiding this comment

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

The current theme is sphinx-book. Because of doxysphinx, we are limited to the sphinx themes supported by them: https://boschglobal.github.io/doxysphinx/#caveats.
The issue with the light/dark theme isn't due to the sphinx theme, it's due to doxygen. I'm sure it's possible to get it working, but I don't have it on my priority list.

Copy link
Member

Choose a reason for hiding this comment

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

Honestly, I am not sure how useful the detailed doxygen documentation is. It might be better to not have the complete class/namespace list, but only focus on specific user-facing API and integrate it in the Sphinx documentation through breathe: https://breathe.readthedocs.io/en/latest/

Copy link
Member Author

Choose a reason for hiding this comment

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

Breathe makes the doxygen API available as sphinx docs, which has the advantage of simpler integration, but the generated formatting of C++ API is just plain horrible. Since Sphinx is python focus it doesn't care about parameter types, so types aren't aligned for multi-line function signatures.

#}

{% from "sphinx_book_theme/macros/buttons.html" import render_funcs with context %}

<div class="article-header-buttons">
{%- for button in header_buttons -%}
{% set btype = button.get("type") %}
{% set bopts = button.copy() %}
{% set _ = bopts.pop("type") %}
{{ render_funcs[btype](**bopts) }}
{%- endfor -%}

{#- Extra theme buttons #}
{% include "search-button.html" %}
{% include "toggle-secondary-sidebar.html" %}
</div>
88 changes: 88 additions & 0 deletions doc/conf.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import datetime

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Ginkgo'
copyright = f'{datetime.date.today().year}, The Ginkgo Authors'
author = 'The Ginkgo Authors'
release = '@Ginkgo_VERSION@'
Copy link
Member

Choose a reason for hiding this comment

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

maybe need the version tag to distinguish develop/release?


# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.autosectionlabel',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx_sitemap',
'sphinx.ext.inheritance_diagram',
'sphinxcontrib.doxylink',
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

highlight_language = 'c++'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_static_path = ['_static']
html_css_files = ['css/custom.css']
html_theme = 'sphinx_book_theme'
html_theme_options = {
'repository_url': 'https://github.com/ginkgo-project/ginkgo/',
'use_repository_button': True,
'use_fullscreen_button': True,
'use_download_button': False,
# remove the light/dark mode switcher as it doesn't work properly on doxygen pages
"article_header_end": ["article-header-buttons"]
}
html_logo = '@Ginkgo_SOURCE_DIR@/assets/logo.png'
html_favicon = '@Ginkgo_SOURCE_DIR@/assets/favicon.ico'
html_title = f'{project} v{release}'

# Define the canonical URL if you are using a custom domain on Read the Docs
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")

read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'

# Tell Jinja2 templates the build is running on Read the Docs
if read_the_docs_build:
if "html_context" not in globals():
html_context = {}
html_context["READTHEDOCS"] = True


# -- MyST configuration -------------------------------------------------------
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html

myst_enable_extensions = [
"amsmath",
"colon_fence",
"deflist",
"dollarmath",
"linkify",
"replacements",
"smartquotes"
]
myst_heading_anchors = 3

# -- doxylink configuration -------------------------------------------------
# https://sphinxcontrib-doxylink.readthedocs.io/en/stable/#

doxylink = {
'doxy': ('@Ginkgo_BINARY_DIR@/doc/doxygen/html/tagfile.xml', 'doxygen/html')
}
Loading
Loading