Skip to content

Commit 8c62bec

Browse files
sekyondaMetafacebook-github-bot
authored andcommitted
Rust API build (#814)
Summary: API docs build update. Setting up the API docs build Pull Request resolved: #814 Reviewed By: johnwhumphreys Differential Revision: D80132618 Pulled By: sekyondaMeta fbshipit-source-id: 451bde3b1e48411b5d6eb8b7722ce0c23e41d9ab
1 parent 583dad6 commit 8c62bec

File tree

2 files changed

+93
-83
lines changed

2 files changed

+93
-83
lines changed

.github/workflows/doc_build.yml

Lines changed: 64 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,70 @@ on:
55
branches:
66
- main
77
pull_request:
8+
workflow_dispatch:
89

910
concurrency:
1011
group: docs-${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }}
1112
cancel-in-progress: true
1213

1314
jobs:
14-
build:
15-
name: Build Documentation
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
22-
submodules: recursive
15+
build-and-deploy:
16+
name: Build and Deploy Documentation
17+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
18+
with:
19+
timeout: 120
20+
runner: linux.g5.4xlarge.nvidia.gpu
21+
gpu-arch-type: cuda
22+
gpu-arch-version: "12.6"
23+
submodules: recursive
24+
upload-artifact: docs
25+
script: |
26+
# Source common setup functions
27+
source scripts/common-setup.sh
2328
24-
- name: Setup Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: "3.10"
28-
architecture: x64
29+
# Setup build environment (conda + system deps + rust + build deps)
30+
setup_build_environment
2931
30-
- name: Setup Rust
31-
uses: dtolnay/rust-toolchain@nightly
32-
with:
33-
components: rustfmt, clippy
34-
35-
- name: Install system dependencies
36-
run: |
37-
sudo apt-get update
38-
sudo apt-get install -y libunwind-dev
39-
40-
- name: Install Python dependencies
41-
run: |
42-
python -m pip install --upgrade pip
43-
pip install -r build-requirements.txt
44-
pip install -r docs/requirements.txt
45-
46-
- name: Generate Rust API Documentation
47-
run: |
48-
# Set environment variables for CPU-only build
49-
export USE_CUDA=0
50-
export USE_TENSOR_ENGINE=0
51-
export RUSTFLAGS="-Zthreads=16"
52-
export _GLIBCXX_USE_CXX11_ABI=1
53-
54-
# Generate documentation for specific crates that don't depend on CUDA
55-
cargo doc --no-deps -p hyperactor -p hyperactor_macros -p hyperactor_multiprocess -p hyperactor_mesh -p hyperactor_mesh_macros
56-
57-
# Create an index.html file in the target/doc directory to serve as the main entry point
58-
echo '<meta http-equiv="refresh" content="0; url=hyperactor/index.html">' > target/doc/index.html
59-
60-
# Ensure the target/doc directory exists in the expected location for Sphinx
61-
mkdir -p docs/source/target
62-
cp -r target/doc docs/source/target/
63-
64-
- name: Build Sphinx Docs
65-
working-directory: docs
66-
run: |
67-
make html
32+
# Setup Tensor Engine
33+
setup_tensor_engine
6834
69-
- name: Upload Pages artifact
70-
uses: actions/upload-pages-artifact@v3
71-
with:
72-
path: docs/build/html
35+
# Build the process allocator binary
36+
build_process_allocator
37+
38+
# Setup Python dependencies
39+
python -m pip install --upgrade pip
40+
pip install -r build-requirements.txt
41+
pip install -r docs/requirements.txt
42+
43+
# Install PyTorch with CUDA support (matching build-cuda.yml)
44+
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu126
45+
46+
# Set environment variables for CUDA build
47+
export USE_CUDA=1
48+
export USE_TENSOR_ENGINE=1
49+
export RUSTFLAGS="-Zthreads=16"
50+
export _GLIBCXX_USE_CXX11_ABI=1
51+
export CUDA_LIB_DIR=/usr/lib64
52+
53+
# Generate documentation for all workspace crates
54+
cargo doc --workspace --no-deps
55+
56+
# Prepare documentation structure for Sphinx and final output
57+
mkdir -p docs/source/target docs/build/html/rust-api
58+
cp -r target/doc docs/source/target/
59+
60+
# Build Sphinx documentation
61+
cd docs && make html && cd ..
62+
63+
# Copy Rust API docs to final location
64+
cp -r target/doc/* docs/build/html/rust-api/
65+
66+
# Copy documentation to artifact directory
67+
mkdir -p ${RUNNER_ARTIFACT_DIR}
68+
cp -r docs/build/html ${RUNNER_ARTIFACT_DIR}/docs-html
7369
7470
deploy:
75-
needs: build
71+
needs: build-and-deploy
7672
if: github.ref == 'refs/heads/main'
7773
permissions:
7874
pages: write
@@ -82,6 +78,17 @@ jobs:
8278
url: ${{ steps.deployment.outputs.page_url }}
8379
runs-on: ubuntu-latest
8480
steps:
81+
- name: Download build artifact
82+
uses: actions/download-artifact@v4
83+
with:
84+
name: docs
85+
path: .
86+
87+
- name: Upload Pages artifact
88+
uses: actions/upload-pages-artifact@v3
89+
with:
90+
path: docs-html
91+
8592
- name: Deploy to GitHub Pages
8693
id: deployment
8794
uses: actions/deploy-pages@v4

docs/source/rust-api.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,41 @@
22

33
This page provides access to the Rust API documentation for Monarch.
44

5-
The Rust API documentation is automatically generated from the source code using Rustdoc.
5+
The Monarch project consists of several Rust crates, each with specialized functionality:
66

7+
### Core Framework
8+
- <a id="link-hyperactor" href="rust-api/hyperactor/index.html">**hyperactor**</a><span id="desc-hyperactor"> - Core actor framework for distributed computing</span>
9+
- <a id="link-hyperactor_macros" href="rust-api/hyperactor_macros/index.html">**hyperactor_macros**</a><span id="desc-hyperactor_macros"> - Procedural macros for the hyperactor framework</span>
10+
- <a id="link-hyperactor_multiprocess" href="rust-api/hyperactor_multiprocess/index.html">**hyperactor_multiprocess**</a><span id="desc-hyperactor_multiprocess"> - Multi-process support for hyperactor</span>
11+
- <a id="link-hyperactor_mesh" href="rust-api/hyperactor_mesh/index.html">**hyperactor_mesh**</a><span id="desc-hyperactor_mesh"> - Mesh networking for hyperactor clusters</span>
12+
- <a id="link-hyperactor_mesh_macros" href="rust-api/hyperactor_mesh_macros/index.html">**hyperactor_mesh_macros**</a><span id="desc-hyperactor_mesh_macros"> - Macros for hyperactor mesh functionality</span>
713

8-
## Accessing the Rust API Documentation
14+
### CUDA and GPU Computing
15+
- <a id="link-cuda-sys" href="rust-api/cuda_sys/index.html">**cuda-sys**</a><span id="desc-cuda-sys"> - Low-level CUDA FFI bindings</span>
16+
- <a id="link-nccl-sys" href="rust-api/nccl_sys/index.html">**nccl-sys**</a><span id="desc-nccl-sys"> - NCCL (NVIDIA Collective Communications Library) bindings</span>
17+
- <a id="link-torch-sys" href="rust-api/torch_sys/index.html">**torch-sys**</a><span id="desc-torch-sys"> - PyTorch C++ API bindings for Rust</span>
18+
- <a id="link-monarch_tensor_worker" href="rust-api/monarch_tensor_worker/index.html">**monarch_tensor_worker**</a><span id="desc-monarch_tensor_worker"> - High-performance tensor processing worker</span>
919

10-
You can access the full Rust API documentation here:
20+
### RDMA and High-Performance Networking
21+
- <a id="link-monarch_rdma" href="rust-api/monarch_rdma/index.html">**monarch_rdma**</a><span id="desc-monarch_rdma"> - Remote Direct Memory Access (RDMA) support for high-speed networking</span>
22+
- <a id="link-rdmaxcel-sys" href="rust-api/rdmaxcel_sys/index.html">**rdmaxcel-sys**</a><span id="desc-rdmaxcel-sys"> - Low-level RDMA acceleration bindings</span>
1123

12-
<a href="../index.html" class="btn btn-primary">View Rust API Documentation</a>
24+
### System and Utilities
25+
- <a id="link-controller" href="rust-api/controller/index.html">**controller**</a><span id="desc-controller"> - System controller and orchestration</span>
26+
- <a id="link-hyper" href="rust-api/hyper/index.html">**hyper**</a><span id="desc-hyper"> - HTTP utilities and web service support</span>
27+
- <a id="link-ndslice" href="rust-api/ndslice/index.html">**ndslice**</a><span id="desc-ndslice"> - N-dimensional array slicing and manipulation</span>
28+
- <a id="link-monarch_extension" href="rust-api/monarch_extension/index.html">**monarch_extension**</a><span id="desc-monarch_extension"> - Python extension module for Monarch functionality</span>
1329

14-
<script>
15-
// Check if the help.html file exists
16-
fetch('../index.html')
17-
.then(response => {
18-
if (!response.ok) {
19-
// If the file doesn't exist, try a different path
20-
document.querySelector('a[href="../index.html"]').href = './index.html';
21-
}
22-
})
23-
.catch(error => {
24-
// If there's an error, try a different path
25-
document.querySelector('a[href="../index.html"]').href = './index.html';
26-
});
27-
</script>
30+
<!-- Static links are shown by default since documentation exists -->
2831

32+
## Architecture Overview
2933

30-
## Key Modules
34+
The Rust implementation provides a comprehensive framework for distributed computing with GPU acceleration:
3135

32-
The Rust implementation includes several key modules:
36+
- **Actor Model**: Built on the hyperactor framework for concurrent, distributed processing
37+
- **GPU Integration**: Native CUDA support for high-performance computing workloads
38+
- **Mesh Networking**: Efficient communication between distributed nodes
39+
- **Tensor Operations**: Optimized tensor processing with PyTorch integration
40+
- **Multi-dimensional Arrays**: Advanced slicing and manipulation of n-dimensional data
3341

34-
- **Core**: Core functionality and data structures
35-
- **Runtime**: The execution runtime for distributed operations
36-
- **Communication**: Network communication primitives
37-
- **Serialization**: Data serialization and deserialization utilities
38-
39-
For complete details on all modules, classes, and functions, please refer to the full API documentation linked above.
42+
For complete technical details, API references, and usage examples, explore the individual crate documentation above.

0 commit comments

Comments
 (0)