Skip to content

Commit 15461d4

Browse files
edwinsolisfsyurkevi
authored andcommitted
Added instructions to build docs with sphinx
1 parent 63ccf69 commit 15461d4

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ coverage.xml
4040
.pytest_cache/
4141

4242
# documentation build artifacts
43-
44-
docs/*.md
4543
docs/api
4644
site/
4745
mkdocs.yml

docs/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Documentation
2+
==========
3+
4+
We use [`Sphinx`](https://www.sphinx-doc.org/en/master/index.html) for presenting our documentation.
5+
6+
To build the docs follow these steps:
7+
8+
1. Install the required sphinx packages and extensions from the [requirements.txt](../requirements.txt)
9+
```sh
10+
pip install -r requirements.txt # install sphinx and its extensions
11+
```
12+
2. Build docs using sphinx
13+
```sh
14+
sphinx-build -M html docs/ output-docs/ # builds docs as html files stored in output-docs
15+
```
16+
3. Explore the docs starting at `output-docs/index.html`
17+

docs/afjit.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55
# removed, then the execution of this code would be equivalent to the
66
# following function.
77

8-
def pi_no_jit(x, y, temp, samples):
8+
import arrayfire as af
9+
10+
def pi_no_jit(x, y, samples):
911
temp = x * x
1012
temp.eval()
1113
temp += y * y
1214
temp.eval()
13-
temp = sqrt(temp)
15+
temp = af.sqrt(temp)
1416
temp.eval()
1517
temp = temp < 1
1618
temp.eval()
17-
return 4.0 * sum(temp) / samples
19+
return 4.0 * af.sum(temp) / samples
1820

19-
def pi_jit(x, y, temp, samples):
20-
temp = sqrt(x * x + y * y) < 1
21+
def pi_jit(x, y, samples):
22+
temp = af.sqrt(x * x + y * y) < 1
2123
temp.eval()
22-
return 4.0 * sum(temp) / samples
24+
return 4.0 * af.sum(temp) / samples
2325

2426
# [jit-endsnippet]

0 commit comments

Comments
 (0)