Skip to content

Commit 83b1edf

Browse files
edwinsolisfsyurkevi
authored andcommitted
Moved benchmarks, cleaned up readme
1 parent 7dd9198 commit 83b1edf

File tree

6 files changed

+36
-22
lines changed

6 files changed

+36
-22
lines changed

README.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,43 @@
33

44
[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.
55

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+.
77

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)
813

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**
930
This project is separated into 3 different parts:
1031
```
1132
arrayfire-py -> arrayfire-binary-python-wrapper -> ArrayFire C Libraries
1233
```
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.
1637
- [`ArrayFire C Libraries`](https://github.com/arrayfire/arrayfire) are the binaries obtained from compiling the [ArrayFire C/C++ Project](https://github.com/arrayfire/arrayfire)
1738

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-
2539
**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
42+
pip install arrayfire-py # install arrayfire python interface library
2843
```
2944

3045
**Install a pre-built wheel:**
@@ -50,15 +65,6 @@ To run the tests, use:
5065
python -m pytest tests/
5166
```
5267

53-
# Benchmarks
54-
Here are some graphs comparing ArrayFire Python against other packages for some common operations:
55-
56-
<p align="center"><img src="docs/benchmark_results/comparison_afcuda_t4.png" width="800"></a></p>
57-
<p align="center"><img src="docs/benchmark_results/comparison_afopencl_t4.png" width="800"></a></p>
58-
<p align="center"><img src="docs/benchmark_results/comparison_afoneapi_b580.png" width="800"></a></p>
59-
60-
These graphs were generated with this benchmark code using the ArrayFire C Libraries v3.10
61-
6268
# Contributing
6369

6470
If you are interested in using ArrayFire through python, we would appreciate any feedback and contributions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

benchmarks/results.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Benchmarks
2+
Here are some graphs comparing ArrayFire Python against other packages for some common operations:
3+
4+
<p align="center"><img src="img/comparison_afcuda_t4.png" width="800"></a></p>
5+
<p align="center"><img src="img/comparison_afopencl_t4.png" width="800"></a></p>
6+
<p align="center"><img src="img/comparison_afoneapi_b580.png" width="800"></a></p>
7+
8+
These graphs were generated with this benchmark code using the ArrayFire C Libraries v3.10

0 commit comments

Comments
 (0)