Skip to content

Commit

Permalink
Docs and Docstrings (#383)
Browse files Browse the repository at this point in the history
* Move docs around and use automatic name from md

* Fix all seeds in GP tests

* Autodocs block + explainer

* Some tidying up

* Comments -> docstrings in BBCode

* Fix outdated docstring

* Some more tidying up + refactoring

* Improve docstring for binary zero_tangent

* More tidying up

* Bump patch version

* Fix broken doctest

* Fix docs build

* Improve wording

* Fix coverage

* Improve coverage
  • Loading branch information
willtebbutt authored Nov 21, 2024
1 parent 19dae92 commit eaf1fb8
Show file tree
Hide file tree
Showing 24 changed files with 468 additions and 244 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Mooncake"
uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
authors = ["Will Tebbutt, Hong Ge, and contributors"]
version = "0.4.47"
version = "0.4.48"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
22 changes: 13 additions & 9 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ makedocs(
),
)
),
size_threshold_ignore=[
joinpath("developer_documentation", "internal_docstrings.md"),
],
),
modules=[Mooncake],
checkdocs=:none,
Expand All @@ -28,20 +31,21 @@ makedocs(
pages = [
"Mooncake.jl" => "index.md",
"Understanding Mooncake.jl" => [
"Introduction" => "understanding_intro.md",
"Algorithmic Differentiation" => "algorithmic_differentiation.md",
"Mooncake.jl's Rule System" => "mathematical_interpretation.md",
joinpath("understanding_mooncake", "introduction.md"),
joinpath("understanding_mooncake", "algorithmic_differentiation.md"),
joinpath("understanding_mooncake", "rule_system.md"),
],
"Utilities" => [
"Tools for Rules" => "tools_for_rules.md",
"Debug Mode" => "debug_mode.md",
"Debugging and MWEs" => "debugging_and_mwes.md",
joinpath("utilities", "tools_for_rules.md"),
joinpath("utilities", "debug_mode.md"),
joinpath("utilities", "debugging_and_mwes.md"),
],
"Developer Documentation" => [
"Running Tests Locally" => "running_tests_locally.md",
"Developer Tools" => "developer_tools.md",
joinpath("developer_documentation", "running_tests_locally.md"),
joinpath("developer_documentation", "developer_tools.md"),
joinpath("developer_documentation", "internal_docstrings.md"),
],
"Known Limitations" => "known_limitations.md",
"known_limitations.md",
]
)

Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions docs/src/developer_documentation/internal_docstrings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Internal Docstrings

Docstrings listed here are _not_ part of the public Mooncake.jl interface.
Consequently, they can change between non-breaking changes to Mooncake.jl without warning.

The purpose of this is to make it easy for developers to find docstrings straightforwardly via the docs, as opposed to having to ctrl+f through Mooncake.jl's source code, or looking at the docstrings via the Julia REPL.

```@autodocs; canonical=false
Modules = [Mooncake]
Public = false
```
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mooncake.jl and Reverse-Mode AD
# Introduction

The point of Mooncake.jl is to perform reverse-mode algorithmic differentiation (AD).
The purpose of this section is to explain _what_ precisely is meant by this, and _how_ it can be interpreted mathematically.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Mooncake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ include("stack.jl")

include(joinpath("interpreter", "contexts.jl"))
include(joinpath("interpreter", "abstract_interpretation.jl"))
include(joinpath("interpreter", "bbcode.jl"))
include(joinpath("interpreter", "ir_utils.jl"))
include(joinpath("interpreter", "bbcode.jl"))
include(joinpath("interpreter", "ir_normalisation.jl"))
include(joinpath("interpreter", "zero_like_rdata.jl"))
include(joinpath("interpreter", "s2s_reverse_mode_ad.jl"))
Expand Down
4 changes: 2 additions & 2 deletions src/fwds_rvs_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,9 @@ Useful for implementation getfield-like rules for mutable structs, pointers, dic
increment_rdata!!(t::T, r) where {T} = tangent(fdata(t), increment!!(rdata(t), r))::T

"""
zero_tangent(p, ::NoFData)
zero_tangent(primal, fdata)
Equivalent to `tangent(fdata, rdata(zero_tangent(primal)))`.
"""
zero_tangent(p, ::NoFData) = zero_tangent(p)

Expand Down
6 changes: 5 additions & 1 deletion src/interpreter/abstract_interpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ MooncakeInterpreter() = MooncakeInterpreter(DefaultCtx)

context_type(::MooncakeInterpreter{C}) where {C} = C

# Globally cached interpreter. Should only be accessed via `get_interpreter`.
"""
const GLOBAL_INTERPRETER
Globally cached interpreter. Should only be accessed via `get_interpreter`.
"""
const GLOBAL_INTERPRETER = Ref(MooncakeInterpreter())

"""
Expand Down
Loading

2 comments on commit eaf1fb8

@willtebbutt
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/119884

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.48 -m "<description of version>" eaf1fb8a7885240656bc3b659ec0b11330fbb4c5
git push origin v0.4.48

Please sign in to comment.