Skip to content

Readme and Release notes update #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ coverage.xml

# documentation build artifacts

docs/*.md
docs/api
site/
mkdocs.yml
128 changes: 107 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,107 @@
# arrayfire-py

Arrayfire python wrapper

## Coverage

- [x] Computer Vision
- [] Events
- [x] Functions to Create and Modify Arrays
- [x] Functions to Work with Internal Array Layout
- [x] Image Processing
- [x] Features
- [x] Input and Output Functions
- [x] Interface Functions
- [x] Linear Algebra
- [x] Machine Learning
- [x] Mathematical Functions
- [x] Signal Processing
- [x] Statistics
- [x] Unified API Functions
- [x] Vector Algorithms
# arrayfire-py (WIP)
<p align="center"><a href="http://arrayfire.com/"><img src="http://arrayfire.com/logos/arrayfire_logo_whitebkgnd.png" width="800"></a></p>

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

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

Here is an example of the library at work:
```py
# Set backend and device (optional: 'cuda', 'opencl', 'oneapi', 'cpu')
af.setBackend(af.BackendType.cuda)
af.setDevice(0)

# Create two 5x5 arrays on the GPU
a = af.randu((5, 5))
b = af.randu((5, 5))

# Perform element-wise addition and matrix multiplication
c = a + b
d = af.matmul(a, b)

# Print the result
print(c, "Element-wise Sum")
print(d, "Matrix Product")
```

# Installing

**Requirement Details**
This project is separated into 3 different parts:
```
arrayfire-py -> arrayfire-binary-python-wrapper -> ArrayFire C Libraries
```
This means that arrayfire with python each of these parts is needed:
- [`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 ***
- [`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.
- [`ArrayFire C Libraries`](https://github.com/arrayfire/arrayfire) are the binaries obtained from compiling the [ArrayFire C/C++ Project](https://github.com/arrayfire/arrayfire)

**Install the last stable version of python wrapper:**
```sh
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
pip install arrayfire-py # install arrayfire python interface library
```

**Install a pre-built wheel:**
```
pip install arrayfire-py -f https://repo.arrayfire.com/python/wheels/arrayfire-py/0.1.0
```

# Building
Building this interface is straight forward using [scikit-build-core](https://github.com/scikit-build/scikit-build-core):
```
python -m pip install -r dev-requirements.txt
python -m build --wheel
```

**Note: Building this project does not require the arrayfire-binary-python-wrapper package; however, the binary wrapper is needed to run any projects with it**

# Running Tests

Tests are located in folder [tests](tests).

To run the tests, use:
```bash
python -m pytest tests/
```

# Contributing

If you are interested in using ArrayFire through python, we would appreciate any feedback and contributions.

The community of ArrayFire developers invites you to build with us if you are
interested and able to write top-performing tensor functions. Together we can
fulfill [The ArrayFire
Mission](https://github.com/arrayfire/arrayfire/wiki/The-ArrayFire-Mission-Statement)
for fast scientific computing for all.

Contributions of any kind are welcome! Please refer to [the
wiki](https://github.com/arrayfire/arrayfire/wiki) and our [Code of
Conduct](33) to learn more about how you can get involved with the ArrayFire
Community through
[Sponsorship](https://github.com/arrayfire/arrayfire/wiki/Sponsorship),
[Developer
Commits](https://github.com/arrayfire/arrayfire/wiki/Contributing-Code-to-ArrayFire),
or [Governance](https://github.com/arrayfire/arrayfire/wiki/Governance).

# Citations and Acknowledgements

If you redistribute ArrayFire, please follow the terms established in [the
license](LICENSE).

ArrayFire development is funded by AccelerEyes LLC and several third parties,
please see the list of [acknowledgements](ACKNOWLEDGEMENTS.md) for an
expression of our gratitude.

# Support and Contact Info

* [Slack Chat](https://join.slack.com/t/arrayfire-org/shared_invite/MjI4MjIzMDMzMTczLTE1MDI5ODg4NzYtN2QwNGE3ODA5OQ)
* [Google Groups](https://groups.google.com/forum/#!forum/arrayfire-users)
* ArrayFire Services: [Consulting](http://arrayfire.com/consulting) | [Support](http://arrayfire.com/download) | [Training](http://arrayfire.com/training)

# Trademark Policy

The literal mark "ArrayFire" and ArrayFire logos are trademarks of AccelerEyes
LLC (dba ArrayFire). If you wish to use either of these marks in your own
project, please consult [ArrayFire's Trademark
Policy](http://arrayfire.com/trademark-policy/)
8 changes: 8 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Benchmarks Results
Here are some graphs comparing ArrayFire Python against other packages for some common operations:

<p align="center"><img src="img/comparison_afcuda_t4.png" width="800"></a></p>
<p align="center"><img src="img/comparison_afopencl_t4.png" width="800"></a></p>
<p align="center"><img src="img/comparison_afoneapi_b580.png" width="800"></a></p>

These graphs were generated with this benchmark code using the ArrayFire C Libraries v3.10
Binary file added benchmarks/img/comparison_afcuda_t4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/img/comparison_afoneapi_b580.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/img/comparison_afopencl_b580.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/img/comparison_afopencl_t4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Release Notes {#releasenotes}
==============

v0.1.0
======
Welcome to the ArrayFire Python Bindings! These are the currently supported features:

- Support for all backends (cpu, opencl, oneapi, cuda)
- Computer Vision
- Functions to Create and Modify Arrays
- Functions to Work with Internal Array Layout
- Image Processing with Features
- Input and Output Functions
- Interface Functions
- Linear Algebra
- Machine Learning
- Mathematical Functions
- Signal Processing
- Statistics
- Unified API Functions
- Vector Algorithms
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "arrayfire"
version = "0.1.0"
dependencies = ["arrayfire-binary-python-wrapper == 0.7.0"]
dependencies = ["arrayfire-binary-python-wrapper >= 0.7.0"]
requires-python = ">=3.10"
description = "ArrayFire Python"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
arrayfire-binary-python-wrapper==0.7.0+af3.9.0
arrayfire-binary-python-wrapper>=0.7.0+af3.9.0