Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Jan 9, 2025
1 parent 0a9bb8c commit 9ebe1a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
# Build the book
- name: Build the book
run: |
jupyter-book build array-oriented-programming
jupyter-book build -W array-oriented-programming
# Upload the book's HTML as an artifact
- name: Upload artifact
Expand Down
5 changes: 3 additions & 2 deletions array-oriented-programming/4-scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ quadratic_formula_c.run(ptr(a), ptr(b), ptr(c), ptr(output))
output = (-b + np.sqrt(b**2 - 4*a*c)) / (2*a)
```

The corresponding formula in NumPy is about 3× slower.
The corresponding formula in NumPy is about 2× slower.

Hidden in the NumPy expression are intermediate arrays: each operation creates a new array, and most of them are only needed temporarily. The above is roughly equivalent to this:

Expand All @@ -154,7 +154,7 @@ tmp8 = np.multiply(2, a) # 2*a
np.divide(tmp7, tmp8) # tmp7 / tmp8 This is the result!
```

("Roughly" because NumPy attempts to "fuse" some operations to avoid intermediate arrays, which accounts for this 30% difference in speed. But the 3× faster C function is completely "fused".)
("Roughly" because NumPy attempts to "fuse" some operations to avoid intermediate arrays, which accounts for this small difference in speed. But the 2× faster C function is completely "fused".)

Remember, though, that NumPy is hundreds of times faster than a Python `for` loop,

Expand Down Expand Up @@ -792,6 +792,7 @@ In addition to the collection types listed above, there is a [dask-awkward](http
```{code-cell} ipython3
import uproot
import awkward as ak
import dask_awkward as dak
```

```{code-cell} ipython3
Expand Down
10 changes: 8 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ dependencies:
- particle

# compilers
- numba
- pybind11
- clang-tools
- cxx-compiler
- pybind11
- numba
- jax

# distributed computing
- dask
- distributed
- dask-awkward

0 comments on commit 9ebe1a5

Please sign in to comment.