diff --git a/.gitignore b/.gitignore index f1a00b9..60b8d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,6 @@ coverage.xml # documentation build artifacts -docs/*.md docs/api site/ mkdocs.yml diff --git a/README.md b/README.md index 81a3f90..dc6b361 100644 --- a/README.md +++ b/README.md @@ -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) +

+ +[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/) diff --git a/benchmarks/README.md b/benchmarks/README.md new file mode 100644 index 0000000..30894ce --- /dev/null +++ b/benchmarks/README.md @@ -0,0 +1,8 @@ +# Benchmarks Results +Here are some graphs comparing ArrayFire Python against other packages for some common operations: + +

+

+

+ +These graphs were generated with this benchmark code using the ArrayFire C Libraries v3.10 \ No newline at end of file diff --git a/benchmarks/img/comparison_afcuda_t4.png b/benchmarks/img/comparison_afcuda_t4.png new file mode 100644 index 0000000..e9c90e8 Binary files /dev/null and b/benchmarks/img/comparison_afcuda_t4.png differ diff --git a/benchmarks/img/comparison_afoneapi_b580.png b/benchmarks/img/comparison_afoneapi_b580.png new file mode 100644 index 0000000..6097b60 Binary files /dev/null and b/benchmarks/img/comparison_afoneapi_b580.png differ diff --git a/benchmarks/img/comparison_afopencl_b580.png b/benchmarks/img/comparison_afopencl_b580.png new file mode 100644 index 0000000..5f624fc Binary files /dev/null and b/benchmarks/img/comparison_afopencl_b580.png differ diff --git a/benchmarks/img/comparison_afopencl_t4.png b/benchmarks/img/comparison_afopencl_t4.png new file mode 100644 index 0000000..a8b62a1 Binary files /dev/null and b/benchmarks/img/comparison_afopencl_t4.png differ diff --git a/docs/release_notes.md b/docs/release_notes.md new file mode 100644 index 0000000..cc17462 --- /dev/null +++ b/docs/release_notes.md @@ -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 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 4ea40fe..bb3570c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/requirements.txt b/requirements.txt index d3f5294..b80463e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -arrayfire-binary-python-wrapper==0.7.0+af3.9.0 +arrayfire-binary-python-wrapper>=0.7.0+af3.9.0