Skip to content

Commit 7be1af8

Browse files
Sphinx Documentation, First Pass (#113)
* Started documentation. * Documentation is beginning to work. * Documentation generator is working. * Began writing documentation. * Documentation is shaping up. * Making progress on writing documentation. * Adding environment configurations. * Added description of tests and benchmarks. * More progress on documentation. * Finished first pass of documentation. * Almost ready to deploy docs. * Reverted README for now. * Removed comments from workflow file. * Removed Makefile. * Reformatted. * Minor documentation updates. * Linted.
1 parent 5334cd8 commit 7be1af8

17 files changed

Lines changed: 623 additions & 43 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy documentation to Github Pages
2+
on:
3+
workflow_dispatch:
4+
5+
permissions: write-all
6+
7+
concurrency:
8+
group: "pages"
9+
cancel-in-progress: false
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Setup Pages
18+
uses: actions/configure-pages@v3
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.10"
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install sphinx furo
27+
- name: Build website
28+
run: |
29+
sphinx-build -M dirhtml docs docs/_build
30+
31+
- name: Fix permissions
32+
run: |
33+
chmod -c -R +rX "docs/_build/dirhtml/" | while read line; do
34+
echo "::warning title=Invalid file permissions automatically fixed::$line"
35+
done
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: './docs/_build/dirhtml'
40+
deploy:
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
runs-on: ubuntu-latest
45+
needs: build
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ experimental/*
1616
MACE_models/*
1717
triton_autotuning/*
1818
sandbox/*
19+
docs/_build
20+
docs/_static
21+
docs/_templates
1922

2023
# bash scripts
2124
get_gpu_node.sh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,4 @@ Copyright (c) 2025, The Regents of the University of California, through Lawrenc
348348

349349
If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at IPO@lbl.gov.
350350

351-
NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.
351+
NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.

docs/api.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
OpenEquivariance API
2+
==============================
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
:caption: Contents:
7+
8+
OpenEquivariance exposes two key classes: :py:class:`openequivariance.TensorProduct`, which replaces
9+
``o3.TensorProduct`` from e3nn, and :py:class:`openequivariance.TensorProductConv`, which fuses
10+
the CG tensor product with a subsequent graph convolution. Initializing either class triggers
11+
JIT compilation of a custom kernel, which can take a few seconds.
12+
13+
Both classes require a configuration object specified
14+
by :py:class:`openequivariance.TPProblem`, which has a constructor
15+
almost identical to ``o3.TensorProduct``.
16+
We recommend reading the `e3nn documentation <https://docs.e3nn.org/en/latest/>`_ before
17+
trying our code. OpenEquivariance cannot accelerate all tensor products; see
18+
:doc:`this page </supported_ops>` for a list of supported configurations.
19+
20+
.. autoclass:: openequivariance.TensorProduct
21+
:members:
22+
:undoc-members:
23+
:exclude-members: name
24+
25+
.. autoclass:: openequivariance.TensorProductConv
26+
:members:
27+
:undoc-members:
28+
:exclude-members: name
29+
30+
.. autoclass:: openequivariance.TPProblem
31+
:members:
32+
:undoc-members:
33+
34+
.. autofunction:: openequivariance.torch_to_oeq_dtype
35+
36+
.. autofunction:: openequivariance.torch_ext_so_path
37+
38+
API Identical to e3nn
39+
---------------------
40+
41+
These remaining API members are identical to the corresponding
42+
objects in ``e3nn.o3``. You can freely mix these objects from
43+
both packages.
44+
45+
.. autoclass:: openequivariance.Irreps
46+
:members:
47+
:undoc-members:

docs/conf.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import sys
2+
from pathlib import Path
3+
4+
# Configuration file for the Sphinx documentation builder.
5+
#
6+
# For the full list of built-in configuration values, see the documentation:
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
8+
9+
# -- Project information -----------------------------------------------------
10+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
11+
12+
project = "OpenEquivariance"
13+
copyright = "2025, The Regents of the University of California, through Lawrence Berkeley National Laboratory."
14+
author = "Vivek Bharadwaj, Austin Glover, Aydin Buluc, James Demmel"
15+
16+
# -- General configuration ---------------------------------------------------
17+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
18+
19+
extensions = []
20+
21+
templates_path = ["_templates"]
22+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
23+
24+
25+
# -- Options for HTML output -------------------------------------------------
26+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
27+
28+
html_theme = "furo"
29+
# html_static_path = ["_static"]
30+
31+
extensions = [
32+
"sphinx.ext.autodoc",
33+
]
34+
35+
sys.path.insert(0, str(Path("..").resolve()))
36+
37+
autodoc_mock_imports = ["torch", "openequivariance.extlib", "jinja2"]
38+
autodoc_typehints = "description"

docs/index.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. OpenEquivariance documentation master file, created by
2+
sphinx-quickstart on Tue Jun 3 00:20:54 2025.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
OpenEquivariance
7+
==============================
8+
9+
OpenEquivariance is a CUDA and HIP kernel generator for the Clebsch-Gordon
10+
tensor product, a key kernel in equivariant graph neural networks. We offer
11+
an identical interface to e3nn and produce the same results
12+
(up to numerical roundoff). Our package exhibits up to an order of magnitude
13+
speedup over e3nn and competitive performance with NVIDIA's cuEquivariance.
14+
15+
Here, you can find our API reference, installation instructions,
16+
and troubleshooting guide. We support for both NVIDIA and AMD GPUs through
17+
our PyTorch interface, including support for JITScript compilation accessible
18+
from C++.
19+
20+
.. toctree::
21+
:maxdepth: 1
22+
:caption: Contents:
23+
24+
installation
25+
api
26+
supported_ops
27+
tests_and_benchmarks
28+
models

docs/installation.rst

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
Installation
2+
==============================
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
:caption: Contents:
7+
8+
You need the following to install OpenEquivariance:
9+
10+
- A Linux system equipped with an NVIDIA / AMD graphics card.
11+
- PyTorch >= 2.4 (>= 2.8 for AOTI and export).
12+
- GCC 9+ and the CUDA / HIP toolkit. The command
13+
``c++ --version`` should return >= 9.0; see below for details on
14+
setting an alternate compiler.
15+
16+
Installation is one easy command, followed by import verification:
17+
18+
.. code-block:: bash
19+
20+
pip install git+https://github.com/PASSIONLab/OpenEquivariance
21+
python -c "import openequivariance"
22+
23+
The second line triggers a build of the C++ extension we use to compile
24+
kernels, which can take a couple of minutes. Subsequent imports are
25+
much faster since this extension is cached.
26+
27+
28+
Compiling the Integrated PyTorch Extension
29+
------------------------------------------
30+
To support ``torch.compile``, ``torch.export``, and
31+
JITScript, OpenEquivariance needs to compile a C++ extension
32+
tightly integrated with PyTorch. If you see a warning that
33+
this extension could not be compiled, first check:
34+
35+
.. code-block:: bash
36+
37+
c++ --version
38+
39+
To build the extension with an alternate compiler, set the
40+
``CC`` and ``CXX``
41+
environment variable and retry the import:
42+
43+
.. code-block:: bash
44+
45+
export CCC=/path/to/your/gcc
46+
export CXX=/path/to/your/g++
47+
python -c "import openequivariance"
48+
49+
These configuration steps are required only ONCE after
50+
installation (or upgrade) with pip.
51+
52+
Configurations on Major Platforms
53+
---------------------------------
54+
OpenEquivariance has been tested on both supercomputers and lab clusters.
55+
Here are some tested environment configuration files. If use OpenEquivariance
56+
on a widely-used platform, send us a pull request to add your configuration!
57+
58+
NERSC Perlmutter (NVIDIA A100)
59+
""""""""""""""""""""""""""""""
60+
61+
.. code-block:: bash
62+
:caption: env.sh (last updated June 2024)
63+
64+
module load gcc
65+
module load conda
66+
67+
# Deactivate any base environments
68+
for i in $(seq ${CONDA_SHLVL}); do
69+
conda deactivate
70+
done
71+
72+
conda activate <your-conda-env>
73+
74+
75+
OLCF Frontier (AMD MI250x)
76+
""""""""""""""""""""""""""
77+
You need to install a HIP-enabled verison of PyTorch to use our package.
78+
To do this, follow the steps `here <https://docs.olcf.ornl.gov/software/analytics/pytorch_frontier.html>`_.
79+
80+
81+
.. code-block:: bash
82+
:caption: env.sh (last updated June 2024)
83+
84+
module load PrgEnv-gnu/8.6.0
85+
module load miniforge3/23.11.0-0
86+
module load rocm/6.4.0
87+
module load craype-accel-amd-gfx90a
88+
89+
for i in $(seq ${CONDA_SHLVL}); do
90+
conda deactivate
91+
done
92+
93+
conda activate <your-conda-env>
94+
export CC=cc
95+
export CXX=CC

docs/livebuild.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sphinx-autobuild -M dirhtml . _build --watch ../openequivariance

docs/models.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Running MACE and Nequip
2+
==============================
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
:caption: Contents:
7+
8+
MACE
9+
----
10+
11+
We have modified MACE to use our accelerated kernels instead
12+
of the standard e3nn backend. Here are the steps to replicate
13+
our MACE benchmark:
14+
15+
1. Install ``oeq`` and our modified version of MACE via
16+
17+
.. code-block:: bash
18+
19+
pip uninstall mace-torch
20+
pip install git+https://github.com/vbharadwaj-bk/mace_oeq_integration.git@oeq_experimental
21+
22+
2. Download the ``carbon.xyz`` data file, available at
23+
`<https://portal.nersc.gov/project/m1982/equivariant_nn_graphs/>`_.
24+
25+
This graph has 158K edges. With the original e3nn backend, you would need a GPU with 80GB
26+
of memory to run the experiments. ``oeq`` provides a memory-efficient equivariant convolution,
27+
so we expect the test to succeed.
28+
29+
3. Benchmark OpenEquivariance:
30+
31+
.. code-block:: bash
32+
33+
python tests/mace_driver.py carbon.xyz -o outputs/mace_tests -i oeq
34+
35+
4. If you have a GPU with 80GB of memory *or* supply a smaller molecular graph
36+
as the input file, you can run the full benchmark that includes ``e3nn`` and ``cue``:
37+
38+
.. code-block:: bash
39+
40+
python tests/mace_driver.py carbon.xyz -o outputs/mace_tests -i e3nn cue oeq
41+
42+
Nequip
43+
------
44+
See the
45+
`official Nequip documentation <https://nequip.readthedocs.io/en/latest/guide/accelerations/openequivariance.html>`_
46+
to use OpenEquivariance with Nequip.

0 commit comments

Comments
 (0)