You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-22Lines changed: 28 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,28 +3,43 @@
3
3
4
4
[ArrayFire](https://github.com/arrayfire/arrayfire) is a high performance library for parallel computing with an easy-to-use API. It enables users to write scientific computing code that is portable across CUDA, OpenCL and CPU devices.
5
5
6
-
This project is a **work in progress**. It is meant to provide thin Python bindings for the ArrayFire C library, i.e, it provides array functionality, math operations, printing, etc. This is the front-end python library for using ArrayFire.
6
+
This project is a **work in progress**. It is meant to provide a numpy-like Python interface for the ArrayFire C library, i.e, it provides array functionality, math operations, printing, etc. This is the front-end python library for using ArrayFire. It is currently supported on Python 3.10+.
7
7
8
+
Here is an example of the library at work:
9
+
```py
10
+
# Set backend and device (optional: 'cuda', 'opencl', 'oneapi', 'cpu')
11
+
af.setBackend(af.BackendType.cuda)
12
+
af.setDevice(0)
8
13
14
+
# Create two 5x5 arrays on the GPU
15
+
a = af.randu((5, 5))
16
+
b = af.randu((5, 5))
17
+
18
+
# Perform element-wise addition and matrix multiplication
19
+
c = a + b
20
+
d = af.matmul(a, b)
21
+
22
+
# Print the result
23
+
print(c, "Element-wise Sum")
24
+
print(d, "Matrix Product")
25
+
```
26
+
27
+
# Installing
28
+
29
+
**Requirement Details**
9
30
This project is separated into 3 different parts:
10
31
```
11
32
arrayfire-py -> arrayfire-binary-python-wrapper -> ArrayFire C Libraries
12
33
```
13
-
The arrow `->` means `uses/depends on`. This means that arrayfire with python each of these parts is needed:
14
-
-[`arrayfire-py`](https://github.com/arrayfire/arrayfire-py) is the `thin` wrapper that provides the numpy-like interface to do math and array operations. *** This is the intended User Interface ***
15
-
-[`arrayfire-binary-python-wrapper`](https://github.com/arrayfire/arrayfire-binary-python-wrapper) is the `binary` wrapper that provides rough direct access to the functions in the C library. Its purpose is to do the handling of finding the C libraries and handling the communication between Python and C datatypes. This package can exist in two forms, with a bundled binary distribution, or merely as a loader that will load the ArrayFire library from a system or user level install.
34
+
This means that arrayfire with python each of these parts is needed:
35
+
-[`arrayfire-py`](https://github.com/arrayfire/arrayfire-py) is the `thin` wrapper that provides the numpy-like interface to execute math and array operations. *** This is the intended User Interface ***
36
+
-[`arrayfire-binary-python-wrapper`](https://github.com/arrayfire/arrayfire-binary-python-wrapper) is the `binary` wrapper that provides rough direct access to the functions in the C library.
16
37
-[`ArrayFire C Libraries`](https://github.com/arrayfire/arrayfire) are the binaries obtained from compiling the [ArrayFire C/C++ Project](https://github.com/arrayfire/arrayfire)
17
38
18
-
The main reason for this separation has to do with handling updates. Bug fixes and features for user-interface and python functionality will only require updating `arrayfire-py`, updates for the communication between Python and C will require only updating `arrayfire-binary-python-wrapper`, and updates to the internal math operations, device handling, speedup, etc will only require updating the `ArrayFire C Libraries`. This way we allow the user to customize their own ArrayFire installation (e.g. only requiring the cuda backend, using both oneapi and opencl, etc.). As we continuously update each of the components, updating one of the wrapper will not force the user to reinstall the heavy binaries, and doing updating the binaries will not necessarily force the user update the python interface they are using through `arrayfire-py`.
19
-
20
-
# Installing
21
-
22
-
The arrayfire-py can be installed from a variety of sources or can be easily and quickly built from source:
23
-
24
-
25
39
**Install the last stable version of python wrapper:**
26
-
```
27
-
pip install arrayfire-py
40
+
```sh
41
+
pip install arrayfire_binary_python_wrapper-0.8.0+af3.10.0-py3-none-linux_x86_64.whl # install required binary wrapper with the 3.10 ArrayFire binaries included
0 commit comments