Skip to content

Commit 30fada6

Browse files
Merge pull request #999 from lukaszstolarczuk/docs-change
Update docs content and process
2 parents 9dd2283 + c7fdc11 commit 30fada6

17 files changed

+110
-60
lines changed

.github/workflows/docs.yml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,14 @@ permissions:
1414
contents: read
1515

1616
jobs:
17-
build:
18-
name: Build docs
19-
runs-on: ${{ github.repository_owner == 'oneapi-src' && 'intel-ubuntu-22.04' || 'ubuntu-latest' }}
20-
21-
steps:
22-
- name: Checkout repository
23-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
24-
with:
25-
fetch-depth: 0
26-
27-
- name: Install doxygen
28-
run: |
29-
sudo apt-get update
30-
sudo apt-get install -y doxygen
31-
32-
# Latest distros do not allow global pip installation
33-
- name: Install Python requirements in venv
34-
run: |
35-
python3 -m venv .venv
36-
. .venv/bin/activate
37-
echo "$PATH" >> $GITHUB_PATH
38-
python3 -m pip install -r third_party/requirements.txt
39-
40-
- name: Setup PATH for python
41-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
42-
43-
- name: Build the documentation
44-
working-directory: scripts
45-
run: python3 generate_docs.py
46-
47-
- name: Upload artifact
48-
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0
49-
with:
50-
path: docs/html
17+
DocsBuild:
18+
uses: ./.github/workflows/reusable_docs_build.yml
19+
with:
20+
upload: true
5121

52-
deploy:
22+
DocsDeploy:
5323
name: Deploy docs to GitHub Pages
54-
needs: build
24+
needs: DocsBuild
5525

5626
permissions:
5727
pages: write

.github/workflows/reusable_docs_build.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Docs build
22

3-
on: workflow_call
3+
on:
4+
workflow_call:
5+
inputs:
6+
upload:
7+
description: Should HTML documentation be uploaded as artifact?
8+
type: boolean
9+
default: false
410

511
permissions:
612
contents: read
@@ -30,5 +36,17 @@ jobs:
3036
python3 -m pip install -r third_party/requirements.txt
3137
3238
- name: Build the documentation
33-
working-directory: scripts
34-
run: python3 generate_docs.py
39+
run: |
40+
cmake -B build \
41+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF \
42+
-DUMF_BUILD_CUDA_PROVIDER=OFF \
43+
-DUMF_BUILD_TESTS=OFF \
44+
-DUMF_BUILD_EXAMPLES=OFF \
45+
-DUMF_DISABLE_HWLOC=ON
46+
cmake --build build --target docs
47+
48+
- name: Upload artifact
49+
if: ${{ inputs.upload == true }}
50+
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0
51+
with:
52+
path: build/docs_build/generated/html

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ __pycache__/
5858
*.py[cod]
5959

6060
# Generated docs
61-
docs/
61+
docs_build/
6262

6363
# Build files
6464
/build*/

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,17 @@ if(UMF_FORMAT_CODE_STYLE)
760760
endif()
761761
endif()
762762

763+
find_package(Python3 3.8)
764+
if(Python3_FOUND)
765+
message(STATUS "Adding 'docs' target for creating a documentation.")
766+
add_custom_target(
767+
docs
768+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
769+
COMMAND ${Python3_EXECUTABLE}
770+
${UMF_CMAKE_SOURCE_DIR}/docs/generate_docs.py
771+
COMMENT "Generate HTML documentation using Doxygen")
772+
endif()
773+
763774
# --------------------------------------------------------------------------- #
764775
# Configure make install/uninstall and packages
765776
# --------------------------------------------------------------------------- #

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,16 @@ List of options provided by CMake:
122122

123123
## Architecture: memory pools and providers
124124

125-
A UMF memory pool is a combination of a pool allocator and a memory provider. A memory provider is responsible for coarse-grained memory allocations and management of memory pages, while the pool allocator controls memory pooling and handles fine-grained memory allocations.
125+
A UMF memory pool is a combination of a pool allocator and a memory provider. A memory provider is responsible for
126+
coarse-grained memory allocations and management of memory pages, while the pool allocator controls memory pooling
127+
and handles fine-grained memory allocations.
126128

