Skip to content

Commit bc93374

Browse files
committed
Docs page for DEVELOPMENT.md content
- update dev branch name
1 parent ae3cb8c commit bc93374

File tree

3 files changed

+65
-12
lines changed

3 files changed

+65
-12
lines changed

DEVELOPMENT.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Development
22

3-
The current "development" branch of OQuPy implements
3+
The current development branch "dev/jax" implements
44

55
* [Experimental Support for GPUs/TPUs](#experimental-support-for-gpustpus)
66

@@ -10,32 +10,32 @@ Although OQuPy is built on top of the backend-agnostic
1010
[TensorNetwork](https://github.com/google/TensorNetwork) library,
1111
OQuPy uses vanilla NumPy and SciPy throughout its implementation.
1212

13-
This "experimental" approach implements backend support for [JAX](https://jax.readthedocs.io/en/latest/)
14-
through a new `oqupy.backends.numerical_backend.py` module which handles the
13+
The "dev/jax" branch adds supports for GPUs/TPUs via the
14+
[JAX](https://jax.readthedocs.io/en/latest/) library.
15+
A new `oqupy.backends.numerical_backend.py` module handles the
1516
[breaking changes in JAX NumPy](https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html),
1617
while the rest of the modules utilizes `numpy` and `scipy.linalg` instances from there
1718
without explicitly importing JAX-based libraries.
1819

1920
### Enabling Experimental Features
2021

21-
To enable experimental features in the , use
22+
To enable experimental features switch to the `dev/jax` branch and use
2223
```python
23-
from oqupy.backends import enable_experimental_features
24-
enable_experimental_features()
24+
from oqupy.backends import enable_gpu_features
25+
enable_gpu_features()
2526
```
2627

27-
### Contributing to Experimental Feautres
28+
### Contributing Guidelines
2829

29-
If you wish to contribute to these "experimental" features,
30-
an optional set of guidelines can be followed to reduce the maintenance overhead.
31-
These are, to:
30+
To contribute features compatible with the JAX backend,
31+
please adhere to the following set of guidelines:
3232

3333
* avoid wildcard imports of NumPy and SciPy.
34-
* use `from oqupy.backends.numerical_backend import np` instead of `import numpy as np` and use the alias `default_np` for vanilla NumPy.
34+
* use `from oqupy.backends.numerical_backend import np` instead of `import numpy as np` and use the alias `default_np` in cases vanilla NumPy is explicitly required.
3535
* use `from oqupy.backends.numerical_backend import la` instead of `import scipy.linalg as la`, except that for non-symmetric eigen-decomposition, `scipy.linalg.eig` should be used.
3636
* use one of `np.dtype_complex` (`np.dtype_float`) or `oqupy.config.NumPyDtypeComplex` (`oqupy.config.NumPyDtypeFloat`) instead of `np.complex_` (`np.float_`).
3737
* convert lists or tuples to arrays when passing them as arguments inside functions.
3838
* use `array = np.update(array, indices, values)` instead of `array[indices] = values`.
3939
* use `np.get_random_floats(seed, shape)` instead of `np.random.default_rng(seed).random(shape)`.
4040
* declare signatures for `np.vectorize` explicitly.
41-
* avoid in-place updates of `shape` attribute.
41+
* avoid directly changing the `shape` attribute of an array (use `.reshape` instead)

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Furthermore, OQuPy implements methods to ...
112112
:caption: Development
113113

114114
pages/contributing
115+
pages/gpu_features
115116
pages/authors
116117
pages/how_to_cite
117118
pages/sharing

docs/pages/gpu_features.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Experimental Support for GPUs/TPUs
2+
==================================
3+
The current development branch "dev/jax" implements experimental support
4+
for GPUs/TPUs.
5+
6+
Although OQuPy is built on top of the backend-agnostic
7+
`TensorNetwork <https://github.com/google/TensorNetwork>`__ library,
8+
OQuPy uses vanilla NumPy and SciPy throughout its implementation.
9+
10+
The "dev/jax" branch adds supports for GPUs/TPUs via the
11+
`JAX <https://jax.readthedocs.io/en/latest/>`__ library. A new
12+
``oqupy.backends.numerical_backend.py`` module handles the
13+
`breaking changes in JAX
14+
NumPy <https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html>`__,
15+
while the rest of the modules utilizes ``numpy`` and ``scipy.linalg``
16+
instances from there without explicitly importing JAX-based libraries.
17+
18+
Enabling Experimental Features
19+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
21+
To enable experimental features, switch to the ``dev/jax`` branch and use
22+
23+
.. code:: python
24+
25+
from oqupy.backends import enable_gpu_features
26+
enable_gpu_features()
27+
28+
Contributing Guidelines
29+
~~~~~~~~~~~~~~~~~~~~~~~
30+
31+
To contribute features compatible with the JAX backend,
32+
please adhere to the following set of guidelines:
33+
34+
- avoid wildcard imports of NumPy and SciPy.
35+
- use ``from oqupy.backends.numerical_backend import np`` instead of
36+
``import numpy as np`` and use the alias ``default_np`` in cases
37+
vanilla NumPy is explicitly required.
38+
- use ``from oqupy.backends.numerical_backend import la`` instead of
39+
``import scipy.linalg as la``, except that for non-symmetric
40+
eigen-decomposition, ``scipy.linalg.eig`` should be used.
41+
- use one of ``np.dtype_complex`` (``np.dtype_float``) or
42+
``oqupy.config.NumPyDtypeComplex`` (``oqupy.config.NumPyDtypeFloat``)
43+
instead of ``np.complex_`` (``np.float_``).
44+
- convert lists or tuples to arrays when passing them as arguments
45+
inside functions.
46+
- use ``array = np.update(array, indices, values)`` instead of
47+
``array[indices] = values``.
48+
- use ``np.get_random_floats(seed, shape)`` instead of
49+
``np.random.default_rng(seed).random(shape)``.
50+
- declare signatures for ``np.vectorize`` explicitly.
51+
- avoid directly changing the ``shape`` attribute of an array (use
52+
``.reshape`` instead)

0 commit comments

Comments
 (0)