Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: how to accelerate awkward arrays with cppyy #2334

Merged
merged 22 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
58 changes: 55 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

env:
X86_64_PYTHON_VERSION: "3.10.6"
X86_64_PYTHON_VERSION: "3.11.0"
SOURCE_DATE_EPOCH: "1668811211"

jobs:
Expand Down Expand Up @@ -67,7 +67,6 @@ jobs:
with:
submodules: true


- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -193,9 +192,56 @@ jobs:
name: awkward
path: dist/awkward*.whl

execute-cppyy:
needs: [awkward-cpp-x86-64, awkward]
runs-on: ubuntu-22.04
name: Execute cppyy notebook
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "${{ env.X86_64_PYTHON_VERSION }}"

- name: Extract pre-built manylinux cppyy wheels
uses: shrink/actions-docker-extract@v3
with:
image: "docker.io/agoose77/cppyy-wheels:cp311"
path: "/wheels/."
destination: "/tmp/wheels/"

- name: Download awkward wheel
uses: actions/download-artifact@v3
with:
name: awkward
path: /tmp/wheels/

- name: Download awkward-cpp x86_64 wheel
uses: actions/download-artifact@v3
with:
name: awkward-cpp-x86-64
path: /tmp/wheels/

- name: Install dependencies
working-directory: docs
run: python -m pip install /tmp/wheels/*.whl -r requirements.txt

- name: Execute cppyy notebook
working-directory: docs
run: jupyter nbconvert --to notebook --execute --inplace user-guide/how-to-use-in-cpp-cppyy.ipynb

- name: Save executed notebook
uses: actions/upload-artifact@v3
with:
name: how-to-use-in-cpp-cppyy
path: docs/user-guide/how-to-use-in-cpp-cppyy.ipynb

build-docs:
runs-on: ubuntu-22.04
needs: [awkward-cpp-wasm, awkward-cpp-x86-64, awkward]
needs: [awkward-cpp-wasm, awkward-cpp-x86-64, awkward, execute-cppyy]
name: Build Docs
defaults:
run:
Expand Down Expand Up @@ -275,6 +321,12 @@ jobs:
run: |
echo "DOCS_VERSION=main" >> $GITHUB_ENV

- name: Download cppyy notebook
uses: actions/download-artifact@v3
with:
name: how-to-use-in-cpp-cppyy
path: docs/user-guide

- name: Generate Python documentation
run: sphinx-build -M html . _build/ -T
working-directory: docs
Expand Down
63 changes: 56 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,6 @@ jobs:
if: matrix.python-version == '3.9'

Linux-ROOT-dask-awkward:
strategy:
matrix:
python-version:
- '3.8'

runs-on: ubuntu-20.04

env:
Expand All @@ -296,7 +291,7 @@ jobs:
cache-environment: true
environment-name: awkward
create-args: >-
python=${{ env.PYTHON_VERSION }}
python=3.8
numpy
root

Expand All @@ -308,7 +303,7 @@ jobs:
uses: actions/cache@v3
with:
path: ./awkward-cpp/dist
key: ${{ github.job }}-${{ matrix.python-version }}-${{ hashFiles('awkward-cpp/**') }}
key: ${{ github.job }}-${{ hashFiles('awkward-cpp/**') }}

- name: Build awkward-cpp wheel
if: steps.cache-awkward-cpp-wheel.outputs.cache-hit != 'true'
Expand All @@ -329,3 +324,57 @@ jobs:

- name: Test
run: python -m pytest -vv -rs tests

Linux-cppyy:
# TODO: remove this part of the workflow
# cppyy is not yet released. Let's load some pre-built wheels via docker (as a binary store)
runs-on: ubuntu-22.04

env:
PIP_ONLY_BINARY: cmake

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: 'Python ${{ matrix.python-version }}'
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Generate build files
run: pipx run nox -s prepare -- --headers --signatures --tests

- name: Cache awkward-cpp wheel
id: cache-awkward-cpp-wheel
uses: actions/cache@v3
with:
path: ./awkward-cpp/dist
key: ${{ github.job }}-${{ hashFiles('awkward-cpp/**') }}

- name: Build awkward-cpp wheel
if: steps.cache-awkward-cpp-wheel.outputs.cache-hit != 'true'
run: |
python -m pip install build
python -m build -w ./awkward-cpp

- name: Extract pre-built manylinux cppyy wheels
uses: shrink/actions-docker-extract@v3
with:
image: "docker.io/agoose77/cppyy-wheels:cp311"
path: "/wheels/."
destination: "/tmp/cppyy-wheels"

- name: Install awkward, awkward-cpp, and dependencies
run: >-
python -m pip install --only-binary "numpy,pandas,pyarrow,numexpr"
-v . ./awkward-cpp/dist/*.whl
pytest-github-actions-annotate-failures
/tmp/cppyy-wheels/*

- name: Print versions
run: python -m pip list

- name: Test
run: python -m pytest -vv -rs tests -k cppyy
11 changes: 9 additions & 2 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ subtrees:
- file: user-guide/how-to-use-in-numba-cuda
title: "Working with CUDA"

- file: user-guide/how-to-use-in-cpp
title: "Using arrays in C++"
subtrees:
- entries:
- file: user-guide/how-to-use-header-only-layoutbuilder
title: "Building Awkward Arrays in C++ with LayoutBuilder"
- file: user-guide/how-to-use-in-cpp-cppyy
title: "JIT compiling operations with C++ in cppyy"

- file: user-guide/how-to-specialize
title: "Specialized behavior"
subtrees:
Expand All @@ -167,7 +176,5 @@ subtrees:
title: "For physics: Lorentz vectors [todo]"
- file: user-guide/how-to-specialize-differentiate-jax
title: "Differentiation using JAX"
- file: user-guide/how-to-use-header-only-layoutbuilder
title: "Building Awkward Arrays in C++"

- file: reference/index
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@
if not run_cuda_notebooks:
nb_execution_excludepatterns = [
# We have no CUDA executors, so disable this
"user-guide/how-to-use-in-numba-cuda.ipynb"
"user-guide/how-to-use-in-numba-cuda.ipynb",
# We have no cppyy 3.0.1 yet, so disable this
"user-guide/how-to-use-in-cpp-cppyy.ipynb",
]

# Additional stuff
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements-wasm.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyodide-build==0.23.3
pydantic<2
pydantic<2
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# JupyterLite (kernel requires specific pyodide version)
jupyterlite-pyodide-kernel==0.0.8
jupyterlite-pyodide-kernel==0.1.0
jupyterlite[piplite]==0.1.0
jupyterlite-sphinx==0.8.0

Expand Down
Loading