Skip to content

Commit 9d23ed2

Browse files
committed
adds README with build instructions
1 parent ef944cf commit 9d23ed2

File tree

4 files changed

+81
-29
lines changed

4 files changed

+81
-29
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2023, Anton
3+
Copyright (c) 2023, ArrayFire
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

README.md

+73-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,75 @@
11
# arrayfire-binary-python-wrapper
22

3-
Arrayfire python C library wrapper
4-
5-
## Coverage
6-
7-
- [x] Computer Vision
8-
- [x] 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
3+
[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.
4+
This project is meant to provide thin Python bindings for the ArrayFire C library. It also decouples releases of the main C/C++ library from the Python library by acting as a intermediate library and only wrapping the provided C calls.
5+
This allows the building of large binary wheels only when the underlying ArrayFire version is increased, and the fully-featured Python library can be developed atop independently. This package is not intended to be used directly and merely exposes the
6+
C functionality required by downstream implementations. 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.
7+
8+
# Installing
9+
10+
The arrayfire-binary-python-wrapper can be installed from a variety of sources. [Pre-built wheels](https://repo.arrayfire.com/python/wheels/3.9.0/) are available for a number of systems and toolkits. These will include a binary distribution of the ArrayFire libraries. Installing from PyPI directly will only include a wrapper-only, source distribution that will not contain binaries. In this case, wrapper-only installations will require a separate installation of the ArrayFire C/C++ libraries.
11+
You can get the ArrayFire C/C++ library from the following sources:
12+
13+
- [Download and install binaries](https://arrayfire.com/download)
14+
- [Build and install from source](https://github.com/arrayfire/arrayfire)
15+
16+
17+
**Install the last stable version of python wrapper:**
18+
```
19+
pip install arrayfire-binary-python-wrapper
20+
```
21+
22+
**Install a pre-built wheel:**
23+
```
24+
pip install arrayfire-binary-python-wrapper -f https://repo.arrayfire.com/python/wheels/3.9.0/
25+
```
26+
27+
# Building
28+
The arrayfire-binary-python-wrapper can build wheels in packaged-binary or in system-wrapper modes.
29+
[scikit-build-core](https://github.com/scikit-build/scikit-build-core) is used to provide the python build backend.
30+
The minimal, wrapper-only mode that relies on a system install will be built by default though the regular python build process. For example:
31+
```
32+
pipx run build --wheel
33+
```
34+
Building a full pre-packaged local binary is an involved process that will require referencing the regular ArrayFire [build](https://github.com/arrayfire/arrayfire/wiki/Build-Instructions-for-Linux) [procedures](https://github.com/arrayfire/arrayfire/wiki/Build-Instructions-for-Windows).
35+
Besides the regular ArrayFire CMake configuration, building the binaries is an opt-in process that is set by an environment variable `AF_BUILD_LOCAL_LIBS=1`. Once that environment variable is set, scikit-build-core will take care of cloning ArrayFire, building, and including the necessary binaries.
36+
37+
38+
# Contributing
39+
40+
The community of ArrayFire developers invites you to build with us if you are
41+
interested and able to write top-performing tensor functions. Together we can
42+
fulfill [The ArrayFire
43+
Mission](https://github.com/arrayfire/arrayfire/wiki/The-ArrayFire-Mission-Statement)
44+
for fast scientific computing for all.
45+
46+
Contributions of any kind are welcome! Please refer to [the
47+
wiki](https://github.com/arrayfire/arrayfire/wiki) and our [Code of
48+
Conduct](33) to learn more about how you can get involved with the ArrayFire
49+
Community through
50+
[Sponsorship](https://github.com/arrayfire/arrayfire/wiki/Sponsorship),
51+
[Developer
52+
Commits](https://github.com/arrayfire/arrayfire/wiki/Contributing-Code-to-ArrayFire),
53+
or [Governance](https://github.com/arrayfire/arrayfire/wiki/Governance).
54+
55+
# Citations and Acknowledgements
56+
57+
If you redistribute ArrayFire, please follow the terms established in [the
58+
license](LICENSE).
59+
60+
ArrayFire development is funded by AccelerEyes LLC and several third parties,
61+
please see the list of [acknowledgements](ACKNOWLEDGEMENTS.md) for an
62+
expression of our gratitude.
63+
64+
# Support and Contact Info
65+
66+
* [Slack Chat](https://join.slack.com/t/arrayfire-org/shared_invite/MjI4MjIzMDMzMTczLTE1MDI5ODg4NzYtN2QwNGE3ODA5OQ)
67+
* [Google Groups](https://groups.google.com/forum/#!forum/arrayfire-users)
68+
* ArrayFire Services: [Consulting](http://arrayfire.com/consulting) | [Support](http://arrayfire.com/download) | [Training](http://arrayfire.com/training)
69+
70+
# Trademark Policy
71+
72+
The literal mark "ArrayFire" and ArrayFire logos are trademarks of AccelerEyes
73+
LLC (dba ArrayFire). If you wish to use either of these marks in your own
74+
project, please consult [ArrayFire's Trademark
75+
Policy](http://arrayfire.com/trademark-policy/)

arrayfire_wrapper/_backend.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from .defines import is_arch_x86
1515
from .version import ARRAYFIRE_VER_MAJOR
16+
from arrayfire_wrapper.lib.unified_api_functions import set_backend as unified_set_backend
1617

1718
VERBOSE_LOADS = os.environ.get("AF_VERBOSE_LOADS", "") == "1"
1819

@@ -185,7 +186,6 @@ def __init__(self) -> None:
185186
def set_backend(self, backend_type : BackendType) -> None:
186187
# if unified is available, do dynamic module loading through libaf
187188
if self._backend_type == BackendType.unified:
188-
from arrayfire_wrapper.lib.unified_api_functions import set_backend as unified_set_backend
189189
try:
190190
unified_set_backend(backend_type)
191191
except RuntimeError:
@@ -267,7 +267,7 @@ def _lib_names(self, name: str, lib: _LibPrefixes, ver_major: str | None = None)
267267
post = self._backend_path_config.lib_postfix if ver_major is None else ver_major
268268
lib_name = self._backend_path_config.lib_prefix + lib.value + name + post
269269

270-
lib_paths = [Path("", lib_name)]
270+
lib_paths = [Path(lib_name)]
271271

272272
# use local or site packaged arrayfire libraries if they exist
273273
try:

pyproject.toml

+5-7
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ exclude = '''
2222
requires = ["scikit-build-core"]
2323
build-backend = "scikit_build_core.build"
2424

25-
#[tool.setuptools.dynamic]
26-
#version = { attr = "arrayfire_wrapper.VERSION" }
25+
# TODO: re-enable if/when scikit-core can support
26+
# [tool.setuptools.dynamic]
27+
# version = { attr = "arrayfire_wrapper.__version__" }
28+
# dynamic = ["version"]
2729

2830
[project]
2931
name = "arrayfire-binary-python-wrapper"
30-
#dynamic = ["version"]
31-
version = "3.9"
32+
version = "0.5.0+AF3.9.0"
3233
requires-python = ">=3.10"
3334
authors = [
3435
{ name = "ArrayFire", email = "[email protected]"},
@@ -73,9 +74,6 @@ Website = "http://arrayfire.com"
7374
# The build directory. Defaults to a temporary directory, but can be set.
7475
build-dir = "build"
7576

76-
#[tool.scikit-build.sdist]
77-
#packages = ["arrayfire_wrapper"]
78-
7977
[tool.scikit-build.wheel]
8078
py-api = "py3"
8179
packages = ["arrayfire_wrapper"]

0 commit comments

Comments
 (0)