127129
Pool allocator can leverage existing allocators (e.g. jemalloc or tbbmalloc) or be written from scratch.
128130

129-
UMF comes with predefined pool allocators (see include/pool) and providers (see include/provider). UMF can also work with user-defined pools and providers that implement a specific interface (see include/umf/memory_pool_ops.h and include/umf/memory_provider_ops.h).
131+
UMF comes with predefined pool allocators (see [`include/umf/pools`](include/umf/pools)) and providers
132+
(see [`include/umf/providers`](include/umf/providers)). UMF can also work with user-defined pools and
133+
providers that implement a specific interface (see [`include/umf/memory_pool_ops.h`](include/umf/memory_pool_ops.h)
134+
and [`include/umf/memory_provider_ops.h`](include/umf/memory_provider_ops.h)).
130135

131136
More detailed documentation is available here: https://oneapi-src.github.io/unified-memory-framework/
132137

@@ -152,6 +157,7 @@ a duplicate of another process's file descriptor (`pidfd_getfd(2)` is supported
152157
Permission to duplicate another process's file descriptor is governed by a ptrace access mode
153158
`PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`) that can be changed using
154159
the `/proc/sys/kernel/yama/ptrace_scope` interface in the following way:
160+
155161
```sh
156162
$ sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
157163
```
@@ -183,6 +189,7 @@ a duplicate of another process's file descriptor (`pidfd_getfd(2)` is supported
183189
Permission to duplicate another process's file descriptor is governed by a ptrace access mode
184190
`PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`) that can be changed using
185191
the `/proc/sys/kernel/yama/ptrace_scope` interface in the following way:
192+
186193
```sh
187194
$ sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
188195
```
@@ -203,7 +210,7 @@ Additionally, required for tests:
203210

204211
#### DevDax memory provider (Linux only)
205212

206-
A memory provider that provides memory from a device DAX (a character device file /dev/daxX.Y).
213+
A memory provider that provides memory from a device DAX (a character device file like `/dev/daxX.Y`).
207214
It can be used when large memory mappings are needed.
208215

209216
##### Requirements
@@ -249,8 +256,6 @@ This memory pool is distributed as part of libumf. It forwards all requests to t
249256
memory provider. Currently umfPoolRealloc, umfPoolCalloc and umfPoolMallocUsableSize functions
250257
are not supported by the proxy pool.
251258

252-
To enable this feature, the `UMF_BUILD_SHARED_LIBRARY` option needs to be turned `ON`.
253-
254259
#### Disjoint pool
255260

