Package: arrayfire
ArrayFire Python BindingsArrayFireis 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 provides Python bindings for the ArrayFire library.DocumentationDocumentation for this project can be foundover here.Example# Monte Carlo estimation of pidefcalc_pi_device(samples):# Simple, array based API# Generate uniformly distributed random numersx=af.randu(samples)y=af.randu(samples)# Supports Just In Time Compilation# The following line generates a single kernelwithin_unit_circle=(x*x+y*y)<1# Intuitive function namesreturn4*af.count(within_unit_circle)/samplesChoosing a particular backend can be done usingaf.set_backend(name)where name is either "cuda", "opencl", or "cpu". The default device is chosen in the same order of preference.Getting startedArrayFire can be installed from a variety of sources.Pre-built wheelsare available for a number of systems and toolkits. These will include a distribution of the ArrayFire libraries. Currently, only the python wrapper is available on PyPI. Wrapper-only installations will require a separate installation of the ArrayFire C/C++ libraries.
You can get the ArrayFire C/C++ library from the following sources:Download and install binariesBuild and install from sourceInstall the last stable version of python wrapper:pip install arrayfireInstall a pre-built wheel for a specific CUDA toolkit version:pip install arrayfire==3.8.0+cu112 -f https://repo.arrayfire.com/python/wheels/3.8.0/
# Replace the +cu112 local version with the desired toolkitInstall the development source distribution:pip install git+git://github.com/arrayfire/arrayfire-python.git@masterInstalling offline:cd path/to/arrayfire-python
python setup.py installRather than installing and building ArrayFire elsewhere in the system, you can also build directly through python by first setting theAF_BUILD_LOCAL_LIBS=1environment variable. Additional setup will be required to build ArrayFire, including satisfying dependencies and further CMake configuration. Details on how to pass additional arguments to the build systems can be found in thescikit-build documentation.Post Installation:If you are not using one of the pre-built wheels, you may need to ensure arrayfire-python can find the installed arrayfire libraries. Please followthese instructionsto ensure that arrayfire-python can find the arrayfire libraries.To run arrayfire tests, you can run the following command from command line.python -m arrayfire.testsCommunicationSlack ChatGoogle GroupsAcknowledgementsThe ArrayFire library is written by developers atArrayFireLLC
withcontributions from several individuals.The developers at ArrayFire LLC have received partial financial support
from several grants and institutions. Those that wish to receive public
acknowledgement are listed below:GrantsThis material is based upon work supported by the DARPA SBIR Program Office
under Contract Numbers W31P4Q-14-C-0012 and W31P4Q-15-C-0008.
Any opinions, findings and conclusions or recommendations expressed in this
material are those of the author(s) and do not necessarily reflect the views of
the DARPA SBIR Program Office.