Skip to content

Commit

Permalink
More doc improvements: simplify getting started page (#629)
Browse files Browse the repository at this point in the history
* Simplify getting started page

* Move slides to articles page
  • Loading branch information
tomwhite authored Nov 28, 2024
1 parent 4bc8517 commit 8781b5f
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 83 deletions.
8 changes: 4 additions & 4 deletions docs/articles.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Articles
# Articles and Presentations

[Cubed: Bounded-memory serverless array processing in xarray](https://xarray.dev/blog/cubed-xarray)

[Optimizing Cubed](https://medium.com/pangeo/optimizing-cubed-7a0b8f65f5b7)
- [Cubed: an introduction](https://cubed-dev.github.io/cubed/cubed-intro.slides.html) by Tom White, November 2024
- [Optimizing Cubed](https://medium.com/pangeo/optimizing-cubed-7a0b8f65f5b7) by Tom White, April 3, 2024
- [Cubed: Bounded-memory serverless array processing in xarray](https://xarray.dev/blog/cubed-xarray) by Tom Nicholas and Tom White, June 28th, 2023
61 changes: 61 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Getting Started

We'll start with a simple example that runs locally.

## Installation

Install Cubed with pip:

```shell
pip install cubed
```

This installs a minimal set of dependencies for running Cubed, which is sufficient for the demo below. You can also install the `diagnostics` extra package, which is needed for later examples to provide things like progress bars and visualizations of the computation:

```shell
pip install "cubed[diagnostics]"
```

Alternatively, you can install Cubed with Conda (note that this doesn't include the packages for diagnostics):

```shell
conda install -c conda-forge cubed
```

## Demo

First, we'll create a small array `a`:

```python
import cubed
import cubed.array_api as xp
spec = cubed.Spec(work_dir="tmp", allowed_mem="100kB")
a = xp.asarray([[1, 2, 3], [4, 5, 6], [7, 8, 9]], chunks=(2, 2), spec=spec)
```

Cubed implements the [Python Array API standard](https://data-apis.org/array-api/latest/), which is essentially a subset of NumPy, and is imported as `xp` by convention.

Notice that we also specify chunks, just like in Dask Array, and a {py:class}`Spec <cubed.Spec>` object that describes the resources available to run computations.

Next we create another array `b` and add to two array together to get `c`.

```python
b = xp.asarray([[1, 1, 1], [1, 1, 1], [1, 1, 1]], chunks=(2, 2), spec=spec)
c = xp.add(a, b)
```

Cubed uses lazy evaluation, so nothing has been computed yet.

```python
c.compute()
```

This runs the computation using the (default) local Python executor and prints the result (if run interactively):

```
array([[ 2, 3, 4],
[ 5, 6, 7],
[ 8, 9, 10]])
```

That's it! For your next step you can read the [user guide](user-guide/index.md), have a look at [configuration](configuration.md) options, or see more [examples](https://github.com/cubed-dev/cubed/blob/main/examples/README.md) to run locally or in the cloud.
35 changes: 0 additions & 35 deletions docs/getting-started/demo.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/getting-started/index.md

This file was deleted.

28 changes: 0 additions & 28 deletions docs/getting-started/installation.md

This file was deleted.

3 changes: 1 addition & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ Cubed is horizontally scalable and stateless, and can scale to multi-TB datasets
:hidden:
:maxdepth: 2
:caption: For users
getting-started/index
getting-started
user-guide/index
Intro slides <https://cubed-dev.github.io/cubed/cubed-intro.slides.html>
Examples <https://github.com/tomwhite/cubed/tree/main/examples/README.md>
api
array-api
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Cubed provides a variety of tools to understand a computation before running it,
To use these features ensure that the optional dependencies for diagnostics have been installed:

```shell
python -m pip install "cubed[diagnostics]"
pip install "cubed[diagnostics]"
```

## Visualize the computation plan
Expand Down

0 comments on commit 8781b5f

Please sign in to comment.