256261
TODO: Add a description
@@ -326,6 +331,8 @@ Querying the latency value requires HMAT support on the platform. Calling `umfMe
326331
UMF provides the UMF proxy library (`umf_proxy`) that makes it possible
327332
to override the default allocator in other programs in both Linux and Windows.
328333

334+
To enable this feature, the `UMF_BUILD_SHARED_LIBRARY` option needs to be turned `ON`.
335+
329336
#### Linux
330337

331338
In case of Linux it can be done without any code changes using the `LD_PRELOAD` environment variable:

RELEASE_STEPS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Do changes for a release:
4141
- For major releases mention API and ABI compatibility with the previous release
4242
- Update project's version in a few places:
4343
- For major and minor releases: `UMF_VERSION_CURRENT` in `include/umf/base.h` (the API version)
44-
- `release` variable in `scripts/docs_config/conf.py` (for docs)
44+
- `release` variable in `docs/config/conf.py` (for docs)
4545
- `UMF_VERSION` variable in `.github/workflows/reusable_basic.yml` (for installation test)
4646
- For major releases update ABI version in `.map` and `.def` files
4747
- These files are defined for all public libraries (`libumf` and `proxy_lib`, at the moment)

docs/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Documentation
2+
3+
To generate HTML documentation run the `generate_docs.py` script from any sub-dir of the
4+
repository (most likely `build`) or enable and use build target 'docs' (see details below).
5+
6+
This script will create `./docs_build` sub-directory, where the intermediate and final files
7+
will be created. HTML docs will be in the `./docs_build/generated/html` directory.
8+
9+
## make docs
10+
11+
To run documentation generation via build target use CMake commands below.
12+
To enable this target, python executable (in required version) has to be found in the system.
13+
14+
```bash
15+
$ cmake -B build
16+
$ cmake --build build --target docs
17+
```
18+
19+
## Requirements
20+
21+
Script to generate HTML docs requires:
22+
* [Doxygen](http://www.doxygen.nl/) at least v1.9.1
23+
* [Python](https://www.python.org/downloads/) at least v3.8
24+
* and python pip requirements, as defined in `third_party/requirements.txt`

scripts/docs_config/Doxyfile renamed to docs/config/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ GENERATE_XML = YES
20582058
# The default directory is: xml.
20592059
# This tag requires that the tag GENERATE_XML is set to YES.
20602060

2061-
XML_OUTPUT = ../docs/xml
2061+
XML_OUTPUT = docs_build/doxyxml
20622062

20632063
# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
20642064
# listings (including syntax highlighting and cross-referencing information) to

scripts/docs_config/api.rst renamed to docs/config/api.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ supported by the Proxy Pool.
5858

5959
Scalable Pool
6060
------------------------------------------
61+
62+
A oneTBB-based memory pool manager.
63+
6164
.. doxygenfile:: pool_scalable.h
6265
:sections: define enum typedef func var
6366

@@ -104,10 +107,18 @@ A memory provider that provides memory from L0 device.
104107
.. doxygenfile:: provider_level_zero.h
105108
:sections: define enum typedef func var
106109

110+
CUDA Provider
111+
------------------------------------------
112+
113+
A memory provider that provides memory from CUDA device.
114+
115+
.. doxygenfile:: provider_cuda.h
116+
:sections: define enum typedef func var
117+
107118
DevDax Memory Provider
108119
------------------------------------------
109120

110-
A memory provider that provides memory from a device DAX (a character device file /dev/daxX.Y).
121+
A memory provider that provides memory from a device DAX (a character device file like /dev/daxX.Y).
111122

112123
.. doxygenfile:: provider_devdax_memory.h
113124
:sections: define enum typedef func var

scripts/docs_config/conf.py renamed to docs/config/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
# -- Extension configuration -------------------------------------------------
5050

5151
# -- Options for breathe extension -------------------------------------------
52-
breathe_projects = {project: "../../docs/xml"}
52+
# 'doxyxml' dir is generated with Doxygen; it's supposed to be in a directory
53+
# one above the config directory.
54+
breathe_projects = {project: "../doxyxml"}
5355
breathe_default_project = project
5456
breathe_show_include = False
5557
breathe_default_members = ("members", "undoc-members")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/generate_docs.py renamed to docs/generate_docs.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@
66
"""
77

88
from pathlib import Path
9-
from shutil import rmtree
9+
from shutil import rmtree, copytree
1010
import subprocess # nosec B404
1111
import time
1212

1313

1414
def _check_cwd() -> None:
15-
script_path = Path(__file__).resolve().parent
1615
cwd = Path.cwd()
17-
if script_path != cwd:
16+
include_dir = Path(cwd, "../include")
17+
# Verify if include dir is one level up (as defined in Doxyfile)
18+
if not include_dir.exists():
1819
print(
19-
f"{__file__} script has to be run from the 'scripts' directory. Terminating..."
20+
f"Include directory {include_dir.resolve()} not found! "
21+
"Please run this script from <repo_root_dir>/build!",
22+
flush=True,
2023
)
2124
exit(1)
2225

@@ -66,8 +69,17 @@ def _generate_html(config_path: Path, docs_path: Path) -> None:
6669

6770
def main() -> None:
6871
_check_cwd()
69-
config_path = Path("docs_config").resolve()
70-
docs_path = Path("..", "docs").resolve()
72+
73+
script_dir = Path(__file__).resolve().parent
74+
docs_build_path = Path("docs_build").resolve()
75+
76+
# Sphinx and breathe require access to a Doxygen generated dir ('doxyxml')
77+
# so we copy the whole content of the 'docs' dir to the build dir.
78+
copytree(Path(script_dir), docs_build_path, dirs_exist_ok=True)
79+
80+
config_path = Path(docs_build_path, "config").resolve()
81+
docs_path = Path(docs_build_path, "generated").resolve()
82+
7183
start = time.time()
7284
_prepare_docs_dir(docs_path)
7385
_generate_xml(config_path, docs_path)

scripts/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)