Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 298465f

Browse files
committed
Updating the README
- Added documentation link - Fixed the code sample - Removed sample outputs
1 parent 2299b2a commit 298465f

File tree

1 file changed

+15
-69
lines changed

1 file changed

+15
-69
lines changed

‎README.md

Lines changed: 15 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -9,80 +9,26 @@
99
| Windows | [![Build Status](http://ci.arrayfire.org/buildStatus/icon?job=arrayfire-wrappers/python-windows)](http://ci.arrayfire.org/view/All/job/arrayfire-wrappers/job/python-windows/) |
1010
| OSX | [![Build Status](http://ci.arrayfire.org/buildStatus/icon?job=arrayfire-wrappers/python-osx)](http://ci.arrayfire.org/view/All/job/arrayfire-wrappers/job/python-osx/) |
1111

12-
## Example
13-
14-
```python
15-
import arrayfire as af
16-
17-
# Display backend information
18-
af.info()
19-
20-
# Generate a uniform random array with a size of 5 elements
21-
a = af.randu(5, 1)
22-
23-
# Print a and its minimum value
24-
af.display(a)
25-
26-
# Print min and max values of a
27-
print("Minimum, Maximum: ", af.min(a), af.max(a))
28-
```
29-
30-
## Sample outputs
12+
## Documentation
3113

32-
On an AMD GPU:
14+
Documentation for this project can be found [over here](http://arrayfire.org/arrayfire-python/).
3315

34-
```
35-
Using opencl backend
36-
ArrayFire v3.0.1 (OpenCL, 64-bit Linux, build 17db1c9)
37-
[0] AMD : Spectre
38-
-1- AMD : AMD A10-7850K Radeon R7, 12 Compute Cores 4C+8G
39-
40-
[5 1 1 1]
41-
0.4107
42-
0.8224
43-
0.9518
44-
0.1794
45-
0.4198
46-
47-
Minimum, Maximum: 0.17936542630195618 0.9517996311187744
48-
```
49-
50-
On an NVIDIA GPU:
16+
## Example
5117

18+
```python
19+
# Monte Carlo estimation of pi
20+
def calc_pi_device(samples):
21+
# Simple, array based API
22+
# Generate uniformly distributed random numers
23+
x = af.randu(samples)
24+
y = af.randu(samples)
25+
# Supports Just In Time Compilation
26+
# The following line generates a single kernel
27+
within_unit_circle = (x * x + y * y) < 1
28+
# Intuitive function names
29+
return 4 * af.count(within_unit_circle) / samples
5230
```
53-
Using cuda backend
54-
ArrayFire v3.0.0 (CUDA, 64-bit Linux, build 86426db)
55-
Platform: CUDA Toolkit 7, Driver: 346.46
56-
[0] Tesla K40c, 12288 MB, CUDA Compute 3.5
57-
-1- GeForce GTX 750, 1024 MB, CUDA Compute 5.0
58-
59-
Generate a random matrix a:
60-
[5 1 1 1]
61-
0.7402
62-
0.9210
63-
0.0390
64-
0.9690
65-
0.9251
66-
67-
Minimum, Maximum: 0.039020489901304245 0.9689629077911377
68-
```
69-
70-
Fallback to CPU when CUDA and OpenCL are not availabe:
7131

72-
```
73-
Using cpu backend
74-
ArrayFire v3.0.0 (CPU, 64-bit Linux, build 86426db)
75-
76-
Generate a random matrix a:
77-
[5 1 1 1]
78-
0.0000
79-
0.1315
80-
0.7556
81-
0.4587
82-
0.5328
83-
84-
Minimum, Maximum: 7.825903594493866e-06 0.7556053400039673
85-
```
8632

8733
Choosing a particular backend can be done using `af.backend.set( backend_name )` where backend_name can be one of: "_cuda_", "_opencl_", or "_cpu_". The default device is chosen in the same order of preference.
8834

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /