|
1 | | -# arrayfire-py |
2 | | - |
3 | | -Arrayfire python wrapper |
4 | | - |
5 | | -## Coverage |
6 | | - |
7 | | -- [x] Computer Vision |
8 | | -- [] Events |
9 | | -- [x] Functions to Create and Modify Arrays |
10 | | -- [x] Functions to Work with Internal Array Layout |
11 | | -- [x] Image Processing |
12 | | - - [x] Features |
13 | | -- [x] Input and Output Functions |
14 | | -- [x] Interface Functions |
15 | | -- [x] Linear Algebra |
16 | | -- [x] Machine Learning |
17 | | -- [x] Mathematical Functions |
18 | | -- [x] Signal Processing |
19 | | -- [x] Statistics |
20 | | -- [x] Unified API Functions |
21 | | -- [x] Vector Algorithms |
| 1 | +# arrayfire-py (WIP) |
| 2 | +<p align="center"><a href="http://arrayfire.com/"><img src="http://arrayfire.com/logos/arrayfire_logo_whitebkgnd.png" width="800"></a></p> |
| 3 | + |
| 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 | + |
| 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. |
| 7 | + |
| 8 | + |
| 9 | +This project is separated into 3 different parts: |
| 10 | +``` |
| 11 | +arrayfire-py -> arrayfire-binary-python-wrapper -> ArrayFire C Libraries |
| 12 | +``` |
| 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. |
| 16 | +- [`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 | + |
| 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 | +**Install the last stable version of python wrapper:** |
| 26 | +``` |
| 27 | +pip install arrayfire-py |
| 28 | +``` |
| 29 | + |
| 30 | +**Install a pre-built wheel:** |
| 31 | +``` |
| 32 | +pip install arrayfire-py -f https://repo.arrayfire.com/python/wheels/arrayfire-py/0.1.0 |
| 33 | +``` |
| 34 | + |
| 35 | +# Building |
| 36 | +Building this interface is straight forward using [scikit-build-core](https://github.com/scikit-build/scikit-build-core): |
| 37 | +``` |
| 38 | +python -m pip install -r dev-requirements.txt |
| 39 | +python -m build --wheel |
| 40 | +``` |
| 41 | + |
| 42 | +**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** |
| 43 | + |
| 44 | +# Running Tests |
| 45 | + |
| 46 | +Tests are located in folder [tests](tests). |
| 47 | + |
| 48 | +To run the tests, use: |
| 49 | +```bash |
| 50 | +python -m pytest tests/ |
| 51 | +``` |
| 52 | + |
| 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 | + |
| 62 | +# Contributing |
| 63 | + |
| 64 | +If you are interested in using ArrayFire through python, we would appreciate any feedback and contributions. |
| 65 | + |
| 66 | +The community of ArrayFire developers invites you to build with us if you are |
| 67 | +interested and able to write top-performing tensor functions. Together we can |
| 68 | +fulfill [The ArrayFire |
| 69 | +Mission](https://github.com/arrayfire/arrayfire/wiki/The-ArrayFire-Mission-Statement) |
| 70 | +for fast scientific computing for all. |
| 71 | + |
| 72 | +Contributions of any kind are welcome! Please refer to [the |
| 73 | +wiki](https://github.com/arrayfire/arrayfire/wiki) and our [Code of |
| 74 | +Conduct](33) to learn more about how you can get involved with the ArrayFire |
| 75 | +Community through |
| 76 | +[Sponsorship](https://github.com/arrayfire/arrayfire/wiki/Sponsorship), |
| 77 | +[Developer |
| 78 | +Commits](https://github.com/arrayfire/arrayfire/wiki/Contributing-Code-to-ArrayFire), |
| 79 | +or [Governance](https://github.com/arrayfire/arrayfire/wiki/Governance). |
| 80 | + |
| 81 | +# Citations and Acknowledgements |
| 82 | + |
| 83 | +If you redistribute ArrayFire, please follow the terms established in [the |
| 84 | +license](LICENSE). |
| 85 | + |
| 86 | +ArrayFire development is funded by AccelerEyes LLC and several third parties, |
| 87 | +please see the list of [acknowledgements](ACKNOWLEDGEMENTS.md) for an |
| 88 | +expression of our gratitude. |
| 89 | + |
| 90 | +# Support and Contact Info |
| 91 | + |
| 92 | +* [Slack Chat](https://join.slack.com/t/arrayfire-org/shared_invite/MjI4MjIzMDMzMTczLTE1MDI5ODg4NzYtN2QwNGE3ODA5OQ) |
| 93 | +* [Google Groups](https://groups.google.com/forum/#!forum/arrayfire-users) |
| 94 | +* ArrayFire Services: [Consulting](http://arrayfire.com/consulting) | [Support](http://arrayfire.com/download) | [Training](http://arrayfire.com/training) |
| 95 | + |
| 96 | +# Trademark Policy |
| 97 | + |
| 98 | +The literal mark "ArrayFire" and ArrayFire logos are trademarks of AccelerEyes |
| 99 | +LLC (dba ArrayFire). If you wish to use either of these marks in your own |
| 100 | +project, please consult [ArrayFire's Trademark |
| 101 | +Policy](http://arrayfire.com/trademark-policy/) |
0 commit comments